Sha256: 5390a5ab30637228b6a3de1edb21af78ed5f43af8c556ad764620b7aa6f56422

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require 'optparse'

module Veewee
  module Command
    module Vagrant
      class Undefine < ::Vagrant::Command::Base
        def execute
          options = {}

          opts = OptionParser.new do |opts|
            opts.banner = "Remove the definition of a basebox"
            opts.separator ""
            opts.separator "Usage: vagrant basebox undefine <boxname>"

            opts.on("-d", "--debug", "enable debugging") do |d|
              options['debug'] = d
            end

          end

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

          begin
            venv=Veewee::Environment.new(options)
            venv.ui=@env.ui
            definition_name=argv[0]
            venv.definitions.undefine(definition_name,options)
            venv.ui.info("Definition '#{definition_name}' succesfully removed",:prefix => false)
          rescue Veewee::Error => ex
            venv.ui.error(ex,:prefix => false)
            exit -1
          end

        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
veewee-0.3.6 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.5 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.4 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.3 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.2 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.1 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.0.beta2 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.0.beta1 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.0.alpha9 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.0.alpha8 lib/veewee/command/vagrant/undefine.rb
veewee-0.3.0.alpha7 lib/veewee/command/vagrant/undefine.rb