Sha256: 00ae62e86b907b944938f5b8993bec1cf7ca1a6e10593ec88201fe3199f9eee1

Contents?: true

Size: 1.1 KB

Versions: 20

Compression:

Stored size: 1.1 KB

Contents

require 'pe_build/archive'

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

  def initialize(argv, env)
    super
    @options = {}
  end

  def execute
    argv = parse_options(parser)

    filename = File.basename(argv.last)
    src_dir  = File.dirname(argv.last)

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

    archive.fetch(src_dir)

    @env.ui.info "pe-build: #{archive} has been added and is ready for use!", :prefix => true
  end

  private

  def parser
    OptionParser.new do |o|
      o.banner = <<-BANNER
      Usage: vagrant pe-build copy installer-uri

      Examples:

          # Copy a local file
          vagrant pe-build copy path/to/installer.tar.gz"

          # Download a file via http
          vagrant pe-build copy http://site-downloads.local/path/to/installer.tar.gz"
      BANNER

      o.separator ''

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

      o.on('-h', '--help', 'Display this help') do
        puts o
        exit(0)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
vagrant-pe_build-0.10.4 lib/pe_build/command/copy.rb
vagrant-pe_build-0.10.3 lib/pe_build/command/copy.rb
vagrant-pe_build-0.10.2 lib/pe_build/command/copy.rb
vagrant-pe_build-0.10.1 lib/pe_build/command/copy.rb
vagrant-pe_build-0.10.0 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.7 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.6 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.5 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.4 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.3 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.2 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.1 lib/pe_build/command/copy.rb
vagrant-pe_build-0.9.0 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.8 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.7 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.6 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.5 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.4 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.3 lib/pe_build/command/copy.rb
vagrant-pe_build-0.8.2 lib/pe_build/command/copy.rb