class Boxes::Command::Build
Command
handling for the box building functionality.
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/boxes/command/build.rb, line 18 def initialize(argv) @build = {} @build[:name] = argv.option('name') @build[:provider] = argv.option('provider') @build[:template] = argv.option('template') scripts = argv.option('scripts') || '' @build[:scripts] = scripts.split(',') super end
options()
click to toggle source
Calls superclass method
# File lib/boxes/command/build.rb, line 8 def self.options [ ['--name', 'The name for the build'], ['--provider=[virtualbox|vmware]', 'The provider to build the box for'], ['--template', 'Template to build the box with'], ['--scripts', 'Scripts to apply to the box'] ].concat(super) end
Public Instance Methods
run()
click to toggle source
# File lib/boxes/command/build.rb, line 37 def run env = Boxes::Environment.new builder = Boxes::Builder.new(env, @build) builder.run builder.clean rescue Boxes::Errors::BuildRunError => e puts "[!] #{e}".red exit 1 end
validate!()
click to toggle source
Calls superclass method
# File lib/boxes/command/build.rb, line 29 def validate! super %w(name provider template).each do |key| help! "A #{key} is required!" if @build[key.to_sym].nil? end end