Sha256: c2c20baa1e2f69e34cf9ee3585829f0cc8b3a63edb075dddf833c036169c201c

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require 'optparse'

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

          opts = OptionParser.new do |opts|
            opts.banner = "Exports basebox to the vagrant box format"
            opts.separator ""
            opts.separator "Usage: vagrant basebox export <boxname>"

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

            opts.on("-f", "--force", "force overwrite") do |f|
              options['force'] = f
            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
            box_name=argv[0]
            venv.providers["virtualbox"].get_box(box_name).export_vagrant(options)
          rescue Veewee::Error => ex
            venv.ui.error(ex,:prefix => false)
            exit -1
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veewee-0.3.0.alpha8 lib/veewee/command/vagrant/export.rb
veewee-0.3.0.alpha7 lib/veewee/command/vagrant/export.rb