Module: Procodile::Rbenv
- Defined in:
- lib/procodile/rbenv.rb
Class Method Summary collapse
-
.without(&block) ⇒ Object
If procodile is executed through rbenv it will pollute our environment which means that any spawned processes will be invoked with procodile’s ruby rather than the ruby that the application wishes to use.
Class Method Details
.without(&block) ⇒ Object
If procodile is executed through rbenv it will pollute our environment which means that any spawned processes will be invoked with procodile’s ruby rather than the ruby that the application wishes to use
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/procodile/rbenv.rb', line 9 def self.without(&block) previous_environment = ENV.select { |k,v| k =~ /\A(RBENV\_)/ } if previous_environment.size > 0 previous_environment.each { |key, value| ENV[key] = nil } previous_environment['PATH'] = ENV['PATH'] ENV['PATH'] = ENV['PATH'].split(':').select { |p| !(p =~ /\.rbenv\/versions/) }.join(':') end yield ensure previous_environment.each do |key, value| ENV[key] = value end end |