Sha256: c4df5d4846de3fb4696ce7280de4ffc886b9d3417c195bc0255b76d3168d373f

Contents?: true

Size: 1.66 KB

Versions: 18

Compression:

Stored size: 1.66 KB

Contents

#!/usr/bin/env ruby

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'bitclust/crossrubyutils'
require 'optparse'

include BitClust::CrossRubyUtils

def main
  rejects = []
  @verbose = false
  opts = OptionParser.new
  opts.banner = "Usage: #{File.basename($0, '.*')} [-r<lib>] <lib>"
  opts.on('-r', '--reject=LIB', 'Reject library LIB') {|lib|
    rejects.concat lib.split(',')
  }
  opts.on('-v', '--verbose', 'Show all ruby version.') {
    @verbose = true
  }
  opts.on('--help', 'Prints this message and quit.') {
    puts opts.help
    exit 0
  }
  begin
    opts.parse!(ARGV)
  rescue OptionParser::ParseError => err
    $stderr.puts err.message
    exit 1
  end
  unless ARGV.size == 1
    $stderr.puts 'wrong number of arguments'
    $stderr.puts opts.help
    exit 1
  end
  lib = ARGV[0]
  print_crossruby_table {|ruby| defined_classes(ruby, lib, rejects) }
end

def defined_classes(ruby, lib, rejects)
  output = `#{ruby} -e '
    def class_extent
      result = []
      ObjectSpace.each_object(Module) do |c|
        result.push c
      end
      result
    end

    %w(#{rejects.join(" ")}).each do |lib|
      begin
        require lib
      rescue LoadError
      end
    end
    if "#{lib}" == "_builtin"
      class_extent().each do |c|
        puts c
      end
    else
      before = class_extent()
      begin
        require "#{lib}"
      rescue LoadError
        $stderr.puts "\#{RUBY_VERSION} (\#{RUBY_RELEASE_DATE}): library not exist: #{lib}"
        exit
      end
      after = class_extent()
      (after - before).each do |c|
        puts c
      end
    end
  '`
  output.split
end

main

Version data entries

18 entries across 11 versions & 2 rubygems

Version Path
bitclust-dev-0.6.0 tools/bc-classes.rb
bitclust-dev-0.5.5 tools/bc-classes.rb
bitclust-dev-0.5.4 tools/bc-classes.rb
bitclust-dev-0.5.3 tools/bc-classes.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/bitclust-dev-0.5.1/tools/bc-classes.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/tools/bc-classes.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/tools/bc-classes.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-dev-0.5.1/tools/bc-classes.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/tools/bc-classes.rb
bitclust-core-0.5.3 tools/bc-classes.rb
bitclust-dev-0.5.2 tools/bc-classes.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-dev-0.5.1/tools/bc-classes.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/tools/bc-classes.rb
bitclust-core-0.5.2 tools/bc-classes.rb
bitclust-dev-0.5.1 tools/bc-classes.rb
bitclust-core-0.5.1 tools/bc-classes.rb
bitclust-dev-0.5.0 tools/bc-classes.rb
bitclust-core-0.5.0 tools/bc-classes.rb