module Tapout
Constants
- REVISION
The current revision of the TAP-Y/J format.
Public Class Methods
cli(*argv)
click to toggle source
Command line interface.
# File lib/tapout/cli.rb, line 7 def self.cli(*argv) options = {} type = :modern parser = OptionParser.new do |opt| opt.banner = "tapout [options] [reporter]" opt.separator("\nOPTIONS:") #opt.on('-t', '--tap', 'Consume legacy TAP input') do |fmt| # type = :legacy #end opt.on('--trace', '-t DEPTH', 'set backtrace depth') do |depth| self.config.trace = depth end opt.on('--lines', '-l LINES', 'number of surrounding source code lines') do |lines| self.config.lines = lines.to_i end opt.on('--minimal', '-m', 'show only errors, failures and pending tests') do |val| self.config.minimal = val end opt.on('--no-color', 'suppress ANSI color codes') do $ansi = false end opt.on('--require', '-r FEATURE', 'require feature') do |feature| require feature end #opt.on('--plugin', '-p NAME', 'Require plugin feature (tapout-<name>)') do |name| # require "tapout-#{name}" #end opt.on('--debug', 'run with $DEBUG flag on') do |fmt| $DEBUG = true end opt.separator("\nREPORTERS:\n " + Reporters.index.keys.join("\n ")) end parser.parse!(argv) options[:format] = argv.first # TODO: would be nice if it could automatically determine which #c = $stdin.getc # $stdin.pos = 0 #type = :legacy if c =~ /\d/ #type = :modern if c == '-' stdin = Curmudgeon.new($stdin) case stdin.line1 when /^\d/ type = :perl when /^\-/ type = :yaml when /^\{/ type = :json else raise "Not a recognized TAP stream!" end case type when :perl stream_parser = PerlParser.new(options) exit_code = stream_parser.consume(stdin) when :yaml stream_parser = YamlParser.new(options) exit_code = stream_parser.consume(stdin) when :json stream_parser = JsonParser.new(options) exit_code = stream_parser.consume(stdin) end exit(exit_code || 0) end
config()
click to toggle source
Alias for `#configuration`.
# File lib/tapout/config.rb, line 14 def self.config configuration end
configuration()
click to toggle source
Access to configuration.
# File lib/tapout/config.rb, line 9 def self.configuration @config ||= Config.new end
configure(&block)
click to toggle source
Define configuration.
# File lib/tapout/config.rb, line 4 def self.configure(&block) configuration.update(&block) end
const_missing(name)
click to toggle source
Any missing constant will be looked for in project metadata.
Calls superclass method
# File lib/tapout/version.rb, line 17 def self.const_missing(name) metadata[name.to_s.downcase] || super(name) end
metadata()
click to toggle source
Project metadata.
@return [Hash] metadata from .ruby file
# File lib/tapout/version.rb, line 8 def self.metadata @metadata ||= ( require 'yaml' YAML.load_file(File.join(File.dirname(__FILE__), '/../tapout.yml')) ) end