Class: TestLauncher::CLI::InputParser
- Inherits:
-
Object
- Object
- TestLauncher::CLI::InputParser
- Defined in:
- lib/test_launcher/cli/input_parser.rb
Constant Summary collapse
- ParseError =
Class.new(RuntimeError)
- BANNER =
"Find tests and run them by trying to match an individual test or the name of a test file(s).\n\nSee full README: https://github.com/petekinnecom/test_launcher\n\nUsage: `test_launcher \"search string\" [--all]`\n\nVERSION: \#{TestLauncher::VERSION}\n\n"
Instance Method Summary collapse
-
#initialize(args, env) ⇒ InputParser
constructor
A new instance of InputParser.
- #options ⇒ Object
- #requests(shell:, searcher:) ⇒ Object
Constructor Details
#initialize(args, env) ⇒ InputParser
Returns a new instance of InputParser.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/test_launcher/cli/input_parser.rb', line 26 def initialize(args, env) @search_string = args @env = env = {} option_parser.parse!(args) rescue OptionParser::ParseError puts "Invalid arguments" puts "----" puts option_parser exit end |
Instance Method Details
#options ⇒ Object
68 69 70 |
# File 'lib/test_launcher/cli/input_parser.rb', line 68 def end |
#requests(shell:, searcher:) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/test_launcher/cli/input_parser.rb', line 38 def requests(shell:, searcher:) if @search_string.size == 0 puts option_parser exit end frameworks = if [:framework] == "rspec" [Frameworks::RSpec] elsif [:framework] == "minitest" [Frameworks::Minitest] elsif [:framework] == "ex_unit" [Frameworks::ExUnit] else [Frameworks::Minitest, Frameworks::RSpec, Frameworks::ExUnit] end frameworks.map {|framework| Request.new( search_string: @search_string.join(" "), run_all: !![:run_all], disable_spring: !!@env["DISABLE_SPRING"], example_name: [:name], framework: framework, shell: shell, searcher: searcher ) } end |