Class: Amigrind::Builder

Inherits:
Object
  • Object
show all
Includes:
Core::Logging::Mixin
Defined in:
lib/amigrind/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(aws_credentials, blueprint, repo) ⇒ Builder

Returns a new instance of Builder.



9
10
11
12
13
14
# File 'lib/amigrind/builder.rb', line 9

def initialize(aws_credentials, blueprint, repo)
  @blueprint = blueprint
  @repo = repo

  @amigrind_client = Amigrind::Core::Client.new(@blueprint.aws.region, aws_credentials)
end

Instance Method Details

#buildObject



16
17
18
19
20
21
# File 'lib/amigrind/builder.rb', line 16

def build
  lint
  template = rackerize

  run(template)
end

#lintObject



23
24
25
26
27
28
29
30
31
# File 'lib/amigrind/builder.rb', line 23

def lint
  errors = []

  errors << "No channel set in the blueprint; this will result in " \
            "an image that can only be retrieved via :latest, which " \
            "you may not want." if @blueprint.build_channel.nil?

  errors.each { |e| warn_log(e) }
end

#rackerizeObject



33
34
35
# File 'lib/amigrind/builder.rb', line 33

def rackerize
  template = Build::Rackerizer.new(@amigrind_client, @blueprint, @repo).rackerize
end