/usr/lib/ruby/vendor_ruby/mercenary/program.rb is in ruby-mercenary 0.3.4-1.
This file is owned by root:root, with mode 0o644.
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 | module Mercenary
class Program < Command
attr_reader :optparse
attr_reader :config
# Public: Creates a new Program
#
# name - the name of the program
#
# Returns nothing
def initialize(name)
@config = {}
super(name)
end
# Public: Run the program
#
# argv - an array of string args (usually ARGV)
#
# Returns nothing
def go(argv)
logger.debug("Using args passed in: #{argv.inspect}")
cmd = nil
@optparse = OptionParser.new do |opts|
cmd = super(argv, opts, @config)
end
@optparse.parse!(argv)
logger.debug("Parsed config: #{@config.inspect}")
begin
cmd.execute(argv, @config)
rescue => e
if cmd.trace
raise e
else
logger.error e.message
abort
end
end
end
end
end
|