Class: Ssync::Command

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/ssync/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#action_eq?, #aquire_lock!, #ask, #config_exists?, #config_path, #create_homedir!, #default_config_path, #display, #display_error, #display_help!, #exit_with_error!, #lock_path, #options_set?, #read_config, #read_default_config, #ssync_filename, #ssync_homedir, #write_config!, #write_default_config!

Constructor Details

#initialize(action = :sync, *args) ⇒ Command

Returns a new instance of Command.



19
20
21
22
23
24
25
26
27
# File 'lib/ssync/command.rb', line 19

def initialize(action = :sync, *args)
  @@action = action.to_sym
  @@args   = *args

  if @@args[0] && @@args[0][0, 1] != "-"
    Setup.default_config[:last_used_bucket] = @@args[0]
    write_default_config!(Setup.default_config)
  end
end

Class Method Details

.actionObject



7
8
9
# File 'lib/ssync/command.rb', line 7

def self.action
  @@action
end

.argsObject



11
12
13
# File 'lib/ssync/command.rb', line 11

def self.args
  @@args
end

.run!(*args) ⇒ Object



15
16
17
# File 'lib/ssync/command.rb', line 15

def self.run!(*args)
  new(*args).run!
end

Instance Method Details

#run!Object



29
30
31
32
33
# File 'lib/ssync/command.rb', line 29

def run!
  util_check!
  pre_run_check!
  perform_action!
end