diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-06-17 13:17:54 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-06-17 13:46:55 +0200 |
commit | 0646f9e286ff330a227cea01812b1ead4fa601cd (patch) | |
tree | e33d50bbbad79e8ba78757189d0b5be1fbfb71f1 | |
parent | 4dc6d1d115802640e4a8c20769c428932f641340 (diff) | |
download | bundler-use_real_git_paths.tar.gz |
Use real paths for `bundle clean`use_real_git_paths
-rw-r--r-- | lib/bundler/definition.rb | 2 | ||||
-rw-r--r-- | spec/commands/clean_spec.rb | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 76950ff96a..4664eec24d 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -317,7 +317,7 @@ module Bundler 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 diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 0053947c85..a3bbe9f01f 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -183,6 +183,32 @@ RSpec.describe "bundle clean" do 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")) |