Class: Arver::Bootstrap

Inherits:
Object
  • Object
show all
Defined in:
lib/arver/bootstrap.rb

Class Method Summary collapse

Class Method Details

.load_runtime_config(options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/arver/bootstrap.rb', line 27

def load_runtime_config(options)
  rtc = Arver::RuntimeConfig.instance
  rtc.dry_run = options[:dry_run]
  rtc.ask_password = options[:ask_password]
  rtc.force = options[:force]
  rtc.violence = options[:violence]
  rtc.test_mode = options[:test_mode]
  rtc.trust_all = options[:trust_all]
  rtc.global_key_path = options[:global_key_path]
end

.run(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/arver/bootstrap.rb', line 3

def run(options)
  local = Arver::LocalConfig.instance
  local.config_dir = options[:config_dir] unless options[:config_dir].empty?
  local.username = options[:user] unless options[:user].empty?
  
  return true if options[:action] == :init

  unless local.username.present?
    Arver::Log.error( "No user defined" )
    return false
  end

  config = Arver::Config.instance
  config.load

  self.load_runtime_config(options)

  unless Arver::Config.instance.exists?(local.username)
    Arver::Log.error( "No such user #{local.username}" )
    return false
  end
  Arver::GPGKeyManager.check_key_of(local.username)
end