Class: DRbQS::Command::SSH

Inherits:
Base
  • Object
show all
Defined in:
lib/drbqs/command_line/command_ssh.rb

Constant Summary collapse

HELP_MESSAGE =
<<HELP
Usage: #{@@command_name} <command> [arguments ...]
  Execute command over SSH.
  <command> is 'list', 'show', 'environment', 'execute', 'server', or 'node'.

  #{@@command_name} list
  #{@@command_name} show <configuration>
  #{@@command_name} environment <destination>
  #{@@command_name} execute <destination> [options ...] -- [arguments ...]
  #{@@command_name} server <destination> [options ...] -- [arguments ...]
  #{@@command_name} node <destination> [options ...] -- [arguments ...]

HELP

Constants included from Misc

Misc::STRINGS_FOR_KEY

Instance Method Summary collapse

Methods inherited from Base

exec, #exec, #setting

Methods included from Argument

check_argument_size, split_arguments

Methods included from Misc

create_logger, create_uri, output_error, process_running_normally?, random_key, time_to_history_string, time_to_history_string2, uri_drbunix

Constructor Details

#initializeSSH

Returns a new instance of SSH.



18
19
20
# File 'lib/drbqs/command_line/command_ssh.rb', line 18

def initialize
  super(DRbQS::Setting::SSH, HELP_MESSAGE)
end

Instance Method Details

#parse_option(argv) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/drbqs/command_line/command_ssh.rb', line 22

def parse_option(argv)
  args, mode_args = split_arguments(argv)
  args = option_parser_base(args, :debug => true) do |opt|
    set(:directory, '-d DIR', '--directory DIR', String, 'Set the base directory over ssh.')
    set(:shell, '--shell STR', String, 'Set the shell over ssh')
    set(:rvm, '--rvm STR', String, 'Ruby version to use on RVM over ssh.')
    set(:rvm_init, '--rvm-init PATH', String, 'Path of script to initialize RVM over ssh.')
    set(:output, '-o DIR', '--output DIR', String, 'Directory path that a server and nodes output.')
    set(:nice, '--nice NUM', Integer, 'Set the value of nice for a server and nodes. The default is 10.')
    set(:bundler, '--bundler', 'Use bundler to execute filename-create, drbqs-server, and drbqs-node.')
  end
  setting.set_argument(*args)
  case setting.get_argument[0]
  when 'server'
    parser = DRbQS::Command::Server.new
    parser.parse_option(mode_args)
    setting.mode_setting = parser.setting
  when 'node'
    parser = DRbQS::Command::Node.new
    parser.parse_option(mode_args)
    setting.mode_setting = parser.setting
  when 'execute'
    setting.configure_mode_setting(:execute) do |mode_setting|
      mode_setting.argument.concat(mode_args)
    end
  end
end