Class: Cumuli::CLI::Terminal
- Inherits:
-
Object
- Object
- Cumuli::CLI::Terminal
- Defined in:
- lib/cumuli/cli/terminal.rb
Constant Summary collapse
- VARS =
['GEM_HOME', 'GEM_PATH', 'RUBYOPT', 'RBENV_DIR']
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #bundled? ⇒ Boolean
- #call_bundled ⇒ Object
- #clear_env ⇒ Object
- #execute_command ⇒ Object
-
#initialize(command) ⇒ Terminal
constructor
A new instance of Terminal.
- #spawn ⇒ Object
Constructor Details
#initialize(command) ⇒ Terminal
Returns a new instance of Terminal.
8 9 10 |
# File 'lib/cumuli/cli/terminal.rb', line 8 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
6 7 8 |
# File 'lib/cumuli/cli/terminal.rb', line 6 def command @command end |
Instance Method Details
#bundled? ⇒ Boolean
12 13 14 |
# File 'lib/cumuli/cli/terminal.rb', line 12 def bundled? Object.const_defined?('Bundler') end |
#call_bundled ⇒ Object
20 21 22 23 24 25 |
# File 'lib/cumuli/cli/terminal.rb', line 20 def call_bundled Bundler.with_clean_env do clear_env execute_command end end |
#clear_env ⇒ Object
31 32 33 |
# File 'lib/cumuli/cli/terminal.rb', line 31 def clear_env VARS.each { |e| ENV.delete(e) } end |
#execute_command ⇒ Object
27 28 29 |
# File 'lib/cumuli/cli/terminal.rb', line 27 def execute_command exec(command) end |
#spawn ⇒ Object
16 17 18 |
# File 'lib/cumuli/cli/terminal.rb', line 16 def spawn bundled? ? call_bundled : execute_command end |