Sha256: 23974bf0657f89cc6255d8694f240af99865d301fd849887a5fac186a5f2c0e5

Contents?: true

Size: 887 Bytes

Versions: 6

Compression:

Stored size: 887 Bytes

Contents

require_relative 'application'
require_relative '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.0.38 lib/vedeu/launcher.rb
vedeu-0.0.37 lib/vedeu/launcher.rb
vedeu-0.0.36 lib/vedeu/launcher.rb
vedeu-0.0.35 lib/vedeu/launcher.rb
vedeu-0.0.34 lib/vedeu/launcher.rb
vedeu-0.0.33 lib/vedeu/launcher.rb