diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
commit | e798ccbacf489a3af2201ae30058ff0ae7f79045 (patch) | |
tree | 4147a7834eb88323057fd2120a2ddc96c1eb32ab /lib/rubygems/validator.rb | |
parent | d26fb035cae8d351dc238376722c980230dc5fbd (diff) | |
download | ruby-e798ccbacf489a3af2201ae30058ff0ae7f79045.tar.gz |
Import rubygems 1.5.0 (release candidate)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/validator.rb')
-rw-r--r-- | lib/rubygems/validator.rb | 93 |
1 files changed, 11 insertions, 82 deletions
diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb index 16e12ef02e..d2750f14ea 100644 --- a/lib/rubygems/validator.rb +++ b/lib/rubygems/validator.rb @@ -1,21 +1,18 @@ +###################################################################### +# This file is imported from the rubygems project. +# DO NOT make modifications in this repo. They _will_ be reverted! +# File a patch instead and assign it to Ryan Davis or Eric Hodel. +###################################################################### + #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require 'find' - -require 'digest' require 'rubygems/format' require 'rubygems/installer' -begin - gem 'test-unit' -rescue Gem::LoadError - # Ignore - use the test-unit library that's part of the standard library -end - ## # Validator performs various gem file and gem database validation @@ -23,6 +20,11 @@ class Gem::Validator include Gem::UserInteraction + def initialize + require 'find' + require 'digest' + end + ## # Given a gem file's contents, validates against its own MD5 checksum # gem_data:: [String] Contents of the gem file @@ -165,79 +167,6 @@ class Gem::Validator errors end -=begin - if RUBY_VERSION < '1.9' then - class TestRunner - def initialize(suite, ui) - @suite = suite - @ui = ui - end - - def self.run(suite, ui) - require 'test/unit/ui/testrunnermediator' - return new(suite, ui).start - end - - def start - @mediator = Test::Unit::UI::TestRunnerMediator.new(@suite) - @mediator.add_listener(Test::Unit::TestResult::FAULT, &method(:add_fault)) - return @mediator.run_suite - end - - def add_fault(fault) - if Gem.configuration.verbose then - @ui.say fault.long_display - end - end - end - - autoload :TestRunner, 'test/unit/ui/testrunnerutilities' - end -=end - - ## - # Runs unit tests for a given gem specification - - def unit_test(gem_spec) - start_dir = Dir.pwd - Dir.chdir(gem_spec.full_gem_path) - $: << gem_spec.full_gem_path - # XXX: why do we need this gem_spec when we've already got 'spec'? - test_files = gem_spec.test_files - - if test_files.empty? then - say "There are no unit tests to run for #{gem_spec.full_name}" - return nil - end - - gem gem_spec.name, "= #{gem_spec.version.version}" - - test_files.each do |f| require f end - -=begin - if RUBY_VERSION < '1.9' then - suite = Test::Unit::TestSuite.new("#{gem_spec.name}-#{gem_spec.version}") - - ObjectSpace.each_object(Class) do |klass| - suite << klass.suite if (klass < Test::Unit::TestCase) - end - - result = TestRunner.run suite, ui - - alert_error result.to_s unless result.passed? - else - result = MiniTest::Unit.new - result.run - end -=end - result = MiniTest::Unit.new - result.run - - result - ensure - Dir.chdir(start_dir) - end - def remove_leading_dot_dir(path) path.sub(/^\.\//, "") end |