summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-05-26 11:15:24 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-06-14 10:15:47 -0500
commit65aca787cc329c8c655eaccedf0ea50fa5a47153 (patch)
tree19f84413928d87a50d78c2cada9310489382d69f /lib/bundler
parente274d9fe47a0f1801761e4646ce5df32df6033ac (diff)
downloadbundler-65aca787cc329c8c655eaccedf0ea50fa5a47153.tar.gz
[Pristine] Allow passing a list of gems to pristine
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/cli.rb6
-rw-r--r--lib/bundler/cli/pristine.rb5
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 10287d3ac7..c9ddec93f4 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -553,10 +553,10 @@ module Bundler
Issue.new.run
end
- desc "pristine", "Restores installed gems to pristine condition from files located in the gem cache. Gem installed from a git repository will be issued `git checkout --force`."
- def pristine
+ desc "pristine [GEMS...]", "Restores installed gems to pristine condition from files located in the gem cache. Gem installed from a git repository will be issued `git checkout --force`."
+ def pristine(*gems)
require "bundler/cli/pristine"
- Pristine.new.run
+ Pristine.new(gems).run
end
if Bundler.feature_flag.plugins?
diff --git a/lib/bundler/cli/pristine.rb b/lib/bundler/cli/pristine.rb
index 86b7b86eaa..ccf970eae0 100644
--- a/lib/bundler/cli/pristine.rb
+++ b/lib/bundler/cli/pristine.rb
@@ -3,9 +3,14 @@ require "bundler/cli/common"
module Bundler
class CLI::Pristine
+ def initialize(gems)
+ @gems = gems
+ end
+
def run
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)
gem_name = "#{spec.name} (#{spec.version}#{spec.git_version})"
gem_name += " (#{spec.platform})" if !spec.platform.nil? && spec.platform != Gem::Platform::RUBY