class SchemaDev::RubySelector::Rbenv
Constants
- CORE_COMMAND
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/schema_dev/ruby_selector.rb, line 58 def initialize super # because we're running within a ruby program that was launched by # rbenv, we already have various environment variables set up. need # strip those out so that the forked shell can run a diifferent ruby # version than the one we're in now. ENV['PATH'] = ENV['PATH'].split(':').reject { |dir| dir =~ %r{/\.?rbenv/(?!shims)} }.join(':') ENV['GEM_PATH'] = ENV['GEM_PATH'].split(':').reject { |dir| dir =~ %r{/\.?rbenv} }.join(':') unless ENV['GEM_PATH'].nil? ENV['RBENV_DIR'] = nil ENV['RBENV_HOOK_PATH'] = nil @versions ||= `rbenv versions --bare`.split end
Public Instance Methods
command(ruby)
click to toggle source
# File lib/schema_dev/ruby_selector.rb, line 72 def command(ruby) version = @versions.select { |v| v.start_with? ruby }.last || abort("no ruby version '#{ruby}' installed in rbenv") "RBENV_VERSION=#{version}" end