Class: Cucumber::Cli::Configuration

Inherits:
Object
  • Object
show all
Includes:
Cucumber::Constantize
Defined in:
lib/cucumber/cli/configuration.rb

Defined Under Namespace

Classes: LogFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Cucumber::Constantize

#constantize, #underscore

Constructor Details

#initialize(out_stream = STDOUT, error_stream = STDERR) ⇒ Configuration

Returns a new instance of Configuration



20
21
22
23
24
# File 'lib/cucumber/cli/configuration.rb', line 20

def initialize(out_stream = STDOUT, error_stream = STDERR)
  @out_stream   = out_stream
  @error_stream = error_stream
  @options = Options.new(@out_stream, @error_stream, :default_profile => 'default')
end

Instance Attribute Details

#out_streamObject (readonly)

Returns the value of attribute out_stream



18
19
20
# File 'lib/cucumber/cli/configuration.rb', line 18

def out_stream
  @out_stream
end

Instance Method Details

#dry_run?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/cucumber/cli/configuration.rb', line 58

def dry_run?
  @options[:dry_run]
end

#expand?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/cucumber/cli/configuration.rb', line 62

def expand?
  @options[:expand]
end

#fail_fast?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/cucumber/cli/configuration.rb', line 66

def fail_fast?
  !!@options[:fail_fast]
end

#filtersObject



98
99
100
# File 'lib/cucumber/cli/configuration.rb', line 98

def filters
  @options.filters
end

#formatsObject



102
103
104
# File 'lib/cucumber/cli/configuration.rb', line 102

def formats
  @options[:formats]
end

#guess?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/cucumber/cli/configuration.rb', line 54

def guess?
  @options[:guess]
end

#logObject



78
79
80
81
82
83
84
# File 'lib/cucumber/cli/configuration.rb', line 78

def log
  logger = Logger.new(@out_stream)
  logger.formatter = LogFormatter.new
  logger.level = Logger::INFO
  logger.level = Logger::DEBUG if self.verbose?
  logger
end

#name_regexpsObject



94
95
96
# File 'lib/cucumber/cli/configuration.rb', line 94

def name_regexps
  @options[:name_regexps]
end

#parse!(args) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/cucumber/cli/configuration.rb', line 26

def parse!(args)
  @args = args
  @options.parse!(args)
  arrange_formats
  raise("You can't use both --strict and --wip") if strict.strict? && wip?
  set_environment_variables
end

#pathsObject



106
107
108
# File 'lib/cucumber/cli/configuration.rb', line 106

def paths
  @options[:paths]
end

#randomize?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/cucumber/cli/configuration.rb', line 38

def randomize?
  @options[:order] == 'random'
end

#retry_attemptsObject



70
71
72
# File 'lib/cucumber/cli/configuration.rb', line 70

def retry_attempts
  @options[:retry]
end

#seedObject



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

def seed
  Integer(@options[:seed] || rand(0xFFFF))
end

#snippet_typeObject



74
75
76
# File 'lib/cucumber/cli/configuration.rb', line 74

def snippet_type
  @options[:snippet_type] || :cucumber_expression
end

#strictObject



46
47
48
# File 'lib/cucumber/cli/configuration.rb', line 46

def strict
  @options[:strict]
end

#tag_expressionsObject



90
91
92
# File 'lib/cucumber/cli/configuration.rb', line 90

def tag_expressions
  @options[:tag_expressions]
end

#tag_limitsObject



86
87
88
# File 'lib/cucumber/cli/configuration.rb', line 86

def tag_limits
  @options[:tag_limits]
end

#to_hashObject



110
111
112
# File 'lib/cucumber/cli/configuration.rb', line 110

def to_hash
  Hash(@options).merge(out_stream: @out_stream, error_stream: @error_stream)
end

#verbose?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/cucumber/cli/configuration.rb', line 34

def verbose?
  @options[:verbose]
end

#wip?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/cucumber/cli/configuration.rb', line 50

def wip?
  @options[:wip]
end