Browse files

Disable 'gem pristine' for default gems

  • Loading branch information...
1 parent 6834877 commit d69952a817e2156fc36e6d22f1a6266b60fa6eea @kou committed Nov 14, 2012
Showing with 23 additions and 0 deletions.
  1. +5 −0 lib/rubygems/commands/pristine_command.rb
  2. +18 −0 test/rubygems/test_gem_commands_pristine_command.rb
View
5 lib/rubygems/commands/pristine_command.rb
@@ -78,6 +78,11 @@ def execute
say "Restoring gems to pristine condition..."
specs.each do |spec|
+ if spec.default_gem?
+ say "Skipped #{spec.full_name}, it is a default gem"
+ next
+ end
+
unless spec.extensions.empty? or options[:extensions] then
say "Skipped #{spec.full_name}, it needs to compile an extension"
next
View
18 test/rubygems/test_gem_commands_pristine_command.rb
@@ -227,5 +227,23 @@ def test_execute_no_gem
assert_match %r|at least one gem name|, e.message
end
+ def test_execute_default_gem
+ default_gem_spec = new_default_spec("default", "2.0.0.0",
+ nil, "default/gem.rb")
+ install_default_specs(default_gem_spec)
+
+ @cmd.options[:args] = %w[default]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ assert_equal([
+ "Restoring gems to pristine condition...",
+ "Skipped default-2.0.0.0, it is a default gem",
+ ],
+ @ui.output.split("\n"))
+ assert_empty(@ui.error)
+ end
end

0 comments on commit d69952a

Please sign in to comment.