lib/bundler/cli.rb in bundler-0.9.2 vs lib/bundler/cli.rb in bundler-0.9.3
- old
+ new
@@ -91,14 +91,25 @@
end
desc "exec", "Run the command in context of the bundle"
def exec(*)
ARGV.delete('exec')
- ENV["RUBYOPT"] = %W(
- -I#{File.expand_path('../..', __FILE__)}
- -rbundler/setup
- #{ENV["RUBYOPT"]}
- ).compact.join(' ')
+
+ # Set PATH
+ paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
+ paths.unshift "#{Bundler.bundle_path}/bin"
+ ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
+
+ # Set BUNDLE_GEMFILE
+ ENV['BUNDLE_GEMFILE'] = Bundler.default_gemfile
+
+ # Set RUBYOPT
+ rubyopt = [ENV["RUBYOPT"]].compact
+ rubyopt.unshift "-rbundler/setup"
+ rubyopt.unshift "-I#{File.expand_path('../..', __FILE__)}"
+ ENV["RUBYOPT"] = rubyopt.join(' ')
+
+ # Run
Kernel.exec *ARGV
end
end
end