Class: VagrantPlugins::PackageVMware::Action::PackageVagrantfile

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-package-vmware/action/package_vagrantfile.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ PackageVagrantfile

Returns a new instance of PackageVagrantfile.



6
7
8
# File 'lib/vagrant-package-vmware/action/package_vagrantfile.rb', line 6

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
# File 'lib/vagrant-package-vmware/action/package_vagrantfile.rb', line 10

def call(env)
  @env = env
  create_vagrantfile
  @app.call(env)
end

#create_vagrantfileObject



16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-package-vmware/action/package_vagrantfile.rb', line 16

def create_vagrantfile
  File.open(File.join(@env['package.directory'], "Vagrantfile"), "w") do |f|
    f.write(<<EOF
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)
EOF
    )
  end
end