Class: Selective::Ruby::Core::FileCorrelator
- Inherits:
-
Object
- Object
- Selective::Ruby::Core::FileCorrelator
- Includes:
- Helper
- Defined in:
- lib/selective/ruby/core/file_correlator.rb
Defined Under Namespace
Classes: FileCorrelatorError
Constant Summary collapse
- FILE_CORRELATION_COLLECTOR_PATH =
File.join(ROOT_GEM_PATH, "lib", "bin", "file_correlation_collector.sh")
Instance Method Summary collapse
- #correlate ⇒ Object
-
#initialize(diff, num_commits, target_branch) ⇒ FileCorrelator
constructor
A new instance of FileCorrelator.
Methods included from Helper
#banner, banner, #print_notice, #print_warning, #puts_indented, #safe_filename, #with_error_handling
Constructor Details
#initialize(diff, num_commits, target_branch) ⇒ FileCorrelator
Returns a new instance of FileCorrelator.
11 12 13 14 15 |
# File 'lib/selective/ruby/core/file_correlator.rb', line 11 def initialize(diff, num_commits, target_branch) @diff = diff.reject {|f| f =~ /^spec\// } @num_commits = num_commits @target_branch = target_branch end |
Instance Method Details
#correlate ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/selective/ruby/core/file_correlator.rb', line 17 def correlate JSON.parse(, symbolize_names: true) rescue FileCorrelatorError, JSON::ParserError print_warning(" Selective was unable to correlate the diff to test files. This may result in a sub-optimal test order.\n If the issue persists, please contact support.\n MSG\nend\n") |