Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix: Don't add bin directories to the load path unless they exist.

  • Loading branch information...
commit bf7478cffb8392d2f32fd5ecd05ef81d5e0648d0 1 parent c3dfd54
Eric Chapweske authored Yehuda Katz committed
Showing with 13 additions and 1 deletion.
  1. +3 −1 lib/bundler/environment.rb
  2. +10 −0 spec/bundler/cli_spec.rb
View
4 lib/bundler/environment.rb
@@ -66,7 +66,9 @@ def load_paths_for_specs(specs, options)
next if spec.no_bundle?
full_gem_path = Pathname.new(spec.full_gem_path)
- load_paths << load_path_for(full_gem_path, spec.bindir) if spec.bindir
+ if spec.bindir && full_gem_path.join(spec.bindir).exist?
+ load_paths << load_path_for(full_gem_path, spec.bindir)
+ end
spec.require_paths.each do |path|
load_paths << load_path_for(full_gem_path, path)
end
View
10 spec/bundler/cli_spec.rb
@@ -87,6 +87,16 @@
out.should == "0.8.7 - 2.3.2 - 1.0.0"
end
+ it "adds existing bin directories to the load path" do
+ load_paths = run_in_context("require 'rake'; puts $:").split("\n")
+ load_paths.should include(@manifest.gem_path.join('gems/rake-0.8.7/bin').to_s)
+ end
+
+ it "doesn't add non-existent bin directories to the load path" do
+ load_paths = run_in_context("require 'activesupport'; puts $:").split("\n")
+ load_paths.should_not include(@manifest.gem_path.join('gems/activesupport-2.3.2/bin').to_s)
+ end
+
it "creates a platform-independent environment picker" do
@manifest.gem_path.join('../../environment.rb').file?.should == true
end
Please sign in to comment.
Something went wrong with that request. Please try again.