Class: VagrantPlugins::DevCommands::Registry
- Inherits:
-
Object
- Object
- VagrantPlugins::DevCommands::Registry
- Defined in:
- lib/vagrant/devcommands/registry.rb
Overview
Vagrant command registry
Constant Summary collapse
- RESERVED_COMMANDS =
%w(help version).freeze
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
Instance Method Summary collapse
-
#initialize(env) ⇒ Registry
constructor
A new instance of Registry.
- #read_commandfile(commandfile) ⇒ Object
- #reserved_command?(command) ⇒ Boolean
- #valid_command?(command) ⇒ Boolean
Constructor Details
#initialize(env) ⇒ Registry
9 10 11 12 |
# File 'lib/vagrant/devcommands/registry.rb', line 9 def initialize(env) @commands = {} @env = env end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
7 8 9 |
# File 'lib/vagrant/devcommands/registry.rb', line 7 def commands @commands end |
Instance Method Details
#read_commandfile(commandfile) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant/devcommands/registry.rb', line 14 def read_commandfile(commandfile) global = commandfile.path_global local = commandfile.path contents = '' contents += "\n" + global.read unless nil == global contents += "\n" + local.read unless nil == local instance_eval(contents) end |
#reserved_command?(command) ⇒ Boolean
25 26 27 |
# File 'lib/vagrant/devcommands/registry.rb', line 25 def reserved_command?(command) RESERVED_COMMANDS.include?(command) end |
#valid_command?(command) ⇒ Boolean
29 30 31 |
# File 'lib/vagrant/devcommands/registry.rb', line 29 def valid_command?(command) @commands.include?(command) || reserved_command?(command) end |