Sha256: 22c743e552c34b29f69e0a70958f8dd8379292fb4fa938271fa69e53963fd084

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 Bytes

Contents

require_relative 'application'
require_relative 'configuration'

module Vedeu
  class Launcher
    def initialize(argv, stdin  = STDIN,
                         stdout = STDOUT,
                         stderr = STDERR,
                         kernel = Kernel)
      @argv      = argv
      @stdin     = stdin
      @stdout    = stdout
      @stderr    = stderr
      @kernel    = kernel
      @exit_code = 1
    end

    # :nocov:
    def execute!
      $stdin, $stdout, $stderr = @stdin, @stdout, @stderr

      Application.start(configuration)

      @exit_code = 0
    rescue StandardError => uncaught_exception
      Vedeu.error(uncaught_exception)
    ensure
      $stdin, $stdout, $stderr = STDIN, STDOUT, STDERR
      @kernel.exit(@exit_code)
    end

    private

    attr_reader :argv

    def configuration
      Configuration.configure(argv)
    end
    # :nocov:
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.0.32 lib/vedeu/launcher.rb
vedeu-0.0.31 lib/vedeu/launcher.rb