Sha256: a7ff1fb0cc56f5e43392ec5801c9880a423bf4a16f41b29c3df0364ec6d4f56e

Contents?: true

Size: 1 KB

Versions: 13

Compression:

Stored size: 1 KB

Contents

require 'optparse'

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

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

          b = nil
          begin
            b = @env.boxes.find(argv[0], argv[1].to_sym)
          rescue Vagrant::Errors::BoxUpgradeRequired
            @env.boxes.upgrade(argv[0])
            retry
          end

          raise Vagrant::Errors::BoxNotFound, :name => argv[0] if !b
          @env.ui.info(I18n.t("vagrant.commands.box.removing",
                              :name => argv[0],
                              :provider => argv[1]))
          b.destroy!

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

Version data entries

13 entries across 13 versions & 5 rubygems

Version Path
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/commands/box/command/remove.rb
tnargav-1.2.3 plugins/commands/box/command/remove.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/commands/box/command/remove.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/plugins/commands/box/command/remove.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/plugins/commands/box/command/remove.rb
tnargav-1.2.2 plugins/commands/box/command/remove.rb
vagrantup-1.1.3 plugins/commands/box/command/remove.rb
vagrantup-1.1.2 plugins/commands/box/command/remove.rb
vagrantup-1.1.1 plugins/commands/box/command/remove.rb
vagrantup-1.1.0 plugins/commands/box/command/remove.rb
vagrantup-1.1.4 plugins/commands/box/command/remove.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/plugins/commands/box/command/remove.rb
vagrant-lxc-0.0.1 vendor/vagrant/plugins/commands/box/command/remove.rb