Sha256: e878046c2525025de5cc1b611c13088fe79d4dc8832d26b00bf961db96d03bdd

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

require 'vagrant/util/template_renderer'

module VagrantPlugins
  module Parallels
    module Action
      class PackageConfigFiles
        # For TemplateRenderer
        include Vagrant::Util

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

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

        # This method creates the auto-generated Vagrantfile at the root of the
        # box. This Vagrantfile contains the MAC address so that the user doesn't
        # have to worry about it.
        def create_vagrantfile
          File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f|
            f.write(TemplateRenderer.render("package_Vagrantfile", {
              :base_mac => @env[:machine].provider.driver.read_mac_address
            }))
          end
        end

        def create_metadata
          File.open(File.join(@env["export.temp_dir"], "metadata.json"), "w") do |f|
            f.write(template_metadatafile)
          end
        end

      private
        def template_metadatafile
          %Q({"provider": "parallels"}\n)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-parallels-0.2.1 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.2.0 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.1.3 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.1.2 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.1.1 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.1.0 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.0.9 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.0.8 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.0.7 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.0.6 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.0.5 lib/vagrant-parallels/action/package_config_files.rb
vagrant-parallels-0.0.4 lib/vagrant-parallels/action/package_config_files.rb