flakey_spec_catcher 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc06031fb90bd9c4c2c6fa24adba0ae0cf1258a59a1e0da987c8c1d8ab55fb40
4
- data.tar.gz: 0f57f9915d914fd6beef160a48a15fa1506f6eb227c02c9494e289d2b1777f98
3
+ metadata.gz: 924bcd5b7fe71399bc43663478b9b238731e9920e4fcc8c54ba8977a345ee065
4
+ data.tar.gz: '080682849736c9d46acd6eeeb8ccc8e98115fb9558004e821f4beed33dfd455e'
5
5
  SHA512:
6
- metadata.gz: c8b176b42027dd46fd4babcf98920558d42fa21a59e396cf1874758552def055d7a02fce1a4fecf02f4f312e8be79401d978816f83b58f7b59ec82b2cde1875e
7
- data.tar.gz: 6883e6f623ef3d94d9eca75d78eae51086111358a1e0951a4c44ebb989e8661650f0203f408f3b22cbe99758eea4b7fb8a0927b872abedc179f88d8a35d4b799
6
+ metadata.gz: 68cf5c4b41ae6b158a501bab2a6134a40dd1d0ca3d7ce26452948b986ddf713d443458643d2a27a8ff565b9856c647867630015c78dc2f9e7784bf31b0d772e4
7
+ data.tar.gz: cee42fcbf243eaa03e56745491515ae7580e2e7974d751faef5f2387c40f07cb20b9f225d188e04009950b7cfd339720e406b789f4e7fa2ec537c2c109b81c18
@@ -7,12 +7,13 @@ module FlakeySpecCatcher
7
7
  #
8
8
  # Captures command line arguments for manual re-runs
9
9
  class CliOverride
10
- attr_reader :rerun_patterns, :rerun_usage, :repeat_factor, :enable_runs, :excluded_tags
10
+ attr_reader :rerun_patterns, :rerun_usage, :repeat_factor, :enable_runs, :excluded_tags, :use_parent
11
11
  attr_reader :output_file
12
12
 
13
13
  def initialize
14
14
  @enable_runs = true
15
15
  @excluded_tags = []
16
+ @use_parent = false
16
17
  parse_command_line_args
17
18
  end
18
19
 
@@ -23,6 +24,11 @@ module FlakeySpecCatcher
23
24
  OptionParser.new do |opts|
24
25
  opts.banner = 'Usage: flakey_spec_catcher [OPTIONS]'
25
26
 
27
+ opts.on('--use-parent',
28
+ 'Use the parent of commit for git diff instead of the Head of SCM') do
29
+ @use_parent = true
30
+ end
31
+
26
32
  opts.on('-t', '--test=TEST_NAME',
27
33
  'Specify one or more specs in comma separated list ' \
28
34
  'as `<path/to/file:line_number>, <path/to/file:line_number>...`') do |test|
@@ -19,7 +19,10 @@ module FlakeySpecCatcher
19
19
  attr_reader :branch, :remote, :working_commit_sha, :base_commit_sha, :git_comparison
20
20
  attr_reader :capsule_manager
21
21
 
22
- def initialize(test_mode: false, capsule_manager: FlakeySpecCatcher::CapsuleManager.new)
22
+ def initialize(test_mode: false, capsule_manager: FlakeySpecCatcher::CapsuleManager.new,
23
+ user_config: FlakeySpecCatcher::UserConfig.new)
24
+
25
+ @user_config = user_config
23
26
  @remote = find_git_remote
24
27
  @branch = find_remote_branch
25
28
  @capsule_manager = capsule_manager
@@ -36,7 +39,9 @@ module FlakeySpecCatcher
36
39
 
37
40
  # Use 'origin' unless otherwise specified
38
41
  def find_git_remote
39
- if ENV['FSC_GIT_REMOTE'].nil? || ENV['FSC_GIT_REMOTE'].strip.empty?
42
+ if @user_config.use_parent
43
+ nil
44
+ elsif ENV.fetch('FSC_GIT_REMOTE', '').empty?
40
45
  remotes = `git remote show`.split
41
46
  remotes.empty? ? nil : remotes[0]
42
47
  else
@@ -13,8 +13,8 @@ module FlakeySpecCatcher
13
13
  attr_reader :user_config, :rerun_manager, :git_controller
14
14
 
15
15
  def initialize(test_mode: false,
16
- git_controller: FlakeySpecCatcher::GitController.new(test_mode: test_mode),
17
16
  user_config: FlakeySpecCatcher::UserConfig.new,
17
+ git_controller: FlakeySpecCatcher::GitController.new(test_mode: test_mode, user_config: user_config),
18
18
  result_manager: FlakeySpecCatcher::RspecResultManager.new(FlakeySpecCatcher::RspecResult),
19
19
  rerun_manager: FlakeySpecCatcher::RerunManager.new(git_controller: git_controller,
20
20
  user_config: user_config))
@@ -29,8 +29,8 @@ module FlakeySpecCatcher
29
29
  # rubocop:disable Metrics/AbcSize
30
30
  def show_settings
31
31
  puts 'Flakey Spec Catcher Settings:'
32
- puts " Current Branch: #{@git_controller.branch}"
33
- puts " Remote: #{@git_controller.remote}"
32
+ puts " Current Branch: #{@git_controller.branch}" unless @user_config.use_parent
33
+ puts " Remote: #{@git_controller.remote}" unless @user_config.use_parent
34
34
  puts " Current Sha: #{@git_controller.working_commit_sha}"
35
35
  puts " Base Sha: #{@git_controller.base_commit_sha}"
36
36
  puts " Repeat factor: #{@user_config.repeat_factor}"
@@ -10,7 +10,7 @@ module FlakeySpecCatcher
10
10
  attr_reader :repeat_factor, :ignore_files, :ignore_branches, :silent_mode
11
11
  attr_reader :rerun_file_only, :rspec_usage_patterns, :excluded_tags
12
12
  attr_reader :manual_rerun_patterns, :manual_rerun_usage
13
- attr_reader :enable_runs, :output_file
13
+ attr_reader :enable_runs, :output_file, :use_parent
14
14
 
15
15
  USER_CONFIG_ENV_VARS = %w[FSC_REPEAT_FACTOR FSC_IGNORE_FILES FSC_IGNORE_BRANCHES
16
16
  FSC_SILENT_MODE FSC_RERUN_FILE_ONLY FSC_USAGE_PATTERNS
@@ -47,6 +47,7 @@ module FlakeySpecCatcher
47
47
  def apply_cli_override
48
48
  @manual_rerun_patterns = @cli_override.rerun_patterns
49
49
  @manual_rerun_usage = @cli_override.rerun_usage
50
+ @use_parent = @cli_override.use_parent
50
51
  @repeat_factor = @cli_override.repeat_factor if @cli_override.repeat_factor.to_i.positive?
51
52
  @enable_runs = @cli_override.enable_runs
52
53
  @excluded_tags = if @cli_override.excluded_tags.empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FlakeySpecCatcher
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flakey_spec_catcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Watson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-02-12 00:00:00.000000000 Z
13
+ date: 2020-02-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.1.2
125
+ rubygems_version: 3.0.4
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Run new or changed specs many times to prevent unreliable specs