Sha256: f1ea65ebc8acb9f2ebf985f39984ef1a89191a29755a1833b79704d0fc3dc71c

Contents?: true

Size: 1.68 KB

Versions: 21

Compression:

Stored size: 1.68 KB

Contents

require 'rubygems'
Gem.load_yaml
require 'rdoc'
require 'gauntlet'
require 'fileutils'

##
# Allows for testing of RDoc against every gem

class RDoc::Gauntlet < Gauntlet

  def initialize # :nodoc:
    super

    @args = nil
    @type = nil
  end

  ##
  # Runs an RDoc generator for gem +name+

  def run name
    return if self.data.key? name

    dir = File.expand_path "~/.gauntlet/data/#{@type}/#{name}"
    FileUtils.rm_rf dir if File.exist? dir

    yaml = File.read 'gemspec'
    begin
      spec = Gem::Specification.from_yaml yaml
    rescue Psych::SyntaxError
      puts "bad spec #{name}"
      self.data[name] = false
      return
    end

    args = @args.dup
    args << '--op' << dir
    args.concat spec.rdoc_options
    args << spec.require_paths
    args << spec.extra_rdoc_files
    args = args.flatten.map { |a| a.to_s }
    args.delete '--quiet'

    puts "#{name} - rdoc #{args.join ' '}"

    self.dirty = true
    r = RDoc::RDoc.new

    begin
      r.document args
      self.data[name] = true
      puts 'passed'
      FileUtils.rm_rf dir
    rescue Interrupt, StandardError, RDoc::Error, SystemStackError => e
      puts "failed - (#{e.class}) #{e.message}"
      self.data[name] = false
    end
  rescue Gem::Exception
    puts "bad gem #{name}"
  ensure
    puts
  end

  ##
  # Runs the gauntlet with the given +type+ (rdoc or ri) and +filter+ for
  # which gems to run

  def run_the_gauntlet type = 'rdoc', filter = nil
    @type = type || 'rdoc'
    @args = type == 'rdoc' ? [] : %w[--ri]
    @data_file = "#{DATADIR}/#{@type}-data.yml"

    super filter
  end

end

type = ARGV.shift
filter = ARGV.shift
filter = /#{filter}/ if filter

RDoc::Gauntlet.new.run_the_gauntlet type, filter

Version data entries

21 entries across 17 versions & 3 rubygems

Version Path
rdoc-4.3.0 lib/gauntlet_rdoc.rb
rdoc-5.0.0.beta1 lib/gauntlet_rdoc.rb
rdoc-4.2.2 lib/gauntlet_rdoc.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/rdoc-4.1.1/lib/gauntlet_rdoc.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/rdoc-4.1.1/lib/gauntlet_rdoc.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/rdoc-4.1.1/lib/gauntlet_rdoc.rb
rdoc-4.2.1 lib/gauntlet_rdoc.rb
rdoc-4.2.0 lib/gauntlet_rdoc.rb
rdoc-4.1.2 lib/gauntlet_rdoc.rb
rdoc-4.1.1 lib/gauntlet_rdoc.rb
rdoc-4.1.0 lib/gauntlet_rdoc.rb
rdoc-4.1.0.preview.3 lib/gauntlet_rdoc.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/rdoc-4.0.1/lib/gauntlet_rdoc.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/rdoc-4.0.1/lib/gauntlet_rdoc.rb
candlepin-api-0.4.0 bundle/ruby/gems/rdoc-4.0.1/lib/gauntlet_rdoc.rb
rdoc-4.0.1 lib/gauntlet_rdoc.rb
rdoc-4.0.0 lib/gauntlet_rdoc.rb
rdoc-4.0.0.rc.2.1 lib/gauntlet_rdoc.rb
rdoc-4.0.0.rc.2 lib/gauntlet_rdoc.rb
rdoc-4.0.0.preview2.1 lib/gauntlet_rdoc.rb