Sha256: 80bb7b7c88e8af5bc1f9d468252f8b3d8c12ba15275a233ec663be0172576120

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 Bytes

Contents

# Application container for initialization and execution of Jobim's
# resources. Generates a new `Jobim::CLI` instance, and then passes it off to
# a `Jobim::Server`. Good chance this will change in the future.
module Jobim::Application
  # Initializes and runs the CLI and Server
  #
  # @param args [Array<String>] list of args passed to the application
  # @param block [Block] dummy block object (Not used)
  def self.run(*args, &block)
    cli = Jobim::CLI.new
    begin
      cli.parse(args)

      exit if cli.exit

      Jobim::Server.start!(cli.settings)
    rescue OptionParser::InvalidOption => invalid_option
      $stderr.puts ">>> Error: #{invalid_option}"
      $stderr.puts cli.help

    rescue RuntimeError => runtime_error
      $stderr.puts '>>> Failed to start server'
      $stderr.puts ">> #{runtime_error}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobim-0.6.0 lib/jobim/application.rb