Sha256: 07f13f305c293b51ccc25a575fbe336e2a3304d1a6b10f56a990498b2c377e18

Contents?: true

Size: 1.92 KB

Versions: 17

Compression:

Stored size: 1.92 KB

Contents

require 'optparse'

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

          opts = OptionParser.new do |opts|
            opts.banner = "Build the box <boxname>"
            opts.separator ""
            opts.separator "Usage: vagrant basebox build <boxname>"

            opts.on("-f", "--force", "overwrite the basebox") do |f|
              options['force'] = f
            end

            opts.on("-n", "--nogui", "no gui") do |n|
              options['nogui'] = n
            end

            opts.on("-a", "--auto", "auto answers") do |a|
              options['auto'] = a
            end

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

            opts.on("-r", "--redirect-console", "redirects serial console") do |r|
              options['redirectconsole'] = r
            end

            opts.on("-i", "--include",Array,"ruby regexp of postinstall filenames to additionally include") do |i|
              options['postinstall_include'] = i
            end

            opts.on("-e", "--exclude",Array,"ruby regexp of postinstall filenames to exclude") do |e|
              options['postinstall_list'] = e
            end

            opts.on("--[no-]checksum","force to check iso file check sum") do |v|
              options['checksum'] = v
            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
            venv.providers["virtualbox"].get_box(argv[0]).build(options)
          rescue Veewee::Error => ex
            venv.ui.error(ex, :prefix => false)
            exit -1
          end

        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
veewee-0.5.0.alpha4 lib/veewee/command/vagrant/build.rb
veewee-0.5.0.alpha3 lib/veewee/command/vagrant/build.rb
veewee-0.5.0.alpha2 lib/veewee/command/vagrant/build.rb
veewee-0.5.0.alpha1 lib/veewee/command/vagrant/build.rb
veewee-0.4.5.1 lib/veewee/command/vagrant/build.rb
veewee-0.4.5 lib/veewee/command/vagrant/build.rb
veewee-0.4.5.pre1 lib/veewee/command/vagrant/build.rb
veewee-0.4.4 lib/veewee/command/vagrant/build.rb
veewee-0.4.3 lib/veewee/command/vagrant/build.rb
veewee-0.4.2 lib/veewee/command/vagrant/build.rb
veewee-0.4.1 lib/veewee/command/vagrant/build.rb
veewee-0.4.0 lib/veewee/command/vagrant/build.rb
veewee-0.3.12 lib/veewee/command/vagrant/build.rb
veewee-0.3.11 lib/veewee/command/vagrant/build.rb
veewee-0.3.10 lib/veewee/command/vagrant/build.rb
veewee-0.3.9 lib/veewee/command/vagrant/build.rb
veewee-atlassian-0.3.11 lib/veewee/command/vagrant/build.rb