knapsack_pro 5.2.0 → 5.3.0

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: f00531028caf0501edea4bf33df1bd81fe7ec9fbc888875797289f488e51851e
4
- data.tar.gz: dbe2e29cdb257ef772348653e40bcccc0ae4d70e8fc0fdd72fd26193784a60b7
3
+ metadata.gz: 8cce96343b30d782aa576d77ab957b9af2b767ff7896f6507bcf6d0fed5ad8ea
4
+ data.tar.gz: b1ff76bcc2c99420049e1a52d0f9715dfa8c208dc2dd5e35b1e56756982ef059
5
5
  SHA512:
6
- metadata.gz: 8ac1af3bf5eff25233ddb17294c56d9de6c9ec0d94c6412182a69ce2f4c04082eb705b0f204e42a342486c2001862171503d6726012421b336fe25c851e103c8
7
- data.tar.gz: 52d4b68c5793defaf162659597d63afa7461964c78e6b78385ffe21af5cdf529124a15c9d5d96f2ca7216e175daa8b9aa6d2b04698e23c59b2a71b6603b13318
6
+ metadata.gz: 70721672e47f388e2826baa88da884e596bc4784891ea5177e51584510579ce08f6297b853ac4c821c9e7d32861362587295a8e0ac1c5b290495df847f99acd9
7
+ data.tar.gz: 475fe2a76e55a56575ed8d81cb8534b8d0fd2d5df044b8dd0a35a8a98d0e9e89a0045645d23e550e6833d80b7bc4d0c526c11e7035dec06699eae7d4d6ab8efb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ### 5.3.0
4
+
5
+ * Perf: Send authors to the API only on the first request (for Queue Mode)
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.2.1...v5.3.0
8
+
9
+ ### 5.2.1
10
+
11
+ * Shallow fetch the last month of commits only on CI
12
+ * Ensure input to `git shortlog`
13
+
14
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/209
15
+
16
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.2.0...v5.2.1
17
+
3
18
  ### 5.2.0
4
19
 
5
20
  * Send authors to the API
@@ -17,13 +17,13 @@ module KnapsackPro
17
17
  :node_index => args.fetch(:node_index),
18
18
  :node_build_id => KnapsackPro::Config::Env.ci_node_build_id,
19
19
  :user_seat => KnapsackPro::Config::Env.masked_user_seat,
20
- :build_author => KnapsackPro::RepositoryAdapters::GitAdapter.new.build_author,
21
- :commit_authors => KnapsackPro::RepositoryAdapters::GitAdapter.new.commit_authors,
22
20
  }
23
21
 
24
22
  if request_hash[:can_initialize_queue] && !request_hash[:attempt_connect_to_queue]
25
23
  request_hash.merge!({
26
- :test_files => args.fetch(:test_files)
24
+ :test_files => args.fetch(:test_files),
25
+ :build_author => KnapsackPro::RepositoryAdapters::GitAdapter.new.build_author,
26
+ :commit_authors => KnapsackPro::RepositoryAdapters::GitAdapter.new.commit_authors,
27
27
  })
28
28
  end
29
29
 
@@ -285,6 +285,11 @@ module KnapsackPro
285
285
  ENV['KNAPSACK_PRO_TEST_RUNNER_ADAPTER'] = adapter_class.to_s.split('::').last
286
286
  end
287
287
 
288
+ def ci?
289
+ ENV.fetch('CI', 'false').downcase == 'true' ||
290
+ detected_ci != KnapsackPro::Config::CI::Base
291
+ end
292
+
288
293
  private
289
294
 
290
295
  def required_env(env_name)
@@ -41,7 +41,11 @@ module KnapsackPro
41
41
  private
42
42
 
43
43
  def git_commit_authors
44
- `git fetch --shallow-since "1 month ago" >/dev/null 2>&1 && git shortlog --summary --email --since "one month ago"`
44
+ if KnapsackPro::Config::Env.ci?
45
+ `git fetch --shallow-since "one month ago" --quiet`
46
+ end
47
+
48
+ `git log --since "one month ago" | git shortlog --summary --email`
45
49
  end
46
50
 
47
51
  def git_build_author
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '5.2.0'
2
+ VERSION = '5.3.0'
3
3
  end
@@ -53,6 +53,16 @@ describe KnapsackPro::Client::API::V1::Queues do
53
53
  ).and_return(action)
54
54
  expect(subject).to eq action
55
55
  end
56
+
57
+ it "sends authors" do
58
+ action = double
59
+
60
+ expect(KnapsackPro::Client::API::Action).to receive(:new).with(
61
+ hash_including(request_hash: hash_including(:build_author, :commit_authors))
62
+ ).and_return(action)
63
+
64
+ expect(subject).to eq action
65
+ end
56
66
  end
57
67
 
58
68
  context 'when can_initialize_queue=false and attempt_connect_to_queue=false' do
@@ -67,15 +77,5 @@ describe KnapsackPro::Client::API::V1::Queues do
67
77
  expect(subject).to eq action
68
78
  end
69
79
  end
70
-
71
- it "sends authors" do
72
- action = double
73
-
74
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
75
- hash_including(request_hash: hash_including(:build_author, :commit_authors))
76
- ).and_return(action)
77
-
78
- expect(subject).to eq action
79
- end
80
80
  end
81
81
  end
@@ -1041,4 +1041,18 @@ describe KnapsackPro::Config::Env do
1041
1041
  end
1042
1042
  end
1043
1043
  end
1044
+
1045
+ describe '.ci?' do
1046
+ [
1047
+ ['CI from env', { 'CI' => 'True' }, true],
1048
+ ['Travis CI', { 'TRAVIS' => 'true' }, true],
1049
+ ['Unsupported', {}, false],
1050
+ ].each do |ci, env, expected|
1051
+ it "detects #{ci}" do
1052
+ stub_const("ENV", env)
1053
+
1054
+ expect(described_class.ci?).to eq(expected)
1055
+ end
1056
+ end
1057
+ end
1044
1058
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake