Sha256: eadc3729bdc344a0d85fa0ef3daf63626dd0afd1c48d8808bfacc4ed6b9cb7a8

Contents?: true

Size: 893 Bytes

Versions: 2

Compression:

Stored size: 893 Bytes

Contents

require 'vagrant'
require 'optparse'
require 'pe_build/archive'

module PEBuild
class Command
class Download < Vagrant.plugin(2, :command)

  def execute

    options = {}

    parser = OptionParser.new do |o|
      o.banner = "Usage: vagrant pe-build download --version <version> --dir <dir>"
      o.separator ''

      o.on('-v', '--version=val', String, "The version of PE to fetch") do |val|
        options[:version] = val
      end

      o.on('-d', '--dir=val', String, 'The URL basedir containing the file') do |val|
        options[:dir] = val
      end
    end

    argv = parse_options(parser)
    filename = argv.last

    unless options[:version]
      raise Vagrant::Errors::CLIInvalidUsage, :help => parser.help.chomp
    end

    archive = PEBuild::Archive.new(filename, @env)
    archive.version = options[:version]
    archive.download_from(options[:dir])
  end
end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-pe_build-0.2.0 lib/pe_build/command/download.rb
vagrant-pe_build-0.1.0 lib/pe_build/command/download.rb