Class: Giblish::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/application.rb

Instance Method Summary collapse

Instance Method Details

#run(args) ⇒ Object

return exit status (0 for success)



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
# File 'lib/giblish/application.rb', line 21

def run(args)
  # force immediate output
  $stdout.sync = true

  # setup logging
  Giblog.setup

  # Parse cmd line
  cmdline = CmdLineParser.new args

  Giblog.logger.debug { "cmd line args: #{cmdline.args}" }

  # Convert using given args
  begin
    if cmdline.args[:gitRepoRoot]
      Giblog.logger.info { "User asked to parse a git repo" }
      gc = GitRepoConverter.new cmdline.args
      gc.convert
    else
      tc = FileTreeConverter.new cmdline.args
      tc.convert
    end
    Giblog.logger.info { "Giblish is done!" }
    0
  rescue Exception => e
    log_error e
    1
  end
end

#run_from_cmd_lineObject

does not return, exits with status code



15
16
17
18
# File 'lib/giblish/application.rb', line 15

def run_from_cmd_line
  status = run ARGV
  exit(status)
end

#run_with_args(args) ⇒ Object

return exit status (0 for success)



10
11
12
# File 'lib/giblish/application.rb', line 10

def run_with_args(args)
  run args
end