Class: BuildRunner
- Inherits:
-
Object
- Object
- BuildRunner
- Includes:
- Common, PackerExec
- Defined in:
- lib/bento/build.rb
Instance Attribute Summary collapse
-
#build_timestamp ⇒ Object
readonly
Returns the value of attribute build_timestamp.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#cpus ⇒ Object
readonly
Returns the value of attribute cpus.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#except ⇒ Object
readonly
Returns the value of attribute except.
-
#headed ⇒ Object
readonly
Returns the value of attribute headed.
-
#mem ⇒ Object
readonly
Returns the value of attribute mem.
-
#mirror ⇒ Object
readonly
Returns the value of attribute mirror.
-
#only ⇒ Object
readonly
Returns the value of attribute only.
-
#override_version ⇒ Object
readonly
Returns the value of attribute override_version.
-
#single ⇒ Object
readonly
Returns the value of attribute single.
-
#template_files ⇒ Object
readonly
Returns the value of attribute template_files.
Instance Method Summary collapse
-
#initialize(opts) ⇒ BuildRunner
constructor
A new instance of BuildRunner.
- #start ⇒ Object
Methods included from PackerExec
#for_packer_run_with, #write_box_metadata, #write_var_file
Methods included from Common
#banner, #box_metadata, #build_list, #builds_yml, #duration, #info, #macos?, #metadata_files, #private_box?, #unix?, #vc_account, #warn, #windows?
Constructor Details
#initialize(opts) ⇒ BuildRunner
Returns a new instance of BuildRunner.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bento/build.rb', line 13 def initialize(opts) @template_files = opts.template_files @config = opts.config ||= false @dry_run = opts.dry_run @debug = opts.debug @only = opts.only ||= "parallels-iso,virtualbox-iso,vmware-iso" @except = opts.except @mirror = opts.mirror @headed = opts.headed ||= false @single = opts.single ||= false @override_version = opts.override_version = Time.now.gmtime.strftime("%Y%m%d%H%M%S") @cpus = opts.cpus @mem = opts.mem end |
Instance Attribute Details
#build_timestamp ⇒ Object (readonly)
Returns the value of attribute build_timestamp.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def config @config end |
#cpus ⇒ Object (readonly)
Returns the value of attribute cpus.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def cpus @cpus end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def debug @debug end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def dry_run @dry_run end |
#except ⇒ Object (readonly)
Returns the value of attribute except.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def except @except end |
#headed ⇒ Object (readonly)
Returns the value of attribute headed.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def headed @headed end |
#mem ⇒ Object (readonly)
Returns the value of attribute mem.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def mem @mem end |
#mirror ⇒ Object (readonly)
Returns the value of attribute mirror.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def mirror @mirror end |
#only ⇒ Object (readonly)
Returns the value of attribute only.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def only @only end |
#override_version ⇒ Object (readonly)
Returns the value of attribute override_version.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def override_version @override_version end |
#single ⇒ Object (readonly)
Returns the value of attribute single.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def single @single end |
#template_files ⇒ Object (readonly)
Returns the value of attribute template_files.
10 11 12 |
# File 'lib/bento/build.rb', line 10 def template_files @template_files end |
Instance Method Details
#start ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/bento/build.rb', line 29 def start templates = config ? build_list : template_files ("Starting build for templates:") templates.each { |t| puts "- #{t}" } time = Benchmark.measure do templates.each { |template| build(template) } end ("Build finished in #{duration(time.real)}.") end |