main(argv = ARGV)
click to toggle source
# File lib/taskjuggler/Tj3AppBase.rb, line 89 89: def main(argv = ARGV) 90: if Gem::Version.new(RUBY_VERSION.dup) < 91: Gem::Version.new(@mininumRubyVersion) 92: error('This program requires at least Ruby version ' + 93: "#{@mininumRubyVersion}!") 94: end 95: 96: # Install signal handler to exit gracefully on CTRL-C. 97: intHandler = Kernel.trap('INT') do 98: error("Aborting on user request!") 99: end 100: 101: begin 102: args = processArguments(argv) 103: 104: # If DEBUG mode has been enabled, we restore the INT trap handler again 105: # to get Ruby backtrackes. 106: Kernel.trap('INT', intHandler) if $DEBUG 107: 108: unless @silent 109: puts "#{AppConfig.softwareName} v#{AppConfig.version} - " + 110: "#{AppConfig.packageInfo}\n\n" + 111: "Copyright (c) #{AppConfig.copyright.join(', ')}\n" + 112: " by #{AppConfig.authors.join(', ')}\n\n" + 113: "#{AppConfig.license}\n" 114: end 115: 116: @rc = RuntimeConfig.new(AppConfig.packageName, @configFile) 117: 118: appMain(args) 119: rescue Exception => e 120: if e.is_a?(SystemExit) || e.is_a?(Interrupt) 121: # Don't show backtrace on user interrupt unless we are in debug mode. 122: $stderr.puts e.backtrace.join("\n") if $DEBUG 123: 1 124: else 125: error("Ups, you have triggered a bug in #{AppConfig.softwareName}!\n" + 126: "#{e}\n" + 127: e.backtrace.join("\n") + 128: "Please see the user manual on how to get this bug fixed!") 129: end 130: end 131: end