Skip to content

Commit

Permalink
Migrating to Bundler.with_clean_env in runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Bugno committed Jan 20, 2011
1 parent 4f3bba2 commit afde7c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
16 changes: 0 additions & 16 deletions config/boot.rb
@@ -1,9 +1,5 @@
require 'rubygems'

ORIGINAL_ENV = {}
ENV.each do |key, value|
ORIGINAL_ENV[key] = value
end
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
Expand All @@ -15,15 +11,3 @@
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)

# puts "ORIGINAL_ENV"
# ORIGINAL_ENV.each do |k, v|
# puts "%s => %s" % [k, v]
# end
# puts "ENV"
# ENV.each do |k, v|
# puts "%s => %s" % [k, v]
# end

# ORIGINAL_ENV["PATH"] = ENV["PATH"]
# ORIGINAL_ENV["RUBYOPT"] = ENV["RUBYOPT"]
14 changes: 3 additions & 11 deletions extras/big_tuna/runner.rb
Expand Up @@ -18,17 +18,9 @@ def self.execute(dir, command)
end
end

def self.with_clean_env(dir, &blk)
old_env = ENV.clone
ENV.clear
ORIGINAL_ENV.each { |key, value| ENV[key] = value }
ENV["RAILS_ENV"] = "test"
result = blk.call
result
ensure
ENV.clear
old_env.each do |key, value|
ENV[key] = value
def self.with_clean_env(dir)
Bundler.with_clean_env do
yield
end
end

Expand Down

0 comments on commit afde7c7

Please sign in to comment.