Class: Giblish::EntryPoint
- Inherits:
-
Object
- Object
- Giblish::EntryPoint
- Defined in:
- lib/giblish/application.rb
Overview
The main entry point to the giblish application
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.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/giblish/application.rb', line 145 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
172 173 174 |
# File 'lib/giblish/application.rb', line 172 def self.run(args, logger = nil) EntryPoint.new(args, logger).run end |
.run_from_cmd_line ⇒ Object
does not return, exits with status code
177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/giblish/application.rb', line 177 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 |
Instance Method Details
#run ⇒ Object
162 163 164 165 166 167 168 169 170 |
# File 'lib/giblish/application.rb', line 162 def run begin require "asciidoctor-diagram" rescue LoadError Giblog.logger.warn { "Did not find asciidoctor-diagram installed, diagrams will not be rendered." } end # do the conversion @converter.run end |