Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Use real paths for bundle clean
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jun 17, 2019
1 parent 4dc6d1d commit 0646f9e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def has_local_dependencies?
end

def spec_git_paths
sources.git_sources.map {|s| s.path.to_s }
sources.git_sources.map {|s| File.realpath(s.path) }
end

def groups
Expand Down
26 changes: 26 additions & 0 deletions spec/commands/clean_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,32 @@ def should_not_have_gems(*gems)
expect(vendored_gems("bin/rackup")).to exist
end

it "keeps used git gems even if installed to a symlinked location" do
build_git "foo", :path => lib_path("foo")
git_path = lib_path("foo")
revision = revision_for(git_path)

gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
git "#{git_path}", :ref => "#{revision}" do
gem "foo"
end
G

FileUtils.mkdir_p(bundled_app("real-path"))
FileUtils.ln_sf(bundled_app("real-path"), bundled_app("symlink-path"))

bundle "install", forgotten_command_line_options(:path => bundled_app("symlink-path"))

bundle :clean

expect(out).not_to include("Removing foo (#{revision[0..11]})")

expect(bundled_app("symlink-path/#{Bundler.ruby_scope}/bundler/gems/foo-#{revision[0..11]}")).to exist
end

it "removes old git gems" do
build_git "foo-bar", :path => lib_path("foo-bar")
revision = revision_for(lib_path("foo-bar"))
Expand Down

0 comments on commit 0646f9e

Please sign in to comment.