lib/giblish/application.rb in giblish-0.2.12 vs lib/giblish/application.rb in giblish-0.3.0

- old
+ new

@@ -4,19 +4,26 @@ require_relative "utils" module Giblish class Application + # return exit status (0 for success) def run_with_args(args) run args end + # does not return, exits with status code def run_from_cmd_line - run ARGV + status = run ARGV + exit(status) end + # return exit status (0 for success) def run(args) + # force immediate output + $stdout.sync = true + # setup logging Giblog.setup # Parse cmd line cmdline = CmdLineParser.new args @@ -25,18 +32,20 @@ # Convert using given args begin if cmdline.args[:gitRepoRoot] Giblog.logger.info { "User asked to parse a git repo" } - GitRepoParser.new cmdline.args + gc = GitRepoConverter.new cmdline.args + gc.convert else - tc = TreeConverter.new cmdline.args - tc.walk_dirs + tc = FileTreeConverter.new cmdline.args + tc.convert end Giblog.logger.info { "Giblish is done!" } + 0 rescue Exception => e log_error e - exit(1) + 1 end end private