Skip to content

Commit

Permalink
Don't add nonexistent bindirs to the load path
Browse files Browse the repository at this point in the history
Conflicts:

	spec/bundler/cli_spec.rb
  • Loading branch information
jeremy committed Jan 3, 2010
1 parent 246ee8b commit 500adb9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/bundler/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions spec/bundler/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 500adb9

Please sign in to comment.