Class: TestSuiteSplitter::Cli
- Inherits:
-
Object
- Object
- TestSuiteSplitter::Cli
- Defined in:
- lib/test_suite_splitter/cli.rb
Constant Summary collapse
- DEFAULT_LOG_FILE_PATH =
"log/test_suite_splitter.log".freeze
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #execute_rspec_command ⇒ Object
- #execute_splitter_command ⇒ Object
- #group_file_paths ⇒ Object
-
#initialize(argv:, stderr: $stderr, stdout: $stdout) ⇒ Cli
constructor
A new instance of Cli.
Constructor Details
#initialize(argv:, stderr: $stderr, stdout: $stdout) ⇒ Cli
Returns a new instance of Cli.
6 7 8 9 10 |
# File 'lib/test_suite_splitter/cli.rb', line 6 def initialize(argv:, stderr: $stderr, stdout: $stdout) @argv = argv @stderr = stderr @stdout = stdout end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
4 5 6 |
# File 'lib/test_suite_splitter/cli.rb', line 4 def argv @argv end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
4 5 6 |
# File 'lib/test_suite_splitter/cli.rb', line 4 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
4 5 6 |
# File 'lib/test_suite_splitter/cli.rb', line 4 def stdout @stdout end |
Instance Method Details
#execute_rspec_command ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/test_suite_splitter/cli.rb', line 19 def execute_rspec_command files = group_file_paths if files.empty? print_output("No files from test_suite_splitter - skipping shard") return 0 end require "rspec/core" RSpec::Core::Runner.run(rspec_arguments + files, stderr, stdout) rescue StandardError => e handle_error(e) end |
#execute_splitter_command ⇒ Object
12 13 14 15 16 17 |
# File 'lib/test_suite_splitter/cli.rb', line 12 def execute_splitter_command print_output(group_file_paths.join(" ")) 0 rescue StandardError => e handle_error(e) end |
#group_file_paths ⇒ Object
34 35 36 |
# File 'lib/test_suite_splitter/cli.rb', line 34 def group_file_paths rspec_helper.group_files.map { |group_file| group_file.fetch(:path) } end |