summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-06-14 10:20:25 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-06-14 10:22:37 -0500
commit922ef03904f014276af66c488cee91d245905432 (patch)
tree3f30029577458cfa450eb2464c3352e67b7fe533
parent65aca787cc329c8c655eaccedf0ea50fa5a47153 (diff)
downloadbundler-seg-pristine-specific-gems.tar.gz
[Pristine] Raise when trying to pristine a missing gemseg-pristine-specific-gems
-rw-r--r--lib/bundler/cli/pristine.rb2
-rw-r--r--spec/commands/pristine_spec.rb11
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/bundler/cli/pristine.rb b/lib/bundler/cli/pristine.rb
index ccf970eae0..cfd90da34b 100644
--- a/lib/bundler/cli/pristine.rb
+++ b/lib/bundler/cli/pristine.rb
@@ -8,6 +8,8 @@ module Bundler
end
def run
+ CLI::Common.ensure_all_gems_in_lockfile!(@gems)
+
Bundler.load.specs.each do |spec|
next if spec.name == "bundler" # Source::Rubygems doesn't install bundler
next if !@gems.empty? && !@gems.include?(spec.name)
diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb
index 5b9dffce98..9c3918f51e 100644
--- a/spec/commands/pristine_spec.rb
+++ b/spec/commands/pristine_spec.rb
@@ -128,16 +128,21 @@ RSpec.describe "bundle pristine" do
FileUtils.touch(weakling_changes_txt)
expect(weakling_changes_txt).to be_file
- bundle! "pristine foo bar weakling bundler"
+ bundle! "pristine foo bar weakling"
expect(out).to eq(strip_whitespace(<<-EOS).strip)
- Installing weakling 1.0
- Using foo 1.0 from #{lib_path("foo")} (at master@#{foo_ref})
Cannot pristine bar (1.0). Gem is sourced from local path.
+ Using foo 1.0 from #{lib_path("foo")} (at master@#{foo_ref})
+ Installing weakling 1.0
EOS
expect(weakling_changes_txt).not_to be_file
expect(foo_changes_txt).not_to be_file
expect(bar_changes_txt).to be_file
end
+
+ it "raises when one of them is not in the lockfile" do
+ bundle "pristine abcabcabc"
+ expect(out).to include("Could not find gem 'abcabcabc'.")
+ end
end
end