Sha256: b9261e0e85c52a29c3e68c692fa55e14bb23acfc9c863807a43af03c325db0dd

Contents?: true

Size: 1.35 KB

Versions: 18

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby

require 'pathname'

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

require 'bitclust'
require 'optparse'

def main
  check_only = false
  parser = OptionParser.new
  parser.banner = "Usage: #{File.basename($0, '.*')} <file>..."
  parser.on('-c', '--check-only', 'Check syntax and output status.') {
    check_only = true
  }
  parser.on('--help', 'Prints this message and quit.') {
    puts parser.help
    exit
  }
  begin
    parser.parse!
  rescue OptionParser::ParseError => err
    $stderr.puts err.message
    exit 1
  end

  success = true
  ARGV.each do |path|
    begin
      lib = BitClust::RRDParser.parse_stdlib_file(path)
      if check_only
        $stderr.puts "#{path}: OK"
      else
        show_library lib
      end
    rescue BitClust::WriterError => err
      raise if $DEBUG
      $stderr.puts "#{File.basename($0, '.*')}: FAIL: #{err.message}"
      success = false
    end
  end
  exit success
end

def show_library(lib)
  puts "= Library #{lib.name}"
  lib.classes.each do |c|
    puts "#{c.type} #{c.name}"
    c.each do |m|
      puts "\t* #{m.klass.name}#{m.typemark}#{m.names.join(',')}"
    end
  end
  unless lib.methods.empty?
    puts "Additional Methods:"
    lib.methods.each do |m|
      puts "\t* #{m.klass.name}#{m.typemark}#{m.names.join(',')}"
    end
  end
end

main

Version data entries

18 entries across 11 versions & 2 rubygems

Version Path
bitclust-dev-0.6.0 tools/bc-list.rb
bitclust-dev-0.5.5 tools/bc-list.rb
bitclust-dev-0.5.4 tools/bc-list.rb
bitclust-dev-0.5.3 tools/bc-list.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-list.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/tools/bc-list.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-dev-0.5.1/tools/bc-list.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-list.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/tools/bc-list.rb
bitclust-core-0.5.3 tools/bc-list.rb
bitclust-dev-0.5.2 tools/bc-list.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/tools/bc-list.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-dev-0.5.1/tools/bc-list.rb
bitclust-core-0.5.2 tools/bc-list.rb
bitclust-dev-0.5.1 tools/bc-list.rb
bitclust-core-0.5.1 tools/bc-list.rb
bitclust-dev-0.5.0 tools/bc-list.rb
bitclust-core-0.5.0 tools/bc-list.rb