Sha256: b3ebf52a90dc7d572767fb526524e5f192b0bbc82791ee5d92a1710a215ff286

Contents?: true

Size: 1.38 KB

Versions: 19

Compression:

Stored size: 1.38 KB

Contents

module VagrantPlugins
  module ProviderVirtualBox
    module Action
      class SetupPackageFiles
        def initialize(app, env)
          @app = app

          env["package.include"] ||= []
          env["package.vagrantfile"] ||= nil
        end

        def call(env)
          files = {}
          env["package.include"].each do |file|
            source = Pathname.new(file)
            dest   = nil

            # If the source is relative then we add the file as-is to the include
            # directory. Otherwise, we copy only the file into the root of the
            # include directory. Kind of strange, but seems to match what people
            # expect based on history.
            if source.relative?
              dest = source
            else
              dest = source.basename
            end

            # Assign the mapping
            files[file] = dest
          end

          if env["package.vagrantfile"]
            # Vagrantfiles are treated special and mapped to a specific file
            files[env["package.vagrantfile"]] = "_Vagrantfile"
          end

          # Verify the mapping
          files.each do |from, _|
            raise Vagrant::Errors::PackageIncludeMissing,
              :file => from if !File.exist?(from)
          end

          # Save the mapping
          env["package.files"] = files

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/action/setup_package_files.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/action/setup_package_files.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/action/setup_package_files.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/action/setup_package_files.rb
tnargav-1.3.6 plugins/providers/virtualbox/action/setup_package_files.rb
tnargav-1.3.3 plugins/providers/virtualbox/action/setup_package_files.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/providers/virtualbox/action/setup_package_files.rb
tnargav-1.2.3 plugins/providers/virtualbox/action/setup_package_files.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/providers/virtualbox/action/setup_package_files.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/plugins/providers/virtualbox/action/setup_package_files.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/plugins/providers/virtualbox/action/setup_package_files.rb
tnargav-1.2.2 plugins/providers/virtualbox/action/setup_package_files.rb
vagrantup-1.1.3 plugins/providers/virtualbox/action/setup_package_files.rb
vagrantup-1.1.2 plugins/providers/virtualbox/action/setup_package_files.rb
vagrantup-1.1.1 plugins/providers/virtualbox/action/setup_package_files.rb
vagrantup-1.1.0 plugins/providers/virtualbox/action/setup_package_files.rb
vagrantup-1.1.4 plugins/providers/virtualbox/action/setup_package_files.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/plugins/providers/virtualbox/action/setup_package_files.rb
vagrant-lxc-0.0.1 vendor/vagrant/plugins/providers/virtualbox/action/setup_package_files.rb