Sha256: e492c30a688af7aa247d3fb6de7b7a4afcd5318a71345692deb7e56746f96c64

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 Bytes

Contents

require 'vedeu/application'
require 'vedeu/configuration'

module Vedeu
  class Launcher
    # :nocov:
    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

    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

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.1.7 lib/vedeu/launcher.rb
vedeu-0.1.6 lib/vedeu/launcher.rb
vedeu-0.1.5 lib/vedeu/launcher.rb
vedeu-0.1.4 lib/vedeu/launcher.rb
vedeu-0.1.3 lib/vedeu/launcher.rb
vedeu-0.1.2 lib/vedeu/launcher.rb