Class: VagrantPlugins::DevCommands::Runner::InternalCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/devcommands/runner/internal_command.rb

Overview

Internal command runner

Constant Summary collapse

NAMESPACE_CMD =
VagrantPlugins::DevCommands::InternalCommand
NAMESPACE_MODEL =
VagrantPlugins::DevCommands::Model
NAMESPACE_SPEC =
VagrantPlugins::DevCommands::InternalSpec
UTIL =
VagrantPlugins::DevCommands::Util
COMMANDS =
{
  'completion-data' => NAMESPACE_MODEL::Command.new(
    NAMESPACE_SPEC::COMPLETION_DATA
  ),
  'help' => NAMESPACE_MODEL::Command.new(
    NAMESPACE_SPEC::HELP
  ),
  'version' => NAMESPACE_MODEL::Command.new(
    NAMESPACE_SPEC::VERSION
  )
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(plugin, argv, env, registry) ⇒ InternalCommand

Returns a new instance of InternalCommand.



25
26
27
28
29
30
31
32
# File 'lib/vagrant/devcommands/runner/internal_command.rb', line 25

def initialize(plugin, argv, env, registry)
  @plugin   = plugin
  @argv     = argv
  @env      = env
  @registry = registry

  @internal = internal_commands
end

Instance Method Details

#run(command, args = nil) ⇒ Object



34
35
36
37
38
# File 'lib/vagrant/devcommands/runner/internal_command.rb', line 34

def run(command, args = nil)
  return nil unless @internal.key?(command)

  @internal[command].execute(args || run_argv)
end