Permalink
Browse files

Don't add nonexistent bindirs to the load path

Conflicts:

	spec/bundler/cli_spec.rb
  • Loading branch information...
jeremy committed Jan 3, 2010
1 parent 246ee8b commit 500adb9e0b68eec6bae227f29cc0db3170a392d4
Showing with 13 additions and 1 deletion.
  1. +3 −1 lib/bundler/bundle.rb
  2. +10 −0 spec/bundler/cli_spec.rb
View
@@ -245,7 +245,9 @@ def load_paths_for_specs(specs, options)
specs.each do |spec|
next if options[:no_bundle].include?(spec.name)
gem_path = Pathname.new(spec.full_gem_path)
- load_paths << load_path_for(gem_path, spec.bindir) if spec.bindir
+ if spec.bindir && gem_path.join(spec.bindir).exist?
+ load_paths << load_path_for(gem_path, spec.bindir)
+ end
spec.require_paths.each do |path|
load_paths << load_path_for(gem_path, path)
end
View
@@ -91,6 +91,16 @@
@manifest.gem_path.join('../../environment.rb').file?.should == true
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-existant 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 valid executables in ./bin" do
app_root do
`bin/rake`.should == "0.8.7\n"

0 comments on commit 500adb9

Please sign in to comment.