Class: Giblish::EntryPoint
- Inherits:
-
Object
- Object
- Giblish::EntryPoint
- Defined in:
- lib/giblish/application.rb
Class Method Summary collapse
- .run(args, logger = nil) ⇒ Object
-
.run_from_cmd_line ⇒ Object
does not return, exits with status code.
Instance Method Summary collapse
-
#initialize(args, logger = nil) ⇒ EntryPoint
constructor
A new instance of EntryPoint.
- #run ⇒ Object
Constructor Details
#initialize(args, logger = nil) ⇒ EntryPoint
Returns a new instance of EntryPoint.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/giblish/application.rb', line 191 def initialize(args, logger = nil) # force immediate output # $stdout.sync = true # setup logging Giblog.setup(logger) Giblog.logger.level = Logger::INFO # Parse cmd line @user_opts = CmdLine.new.parse(args) Giblog.logger.level = @user_opts.log_level Giblog.logger.debug { "cmd line args: #{@user_opts.inspect}" } # Select the coversion instance to use @converter = select_conversion(@user_opts) end |
Class Method Details
.run(args, logger = nil) ⇒ Object
218 219 220 |
# File 'lib/giblish/application.rb', line 218 def self.run(args, logger = nil) EntryPoint.new(args, logger).run end |
.run_from_cmd_line ⇒ Object
does not return, exits with status code
223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/giblish/application.rb', line 223 def self.run_from_cmd_line begin EntryPoint.run(ARGV) Giblog.logger.info { "Giblish is done!" } exit_code = 0 rescue => exc Giblog.logger.error { exc. } Giblog.logger.error { exc.backtrace } exit_code = 1 end exit(exit_code) end |