Method: Pik::Run#switch_path_to
- Defined in:
- lib/pik/commands/run_command.rb
#switch_path_to(other) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/pik/commands/run_command.rb', line 49 def switch_path_to(other) current = Which::Ruby.find new_path = SearchPath.new(ENV['PATH']) new_path.replace_or_add(current, other[:path]) # if there is currently a GEM_HOME, remove it's bin dir from the path new_path.remove(Pathname.new(ENV['GEM_HOME']) + 'bin') if ENV['GEM_HOME'] # if the new version has a GEM_HOME, add it's bin dir to the path new_path.add(Pathname.new(other[:gem_home]) + 'bin') if other[:gem_home] ENV['PATH'] = new_path.join end |