Class: Composer::Setup::Heirloom

Inherits:
Object
  • Object
show all
Defined in:
lib/composer/setup/heirloom.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Heirloom

Returns a new instance of Heirloom.



4
5
6
7
# File 'lib/composer/setup/heirloom.rb', line 4

def initialize(args)
  @config = args[:config]
  @logger = @config.logger
end

Instance Method Details

#setup(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/composer/setup/heirloom.rb', line 9

def setup(args)
  name = args[:name]

  write_config_file

  ["#{name}-chef-repo", "#{name}-app"].each do |heirloom|
    if heirloom_exists?(heirloom)
      raise HeirloomExists "#{@name}-#{heirloom} exists. Use force to continue."
    end

    command = "heirloom setup -b #{name} -n #{heirloom} -r us-west-1 -r us-west-2 -r us-east-1 -m us-west-1"
    @logger.info "Setting up Heirloom: '#{heirloom}'"
    @logger.debug "Executing: `#{command}`"
    output = `#{command}`
    @logger.debug "Exited with status: '#{$?.exitstatus}'"
    unless $?.success?
      raise CommandError.new output
    end
    sleep 15
  end
end