Class: DaptivChefCI::VMwareBaseBoxBuilder
- Inherits:
-
Object
- Object
- DaptivChefCI::VMwareBaseBoxBuilder
- Defined in:
- lib/daptiv-chef-ci/vmware_basebox_builder.rb
Overview
This class builds VMware Fusion 6 Vagrant boxes on OS X
NOTE - This class makes a lot of assumptions that hopefully won’t break until after Vagrant natively supports packaging VMware Fusion boxes.
Instance Method Summary collapse
-
#build(box_file) ⇒ Object
Packages a VMware Fusion Vagrant box.
-
#initialize(base_dir) ⇒ VMwareBaseBoxBuilder
constructor
Creates a new box builder instance.
Constructor Details
#initialize(base_dir) ⇒ VMwareBaseBoxBuilder
Creates a new box builder instance
of the box we want to package, i.e. /Users/admin/src/dotnetframework
17 18 19 20 |
# File 'lib/daptiv-chef-ci/vmware_basebox_builder.rb', line 17 def initialize(base_dir) @base_dir = base_dir @logger = Log4r::Logger.new("daptiv_chef_ci::vmware_base_box_builder") end |
Instance Method Details
#build(box_file) ⇒ Object
Packages a VMware Fusion Vagrant box. This can take 15 minutes or so.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/daptiv-chef-ci/vmware_basebox_builder.rb', line 25 def build(box_file) # /Users/admin/src/mybox/.vagrant/machines/default/vmware_fusion/0f721388-a327-4ba3-b203-c09f69016b43/ box_root_path = "#{@base_dir}/.vagrant/machines/default/vmware_fusion" sub_dir = Dir["#{box_root_path}/*/"] .map { |d| File.basename(d) } .find { |d| d =~ /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ } box_path = "#{box_root_path}/#{sub_dir}" @logger.debug("box_path: #{box_path}") build_box(box_path, box_file) end |