knapsack_pro 8.0.1 → 8.0.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: cc4bed2e7600e26f350d8f1847550aaea7be38b032a029a589e6082dbb31b31c
4
- data.tar.gz: 2a66e48a7ccb7be83a553a2746611ce5addeac2114aa469c75f6a6faa3ee70a3
3
+ metadata.gz: 6135451be036cbd75b78cb5efd31498b91b08698771c78c69dfa7b2b1d218faa
4
+ data.tar.gz: bd73f2525bc9b89c5faca60bf95249d06e525fb533422b8e98399b03dcf732bf
5
5
  SHA512:
6
- metadata.gz: cca2870484c23ce7aed1ab44b43a8ba4c862d37c2c9a29ec54b627433fef05cb43f0126a611e888ffb0a5cbc8fe13e01f7b97dd7c61b64404771a0a2c190db70
7
- data.tar.gz: 6db4e20ea3aaa81b1467971435688667004576402bb9f686a0287f3c54d82dab84c1271ef78605e46d5d4050e634cc3d8e229dffd81a3d8646e3eb81b68eebad
6
+ metadata.gz: 3cca977135a8795f725cd2ee73ae5c8af2df313db76892a9e29e283fc788f0c7479dff1e8aed532fb43a1ac56cb4582200dda0af1e953426c571fb177eb2ad2f
7
+ data.tar.gz: 00bb2a047303b2e11eb06f1f0f358dd209a1d98cb01657b4c8144a7f137efc5cb7aa44e736e6f4925642975afb83b576c2e9a0039233b389a196180ca0a194d3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ### Unreleased
4
+
5
+ ### 8.0.2
6
+
7
+ * (patch) Semaphore: Detect the correct branch name in the context of a PR
8
+ * (patch) Semaphore: Detect user seat (committer)
9
+
10
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/294
11
+
12
+ * (patch) RSpec: Use the same regex when parsing file path and id path
13
+
14
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/291
15
+
16
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v8.0.1...v8.0.2
17
+
3
18
  ### 8.0.1
4
19
 
5
20
  * Fix detection of id paths for Turnip, which resulted in sending to the API both file and id paths timings
@@ -7,7 +7,7 @@ module KnapsackPro
7
7
  class RSpecAdapter < BaseAdapter
8
8
  TEST_DIR_PATTERN = 'spec/**{,/*/**}/*_spec.rb'
9
9
  # https://github.com/rspec/rspec/blob/86b5e4218eece4c1913fe9aad24c0a96d8bc9f40/rspec-core/lib/rspec/core/example.rb#L122
10
- REGEX = /^(.*?)(?:\[([\d\s:,]+)\])?$/.freeze
10
+ REGEX = /\A(.*?)(?:\[([\d\s:,]+)\])?\z/.freeze
11
11
 
12
12
  def self.split_by_test_cases_enabled?
13
13
  return false unless KnapsackPro::Config::Env.rspec_split_by_test_examples?
@@ -76,9 +76,9 @@ module KnapsackPro
76
76
  return ''
77
77
  end
78
78
 
79
- def self.parse_file_path(id)
80
- # https://github.com/rspec/rspec-core/blob/1eeadce5aa7137ead054783c31ff35cbfe9d07cc/lib/rspec/core/example.rb#L122
81
- id.match(/\A(.*?)(?:\[([\d\s:,]+)\])?\z/).captures.first
79
+ def self.parse_file_path(path)
80
+ file, _id = path.match(REGEX).captures
81
+ file
82
82
  end
83
83
 
84
84
  def self.id_path?(path)
@@ -23,7 +23,8 @@ module KnapsackPro
23
23
  end
24
24
 
25
25
  def branch
26
- ENV['SEMAPHORE_GIT_BRANCH']
26
+ ENV['SEMAPHORE_GIT_WORKING_BRANCH'] || # nil when workflow is triggered by pushing a Git tag
27
+ ENV['SEMAPHORE_GIT_BRANCH']
27
28
  end
28
29
 
29
30
  def project_dir
@@ -33,7 +34,7 @@ module KnapsackPro
33
34
  end
34
35
 
35
36
  def user_seat
36
- # not provided
37
+ ENV['SEMAPHORE_GIT_COMMITTER']
37
38
  end
38
39
 
39
40
  def detected
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KnapsackPro
4
- VERSION = '8.0.1'
4
+ VERSION = '8.0.2'
5
5
  end
@@ -62,12 +62,22 @@ describe KnapsackPro::Config::CI::Semaphore2 do
62
62
  describe '#branch' do
63
63
  subject { described_class.new.branch }
64
64
 
65
- context 'when the environment exists' do
65
+ context 'when SEMAPHORE_GIT_WORKING_BRANCH is set' do
66
+ let(:env) { { 'SEMAPHORE_GIT_WORKING_BRANCH' => 'feature' } }
67
+ it { should eql 'feature' }
68
+ end
69
+
70
+ context 'when both SEMAPHORE_GIT_WORKING_BRANCH and SEMAPHORE_GIT_BRANCH are set' do
71
+ let(:env) { { 'SEMAPHORE_GIT_WORKING_BRANCH' => 'feature', 'SEMAPHORE_GIT_BRANCH' => 'master' } }
72
+ it { should eql 'feature' }
73
+ end
74
+
75
+ context 'when SEMAPHORE_GIT_BRANCH is set' do
66
76
  let(:env) { { 'SEMAPHORE_GIT_BRANCH' => 'master' } }
67
77
  it { should eql 'master' }
68
78
  end
69
79
 
70
- context "when the environment doesn't exist" do
80
+ context "when no ENVs are set" do
71
81
  it { should be nil }
72
82
  end
73
83
  end
@@ -107,4 +117,17 @@ describe KnapsackPro::Config::CI::Semaphore2 do
107
117
  it { should be nil }
108
118
  end
109
119
  end
120
+
121
+ describe '#user_seat' do
122
+ subject { described_class.new.user_seat }
123
+
124
+ context 'when SEMAPHORE_GIT_COMMITTER is set' do
125
+ let(:env) { { 'SEMAPHORE_GIT_COMMITTER' => 'jane_doe' } }
126
+ it { should eql 'jane_doe' }
127
+ end
128
+
129
+ context "when no ENVs are set" do
130
+ it { should be nil }
131
+ end
132
+ end
110
133
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-06 00:00:00.000000000 Z
10
+ date: 2025-03-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake