class Pantograph::Actions::RsyncAction

Public Class Methods

authors() click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 52
def self.authors
  ['hjanuschka']
end
available_options() click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 28
def self.available_options
  [
    PantographCore::ConfigItem.new(key: :extra,
                                 short_option: '-X',
                                 env_name: 'RSYNC_EXTRA', # The name of the environment variable
                                 description: 'Port', # a short description of this parameter
                                 optional: true,
                                 default_value: '-av',
                                 type: String),
    PantographCore::ConfigItem.new(key: :source,
                                 short_option: '-S',
                                 env_name: 'RSYNC_SRC', # The name of the environment variable
                                 description: 'source file/folder', # a short description of this parameter
                                 optional: false,
                                 type: String),
    PantographCore::ConfigItem.new(key: :destination,
                                 short_option: '-D',
                                 env_name: 'RSYNC_DST', # The name of the environment variable
                                 description: 'destination file/folder', # a short description of this parameter
                                 optional: false,
                                 type: String)
  ]
end
category() click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 69
def self.category
  :misc
end
description() click to toggle source

@!group Documentation

# File pantograph/lib/pantograph/actions/rsync.rb, line 20
def self.description
  'Rsync files from :source to :destination'
end
details() click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 24
def self.details
  'A wrapper around `rsync`, which is a tool that lets you synchronize files, including permissions and so on. For a more detailed information about `rsync`, please see [rsync(1) man page](https://linux.die.net/man/1/rsync).'
end
example_code() click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 60
def self.example_code
  [
    'rsync(
      source: "root@host:/tmp/1.txt",
      destination: "/tmp/local_file.txt"
    )'
  ]
end
is_supported?(platform) click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 56
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File pantograph/lib/pantograph/actions/rsync.rb, line 8
def self.run(params)
  rsync_cmd = ['rsync']
  rsync_cmd << params[:extra]
  rsync_cmd << params[:source]
  rsync_cmd << params[:destination]
  Actions.sh(rsync_cmd.join(" "))
end