Sha256: 62433b9a9b9ddd96876039f59f97ddbfe59c334215dd3cf293983f6a34fbd362

Contents?: true

Size: 1.65 KB

Versions: 7

Compression:

Stored size: 1.65 KB

Contents

# -*- ruby -*-

Gem.refresh

require 'autotest/restart'
require 'autotest/isolate'

Autotest.add_hook :run_command do |_, cmd|
  cmd.sub! ' -e ', ' -we '
end

Autotest.add_hook :initialize do |at|
  at.testlib = ''

  at.add_exception %r%/\.git/%
  at.add_exception %r%\.rbc$%
  at.add_exception %r%test/rubygems/rubygems%

  at.find_directories.clear
  at.find_directories.push 'lib', 'test'

  at.add_mapping %r%^lib/rubygems.rb$% do |_, m|
    "test/rubygems/test_gem.rb"
  end

  at.add_mapping %r%^lib/rubygems/(.*).rb$% do |_, m|
    "test/rubygems/test_gem_#{m[1].gsub '/', '_'}.rb"
  end

  args = ARGV.reject { |a| a =~ /^-/ }
  at.find_directories = args unless args.empty?

  def at.handle_results results
    results = results.gsub(/\e\[\d+m/, '') # strip ascii color
    failed = results.scan(self.failed_results_re).map { |m, k|
      m, k = $1, $2 if m =~ /(\w+)\((\w+)\)/ # minitest 4 output
      [m, k]
    }

    completed = results[self.completed_re]

    if completed then
      completed = completed.scan(/(\d+) (\w+)/).map { |v, k| [k, v.to_i] }

      self.latest_results = Hash[*completed.flatten]
      self.files_to_test  = consolidate_failures failed

      color = failed.empty? ? :green : :red
      hook color unless $TESTING
    else
      self.latest_results = nil
    end

    self.tainted = true unless self.files_to_test.empty?
  end

  def at.path_to_classname s
    sep = File::SEPARATOR

    f = s.sub(/^test#{sep}rubygems#{sep}/, '').sub(/\.rb$/, '').split sep

    f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }

    f.join('::').
      gsub('Rdoc', 'RDoc').
      gsub('GemDependencyApi', 'GemDependencyAPI')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubygems-update-2.2.5 .autotest
rubygems-update-2.2.4 .autotest
rubygems-update-2.2.3 .autotest
rubygems-update-2.2.2 .autotest
rubygems-update-2.2.1 .autotest
rubygems-update-2.2.0 .autotest
rubygems-update-2.2.0.rc.1 .autotest