Class: Spinach::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/spinach/cli.rb

Overview

The cli is a class responsible of handling all the command line interface logic.

Instance Method Summary collapse

Constructor Details

#initialize(args = ARGV) ⇒ Cli

Returns a new instance of Cli.

Parameters:

  • arguments (Array<String>)

    The command line arguments



12
13
14
# File 'lib/spinach/cli.rb', line 12

def initialize(args = ARGV)
  @args = args
end

Instance Method Details

#init_reporterObject

Inits the reporter with a default one.



29
30
31
32
# File 'lib/spinach/cli.rb', line 29

def init_reporter
  reporter = Spinach::Reporter::Stdout.new(options[:reporter])
  reporter.bind
end

#optionsHash

Returns A hash of options separated by its type.

Examples:

Cli.new.options
# => { reporter: { backtrace: true } }

Returns:

  • (Hash)

    A hash of options separated by its type.



42
43
44
# File 'lib/spinach/cli.rb', line 42

def options
  @options ||= parse_options
end

#runtrue, false

Runs all the features.

Returns:

  • (true, false)

    The exit status - true for success, false for failure.



22
23
24
# File 'lib/spinach/cli.rb', line 22

def run
  Spinach::Runner.new(feature_files).run
end