Sha256: 87d1600a404fc0846ca03f1c53fd069f7d3d3a236fec2c81f78583166e8a0c1c

Contents?: true

Size: 1.11 KB

Versions: 43

Compression:

Stored size: 1.11 KB

Contents

module Vagrant
  module Command
    class PackageCommand < NamedBase
      class_option :base, :type => :string, :default => nil
      class_option :output, :type => :string, :default => nil
      class_option :include, :type => :array, :default => nil
      class_option :vagrantfile, :type => :string, :default => nil
      register "package", "Package a Vagrant environment for distribution"

      def execute
        return package_base if options[:base]
        package_target
      end

      protected

      def package_base
        vm = VM.find(options[:base], env)
        raise Errors::BaseVMNotFound, :name => options[:base] if !vm.created?
        package_vm(vm)
      end

      def package_target
        raise Errors::MultiVMTargetRequired, :command => "package" if target_vms.length > 1
        vm = target_vms.first
        raise Errors::VMNotCreatedError if !vm.created?
        package_vm(vm)
      end

      def package_vm(vm)
        opts = options.inject({}) do |acc, data|
          k,v = data
          acc["package.#{k}"] = v
          acc
        end

        vm.package(opts)
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 5 rubygems

Version Path
vagrantup-0.8.9 lib/vagrant/command/package.rb
vagrantup-0.8.8 lib/vagrant/command/package.rb
vagrantup-0.8.7 lib/vagrant/command/package.rb
vagrantup-0.8.6 lib/vagrant/command/package.rb
vagrantup-0.8.5 lib/vagrant/command/package.rb
vagrantup-0.8.4 lib/vagrant/command/package.rb
vagrantup-0.8.3 lib/vagrant/command/package.rb
vagrantup-0.8.2 lib/vagrant/command/package.rb
vagrantup-0.8.10 lib/vagrant/command/package.rb
vagrantup-0.8.1 lib/vagrant/command/package.rb
vagrantup-0.8.0 lib/vagrant/command/package.rb
vagrantup-0.7.8 lib/vagrant/command/package.rb
vagrantup-0.7.7 lib/vagrant/command/package.rb
vagrantup-0.7.6 lib/vagrant/command/package.rb
vagrantup-0.7.5 lib/vagrant/command/package.rb
vagrantup-0.7.4 lib/vagrant/command/package.rb
vagrantup-0.7.3 lib/vagrant/command/package.rb
vagrantup-0.7.2 lib/vagrant/command/package.rb
vagrantup-0.7.1 lib/vagrant/command/package.rb
vagrantup-0.7.0 lib/vagrant/command/package.rb