Module: LintTrappings::Executable

Defined in:
lib/lint_trappings/executable.rb

Overview

Helper module for creating a LintTrappings-powered executable.

Class Method Summary collapse

Class Method Details

.run(application_class, stdout, stderr, arguments) ⇒ Object

Runs the command line interface.

This should be called from your application executable, like so:

Examples:

#!/usr/bin/env ruby
require 'my_linter_gem'
require 'lint_trappings/executable'
LintTrappings::Executable.run(MyLinter::Application, STDOUT, STDERR, ARGV)

Parameters:

  • application_class (Class)
  • stdout (IO)

    output stream

  • arguments (Array<String>)

    command line arguments



20
21
22
23
24
25
# File 'lib/lint_trappings/executable.rb', line 20

def run(application_class, stdout, stderr, arguments)
  output = LintTrappings::Output.new(stdout)
  error_output = LintTrappings::Output.new(stderr)
  application = application_class.new(output)
  exit LintTrappings::Cli.new(application, error_output).run(arguments)
end