Class: Vagrant::Ruby::Command
- Inherits:
-
Object
- Object
- Vagrant::Ruby::Command
- Defined in:
- lib/vagrant-ruby.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(name) ⇒ Command
constructor
A new instance of Command.
- #new(flags, *_) ⇒ Object
- #synopsis ⇒ Object
- #with_clean_env ⇒ Object
Constructor Details
#initialize(name) ⇒ Command
30 31 32 |
# File 'lib/vagrant-ruby.rb', line 30 def initialize(name) @name = name end |
Instance Attribute Details
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
28 29 30 |
# File 'lib/vagrant-ruby.rb', line 28 def flags @flags end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/vagrant-ruby.rb', line 27 def name @name end |
Instance Method Details
#execute ⇒ Object
53 54 55 56 57 58 |
# File 'lib/vagrant-ruby.rb', line 53 def execute with_clean_env do command = File.join(Gem.default_bindir, name) Process.exec([command, name], *flags) end end |
#new(flags, *_) ⇒ Object
34 35 36 37 |
# File 'lib/vagrant-ruby.rb', line 34 def new(flags, *_) @flags = flags self end |
#synopsis ⇒ Object
39 40 41 |
# File 'lib/vagrant-ruby.rb', line 39 def synopsis "execute Vagrant's embedded #{name}" end |
#with_clean_env ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/vagrant-ruby.rb', line 43 def with_clean_env if not defined? ::Bundler yield else ::Bundler.with_clean_env do yield end end end |