Class: MultiRubyRunner::VersionManager

Inherits:
Object
  • Object
show all
Defined in:
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

Abstract class for ruby version managers like rbenv and rvm (or none)

Direct Known Subclasses

None, Rbenv, Rvm

Defined Under Namespace

Classes: None, Rbenv, Rvm

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_executable_path) ⇒ VersionManager

Instantiates a new VersionManager.



21
22
23
# File 'lib/multi_ruby_runner/version_manager.rb', line 21

def initialize(ruby_executable_path)
  @ruby_executable_path = ruby_executable_path
end

Class Method Details

.detectObject

Detects if and which ruby version manager is present.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/multi_ruby_runner/version_manager.rb', line 7

def self.detect
  which_ruby = `which ruby`
  case which_ruby
  when /\/\.rbenv\//
    Rbenv.new(which_ruby)
  when /\/\.rvm\//
    Rvm.new(which_ruby)
  else
    None.new(which_ruby)
  end
end

Instance Method Details

#compute_process_args(command_string, directory, options) ⇒ Object



25
26
27
# File 'lib/multi_ruby_runner/version_manager.rb', line 25

def compute_process_args(command_string, directory, options)
  raise "Implement #compute_process_args in subclasses!"
end