Sha256: 16088da864d1c24c319c5c7ab4aebd7b6dc51ec21484e2100b8dd1e9396aaff5

Contents?: true

Size: 1.26 KB

Versions: 63

Compression:

Stored size: 1.26 KB

Contents

require "fileutils"
require 'optparse'
require "pathname"

module VagrantPlugins
  module CommandBox
    module Command
      class Repackage < Vagrant.plugin("2", :command)
        def execute
          opts = OptionParser.new do |o|
            o.banner = "Usage: vagrant box repackage <name> <provider> <version>"
          end

          # Parse the options
          argv = parse_options(opts)
          return if !argv
          raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length != 3

          box_name     = argv[0]
          box_provider = argv[1].to_sym
          box_version  = argv[2]

          # Verify the box exists that we want to repackage
          box = @env.boxes.find(box_name, box_provider, "= #{box_version}")
          if !box
            raise Vagrant::Errors::BoxNotFoundWithProviderAndVersion,
              name: box_name,
              provider: box_provider.to_s,
              version: box_version
          end

          # Repackage the box
          output_name = @env.vagrantfile.config.package.name || "package.box"
          output_path = Pathname.new(File.expand_path(output_name, FileUtils.pwd))
          box.repackage(output_path)

          # Success, exit status 0
          0
        end
      end
    end
  end
end

Version data entries

63 entries across 56 versions & 8 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/commands/box/command/repackage.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.3.3.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.3.2.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.19.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.18.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.16.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.14.0 plugins/commands/box/command/repackage.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.10.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.9.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.8.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.7.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.6.2 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.6.1 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.6.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.5.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.4.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.3.0 plugins/commands/box/command/repackage.rb
vagrant-unbundled-2.2.2.0 plugins/commands/box/command/repackage.rb