Class: MightyTest::CLI
- Inherits:
-
Object
- Object
- MightyTest::CLI
- Defined in:
- lib/mighty_test/cli.rb
Instance Method Summary collapse
-
#initialize(file_system: FileSystem.new, env: ENV, option_parser: OptionParser.new, runner: MinitestRunner.new) ⇒ CLI
constructor
A new instance of CLI.
- #run(argv: ARGV) ⇒ Object
Constructor Details
#initialize(file_system: FileSystem.new, env: ENV, option_parser: OptionParser.new, runner: MinitestRunner.new) ⇒ CLI
Returns a new instance of CLI.
3 4 5 6 7 8 |
# File 'lib/mighty_test/cli.rb', line 3 def initialize(file_system: FileSystem.new, env: ENV, option_parser: OptionParser.new, runner: MinitestRunner.new) @file_system = file_system @env = env.to_h @option_parser = option_parser @runner = runner end |
Instance Method Details
#run(argv: ARGV) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mighty_test/cli.rb', line 10 def run(argv: ARGV) @path_args, @extra_args, @options = option_parser.parse(argv) if [:help] print_help elsif [:version] puts VERSION elsif [:watch] watch elsif path_args.grep(/.:\d+$/).any? run_test_by_line_number else run_tests_by_path end rescue Exception => e # rubocop:disable Lint/RescueException handle_exception(e) end |