/usr/bin/bacon is in ruby-bacon 1.2.0-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | #!/usr/bin/ruby
# -*- ruby -*-
require 'optparse'
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../lib/')
module Bacon; end
automatic = false
output = 'SpecDoxOutput'
opts = OptionParser.new("", 24, ' ') { |opts|
opts.banner = "Usage: bacon [options] [files | -a] [-- untouched arguments]"
opts.separator ""
opts.separator "Ruby options:"
lineno = 1
opts.on("-e", "--eval LINE", "evaluate a LINE of code") { |line|
eval line, TOPLEVEL_BINDING, "-e", lineno
lineno += 1
}
opts.on("-d", "--debug", "set debugging flags (set $DEBUG to true)") {
$DEBUG = true
}
opts.on("-w", "--warn", "turn warnings on for your script") {
$-w = true
}
opts.on("-I", "--include PATH",
"specify $LOAD_PATH (may be used more than once)") { |path|
$LOAD_PATH.unshift(*path.split(":"))
}
opts.on("-r", "--require LIBRARY",
"require the library, before executing your script") { |library|
require library
}
opts.separator ""
opts.separator "bacon options:"
opts.on("-s", "--specdox", "do AgileDox-like output (default)") {
output = 'SpecDoxOutput'
}
opts.on("-q", "--quiet", "do Test::Unit-like non-verbose output") {
output = 'TestUnitOutput'
}
opts.on("-p", "--tap", "do TAP (Test Anything Protocol) output") {
output = 'TapOutput'
}
opts.on("-k", "--knock", "do Knock output") {
output = 'KnockOutput'
}
opts.on("-o", "--output FORMAT",
"do FORMAT (SpecDox/TestUnit/Tap) output") { |format|
output = format + "Output"
}
opts.on("-Q", "--no-backtrace", "don't print backtraces") {
Bacon.const_set :Backtraces, false
}
opts.on("-a", "--automatic", "gather tests from ./test/, include ./lib/") {
$LOAD_PATH.unshift "lib" if File.directory? "lib"
automatic = true
}
opts.on('-n', '--name NAME', String,
"runs tests matching regexp NAME") { |n|
Bacon.const_set :RestrictName, Regexp.new(n)
}
opts.on('-t', '--testcase TESTCASE', String,
"runs tests in TestCases matching regexp TESTCASE") { |t|
Bacon.const_set :RestrictContext, Regexp.new(t)
}
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--version", "Show version") do
require 'bacon'
puts "bacon #{Bacon::VERSION}"
exit
end
opts.parse! ARGV
}
files = ARGV
if automatic
files.concat Dir["test/**/test_*.rb"]
files.concat Dir["test/**/spec_*.rb"]
files.concat Dir["spec/**/spec_*.rb"]
files.concat Dir["spec/**/*_spec.rb"]
end
if files.empty?
puts opts.banner
exit 1
end
require 'bacon'
Bacon.extend Bacon.const_get(output) rescue abort "No such formatter: #{output}"
Bacon.summary_on_exit
files.each { |file|
load file
}
|