Class: VagrantPlugins::Utm::Action::PackageVagrantfile
- Inherits:
-
Object
- Object
- VagrantPlugins::Utm::Action::PackageVagrantfile
- Includes:
- Vagrant::Util
- Defined in:
- lib/vagrant_utm/action/package_vagrantfile.rb
Overview
This middleware class sets up the Vagrantfile that will be placed into the root of the exported box.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#create_vagrantfile ⇒ Object
This method creates the auto-generated Vagrantfile at the root of the box.
-
#initialize(app, _env) ⇒ PackageVagrantfile
constructor
A new instance of PackageVagrantfile.
Constructor Details
#initialize(app, _env) ⇒ PackageVagrantfile
Returns a new instance of PackageVagrantfile.
17 18 19 |
# File 'lib/vagrant_utm/action/package_vagrantfile.rb', line 17 def initialize(app, _env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
21 22 23 24 25 |
# File 'lib/vagrant_utm/action/package_vagrantfile.rb', line 21 def call(env) @env = env create_vagrantfile @app.call(env) end |
#create_vagrantfile ⇒ Object
This method creates the auto-generated Vagrantfile at the root of the box. This Vagrantfile can contain anything that might be essential for user. Ex: Mac Address (for VirtualBox), etc. Currently nothing is added to the Vagrantfile.
31 32 33 34 35 |
# File 'lib/vagrant_utm/action/package_vagrantfile.rb', line 31 def create_vagrantfile File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f| f.write(TemplateRenderer.render("package_Vagrantfile")) end end |