diff options
author | Homu <homu@barosl.com> | 2016-08-03 05:05:39 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-08-03 05:05:39 +0900 |
commit | b0d83bcf0ffba89b2afaa44359dee8bb12961620 (patch) | |
tree | 762f6eb12c3a564103c2a77cc8d23f5895e2cf18 | |
parent | 7f82490b82680c1786bd0af7f014d7ddab07629f (diff) | |
parent | 23e0c006a9c7d7938e8ed6d3c09e5a3099cc5184 (diff) | |
download | bundler-b0d83bcf0ffba89b2afaa44359dee8bb12961620.tar.gz |
Auto merge of #4804 - b-ggs:4753-trampoline-ux, r=segiddins
Display message showing locked Bundler version is being installed
This is for #4753.
[This](https://github.com/bundler/bundler/issues/4753#issuecomment-233786976) always showed the installing message whether the locked Bundler version was installed or not, so I moved the line into `lib/bundler/vendor/postit/lib/postit/installer.rb`.
I've also added the appropriate specs for this.
@RochesterinNYC @segiddins @indirect
-rw-r--r-- | lib/bundler/postit_trampoline.rb | 5 | ||||
-rw-r--r-- | spec/other/trampoline_spec.rb | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb index 5f90ffa0a0..950a77341f 100644 --- a/lib/bundler/postit_trampoline.rb +++ b/lib/bundler/postit_trampoline.rb @@ -20,7 +20,10 @@ if ENV["BUNDLE_ENABLE_TRAMPOLINE"] if !version.satisfied_by?(installed_version) begin installer = BundlerVendoredPostIt::PostIt::Installer.new(version) - installer.install! + unless installer.installed? + warn "Installing locked Bundler version #{version.to_s.gsub("= ", "")}..." + installer.install! + end rescue => e abort <<-EOS.strip Installing the inferred bundler version (#{version}) failed. diff --git a/spec/other/trampoline_spec.rb b/spec/other/trampoline_spec.rb index 98cd5c5afe..faac788a5e 100644 --- a/spec/other/trampoline_spec.rb +++ b/spec/other/trampoline_spec.rb @@ -84,11 +84,26 @@ describe "bundler version trampolining" do ENV["BUNDLER_VERSION"] = "9999" bundle "--version", :expect_err => true expect(err).to start_with(<<-E.strip) +Installing locked Bundler version 9999... Installing the inferred bundler version (= 9999) failed. If you'd like to update to the current bundler version (#{Bundler::VERSION}) in this project, run `bundle update --bundler`. The error was: E end + + it "displays installing message before install is started" do + expect(system_gem_path.join("gems", "bundler-1.12.3")).not_to exist + bundle! "--version" + expect(err).to include("Installing locked Bundler version #{ENV["BUNDLER_VERSION"]}...") + end + + it "doesn't display installing message if locked version is installed" do + expect(system_gem_path.join("gems", "bundler-1.12.3")).not_to exist + bundle! "--version" + expect(system_gem_path.join("gems", "bundler-1.12.3")).to exist + bundle! "--version" + expect(err).not_to include("Installing locked Bundler version = #{ENV["BUNDLER_VERSION"]}...") + end end context "bundle update --bundler" do |