Sha256: 9ce635591001671cd805fc79c1e9229e524ae282a99dc7370e90199ff3c0c2ec

Contents?: true

Size: 874 Bytes

Versions: 5

Compression:

Stored size: 874 Bytes

Contents

require 'pe_build'
require 'vagrant'

class PEBuild::Command < Vagrant::Command::Base
  def initialize(argv, env)
    @argv, @env = argv, env

    @main_args, @subcommand, @sub_args = split_main_and_subcommand(argv)

    # Is this even remotely sane? Are we verging on cargo cult programming?
    @subcommands = Vagrant::Registry.new

    @subcommands.register('download') { PEBuild::Command::Download }
    @subcommands.register('list')     { PEBuild::Command::List }
  end

  def execute
    if @subcommand and (klass = @subcommands.get(@subcommand))
      klass.new(@argv, @env).execute
    elsif @subcommand
      raise "Unrecognized subcommand #{@subcommand}"
    else
      PEBuild::Command::List.new(@argv, @env).execute
    end
  end
end

require 'pe_build/command/list'
require 'pe_build/command/download'

Vagrant.commands.register(:pe_build) { PEBuild::Command }

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vagrant-pe_build-0.0.3 lib/pe_build/command.rb
vagrant-pe_build-0.0.2 lib/pe_build/command.rb
vagrant-pe_build-0.0.1 lib/pe_build/command.rb
oscar-0.2.0alpha2 lib/pe_build/command.rb
oscar-0.2.0alpha1 lib/pe_build/command.rb