Class: NormalizeRunner
- Inherits:
-
Object
- Object
- NormalizeRunner
- Includes:
- Common, PackerExec
- Defined in:
- lib/bento/normalize.rb
Instance Attribute Summary collapse
-
#build_timestamp ⇒ Object
readonly
Returns the value of attribute build_timestamp.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#override_version ⇒ Object
readonly
Returns the value of attribute override_version.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
-
#initialize(opts) ⇒ NormalizeRunner
constructor
A new instance of NormalizeRunner.
- #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) ⇒ NormalizeRunner
Returns a new instance of NormalizeRunner.
9 10 11 12 13 14 |
# File 'lib/bento/normalize.rb', line 9 def initialize(opts) @templates = opts.template_files @debug = opts.debug @modified = [] @build_timestamp = Time.now.gmtime.strftime("%Y%m%d%H%M%S") end |
Instance Attribute Details
#build_timestamp ⇒ Object (readonly)
Returns the value of attribute build_timestamp.
7 8 9 |
# File 'lib/bento/normalize.rb', line 7 def @build_timestamp end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
7 8 9 |
# File 'lib/bento/normalize.rb', line 7 def debug @debug end |
#override_version ⇒ Object (readonly)
Returns the value of attribute override_version.
7 8 9 |
# File 'lib/bento/normalize.rb', line 7 def override_version @override_version end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
7 8 9 |
# File 'lib/bento/normalize.rb', line 7 def templates @templates end |
Instance Method Details
#start ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bento/normalize.rb', line 16 def start ("Normalizing for templates:") templates.each { |t| puts "- #{t}" } time = Benchmark.measure do templates.each do |file| dir = file.split("/")[0] template = file.split("/")[1] Dir.chdir dir validate(template) Dir.chdir("..") end end unless @modified.empty? info("") info("The following templates were modified:") @modified.sort.each { |template| info(" * #{template}") } end ("Normalizing finished in #{duration(time.real)}.") end |