Class: KPM::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/kpm/installer.rb

Constant Summary collapse

LATEST_VERSION =
'LATEST'
SHA1_FILENAME =
'sha1.yml'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_config, logger = nil) ⇒ Installer

Returns a new instance of Installer.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/kpm/installer.rb', line 13

def initialize(raw_config, logger=nil)

  raise(ArgumentError, 'killbill or kaui section must be specified') if raw_config['killbill'].nil? and raw_config['kaui'].nil?
  @config      = raw_config['killbill']
  @kaui_config = raw_config['kaui']

  if logger.nil?
    @logger       = Logger.new(STDOUT)
    @logger.level = Logger::INFO
  else
    @logger = logger
  end

  @nexus_config     = !@config.nil? ? @config['nexus'] : @kaui_config['nexus']
  @nexus_ssl_verify = !@nexus_config.nil? ? @nexus_config['ssl_verify'] : true
end

Class Method Details

.from_file(config_path, logger = nil) ⇒ Object



9
10
11
# File 'lib/kpm/installer.rb', line 9

def self.from_file(config_path, logger=nil)
  Installer.new(YAML::load_file(config_path), logger)
end

Instance Method Details

#install(force_download = false, verify_sha1 = true) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kpm/installer.rb', line 30

def install(force_download=false, verify_sha1=true)
  @force_download = force_download
  @verify_sha1 = verify_sha1

  unless @config.nil?
    @bundles_dir = @config['plugins_dir']
    @sha1_file = "#{@bundles_dir}/#{SHA1_FILENAME}"

    install_killbill_server
    install_plugins
    install_default_bundles
  end
  unless @kaui_config.nil?
    install_kaui
  end
end