Class: MultiRubyRunner::VersionManager::Rbenv

Inherits:
MultiRubyRunner::VersionManager show all
Defined in:
lib/multi_ruby_runner/version_manager/rbenv.rb

Overview

Represents the [rbenv](github.com/rbenv/rbenv) ruby version manager.

Instance Method Summary collapse

Methods inherited from MultiRubyRunner::VersionManager

detect, #initialize

Constructor Details

This class inherits a constructor from MultiRubyRunner::VersionManager

Instance Method Details

#compute_process_args(command_string, directory, options) ⇒ Hash

See MultiRubyRunner#execute_command_in_directory

Returns:

  • (Hash)

    entire_command: includes shell invocation,
                    ruby version manager activation and command
    blocking: Boolean
    environment_overrides: {
    

    }



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/multi_ruby_runner/version_manager/rbenv.rb', line 15

def compute_process_args(command_string, directory, options)
  shell_command_string = [
    "cd #{ directory }", # cd into the directory containing .ruby-version file
    %(eval "$(rbenv init -)"), # let rbenv update the environment (particularly PATH)
    command_string, # execute command
  ].join('; ')
  # For rbenv we just have to reset RBENV_VERSION and override RBENV_DIR
  # to get the ruby environment specified in `.ruby-version` in directory.
  {
    entire_command: [
      options[:shell_invocation],
      shell_command_string,
    ].join(' '),
    blocking: options[:blocking],
    environment_overrides: {
      'RBENV_VERSION' => nil,
      'RBENV_DIR' => directory,
    },
  }
end