lib/mutant/cli.rb in mutant-0.7.3 vs lib/mutant/cli.rb in mutant-0.7.4
- old
+ new
@@ -72,11 +72,11 @@
end
end
parse_match_expressions(opts.parse!(arguments))
rescue OptionParser::ParseError => error
- fail(Error, error.message, error.backtrace)
+ raise(Error, error.message, error.backtrace)
end
# Parse matchers
#
# @param [Array<String>] expressions
@@ -99,10 +99,12 @@
#
# @return [undefined]
#
# @api private
#
+ # rubocop:disable MethodLength
+ #
def add_environment_options(opts)
opts.separator('Environment:')
opts.on('--zombie', 'Run mutant zombified') do
update(zombie: true)
end
@@ -127,11 +129,11 @@
#
def setup_integration(name)
require "mutant/integration/#{name}"
update(integration: Integration.lookup(name))
rescue LoadError
- fail Error, "Could not load integration #{name.inspect} (you may want to try installing the gem mutant-#{name})"
+ raise Error, "Could not load integration #{name.inspect} (you may want to try installing the gem mutant-#{name})"
end
# Add options
#
# @param [OptionParser] opts
@@ -144,11 +146,12 @@
opts.separator(EMPTY_STRING)
opts.separator('Options:')
opts.on('--score COVERAGE', 'Fail unless COVERAGE is not reached exactly') do |coverage|
update(expected_coverage: Float(coverage))
- end.on('--use STRATEGY', 'Use STRATEGY for killing mutations', &method(:setup_integration))
+ end
+ opts.on('--use STRATEGY', 'Use STRATEGY for killing mutations', &method(:setup_integration))
end
# Add filter options
#
# @param [OptionParser] opts
@@ -175,15 +178,18 @@
# @api private
#
def add_debug_options(opts)
opts.on('--fail-fast', 'Fail fast') do
update(fail_fast: true)
- end.on('--version', 'Print mutants version') do
+ end
+ opts.on('--version', 'Print mutants version') do
puts("mutant-#{Mutant::VERSION}")
Kernel.exit(EXIT_SUCCESS)
- end.on('-d', '--debug', 'Enable debugging output') do
+ end
+ opts.on('-d', '--debug', 'Enable debugging output') do
update(debug: true)
- end.on_tail('-h', '--help', 'Show this message') do
+ end
+ opts.on_tail('-h', '--help', 'Show this message') do
puts(opts.to_s)
Kernel.exit(EXIT_SUCCESS)
end
end