Method: Raygun::Runner.parse
- Defined in:
- lib/raygun/raygun.rb
.parse(_args) ⇒ Object
rubocop:disable Metrics/MethodLength
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/raygun/raygun.rb', line 252 def parse(_args) raygun = nil = OpenStruct.new .target_dir = nil .prototype_repo = CARBONFIVE_REPO parser = OptionParser.new do |opts| opts. = "Usage: raygun [options] NEW_APP_DIRECTORY" opts.on("-h", "--help", "Show raygun usage") do usage_and_exit(opts) end opts.on( "-p", "--prototype [github_repo]", "Prototype github repo (e.g. carbonfive/raygun-rails)." ) do |prototype| .prototype_repo = prototype end opts.on("-v", "--version", "Print the version number") do puts Raygun::VERSION exit 1 end end begin parser.parse! .target_dir = ARGV.first raise OptionParser::InvalidOption if .target_dir.nil? raygun = Raygun::Runner.new(.target_dir, .prototype_repo) rescue OptionParser::InvalidOption usage_and_exit(parser) end raygun end |