Class: MultiRubyRunner
- Inherits:
-
Object
- Object
- MultiRubyRunner
- Defined in:
- lib/multi_ruby_runner.rb,
lib/multi_ruby_runner/version.rb,
lib/multi_ruby_runner/version_manager.rb,
lib/multi_ruby_runner/version_manager/rvm.rb,
lib/multi_ruby_runner/version_manager/none.rb,
lib/multi_ruby_runner/version_manager/rbenv.rb
Overview
Allows calling of Ruby code in various Ruby environments.
Defined Under Namespace
Classes: VersionManager
Constant Summary collapse
- VERSION =
"1.0.2"
Instance Method Summary collapse
-
#execute_command_in_directory(command_string, directory, options = {}) ⇒ String, ...
Executes a command in a directory.
-
#initialize ⇒ MultiRubyRunner
constructor
A new instance of MultiRubyRunner.
-
#ruby_version_manager ⇒ MultiRubyRunner::VersionManager
Returns the ruby version manager used.
Constructor Details
#initialize ⇒ MultiRubyRunner
Returns a new instance of MultiRubyRunner.
12 13 |
# File 'lib/multi_ruby_runner.rb', line 12 def initialize end |
Instance Method Details
#execute_command_in_directory(command_string, directory, options = {}) ⇒ String, ...
Executes a command in a directory. Command will be executed in the ruby environment specified in ‘.ruby-version` file in `directory`. Returns stdout in the blocking form and pid of child process in the non-blocking form.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/multi_ruby_runner.rb', line 26 def execute_command_in_directory(command_string, directory, = {}) shell_path = ENV['SHELL'] || '/bin/bash' = { blocking: true, shell_invocation: "#{ shell_path } -c", }.merge() process_args = ruby_version_manager.compute_process_args( command_string, directory, ) execute_command(process_args) end |
#ruby_version_manager ⇒ MultiRubyRunner::VersionManager
Returns the ruby version manager used
42 43 44 |
# File 'lib/multi_ruby_runner.rb', line 42 def ruby_version_manager VersionManager.detect end |