cucumber-ci-environment 7.0.1 → 8.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cucumber/ci_environment.rb +23 -10
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08f1292f1769293e6a36074f11d1561867548ea7ab0b022a79a2fb8b498fb216'
4
- data.tar.gz: 62e9581ab78df2ce86fa985e8707f2ab917b6bbe749ea5f37d30c39584dae175
3
+ metadata.gz: e953601361857424a8c088e9d46d318b885bea345f7513582079e2656eb9488a
4
+ data.tar.gz: 90d645ec2692732c3db88dbb69d88a6161295bfa2786e102b32979df74124732
5
5
  SHA512:
6
- metadata.gz: 4431d3d58c2765b18dedd19a923da52a8ddc14cc357c88b6d0aae02bda31fbd78bdf868144cd04fd12f0ccc47766ca3a75e8957aed45d8ef352ba27a1beae613
7
- data.tar.gz: '09d0faa39b92ebe95301e16c30b3bce2a03ed11cc94458b789a4be2e087d060bfa963428f2990472cfda27fc6ac9c6dbc5585c7906e5638537236e93f0346b60'
6
+ metadata.gz: 70e3661abfbc7c13dde7c43d9b15b7be8daf92165263d95b3ab04ff16be6c9ccbab29245c10040a59e26f8e4963b7bc016cd6701086e2805609c75e1ef5bc6ca
7
+ data.tar.gz: bb0c563b51adff06ab7707f7613de586e893585d270af4ab5050be20ddc2e8d84877b3c7798465e4f91372c106e95c83ad12613f20a33609d79349476085590d
@@ -23,19 +23,32 @@ module Cucumber
23
23
  name: ci_environment['name'],
24
24
  url: url,
25
25
  buildNumber: evaluate(ci_environment['buildNumber'], env),
26
- git: {
27
- remote: remove_userinfo_from_url(evaluate(ci_environment['git']['remote'], env)),
28
- revision: evaluate(ci_environment['git']['revision'], env),
29
- branch: evaluate(ci_environment['git']['branch'], env),
30
- }
31
26
  }
32
- tag = evaluate(ci_environment['git']['tag'], env)
33
- if tag
34
- result[:git][:tag] = tag
35
- end
27
+
28
+ detected_git = detect_git(ci_environment, env)
29
+ result[:git] = detected_git if detected_git
36
30
  result
37
31
  end
38
32
 
33
+ def detect_git(ci_environment, env)
34
+ revision = evaluate(ci_environment['git']['revision'], env)
35
+ return nil if revision.nil?
36
+
37
+ remote = evaluate(ci_environment['git']['remote'], env)
38
+ return nil if remote.nil?
39
+
40
+ git_info = {
41
+ remote: remove_userinfo_from_url(remote),
42
+ revision: revision,
43
+ }
44
+
45
+ tag = evaluate(ci_environment['git']['tag'], env)
46
+ branch = evaluate(ci_environment['git']['branch'], env)
47
+ git_info[:tag] = tag if tag
48
+ git_info[:branch] = branch if branch
49
+ git_info
50
+ end
51
+
39
52
  def remove_userinfo_from_url(value)
40
53
  return nil if value.nil?
41
54
 
@@ -48,6 +61,6 @@ module Cucumber
48
61
  end
49
62
  end
50
63
 
51
- module_function :detect_ci_environment, :detect, :remove_userinfo_from_url
64
+ module_function :detect_ci_environment, :detect, :detect_git, :remove_userinfo_from_url
52
65
  end
53
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-ci-environment
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Prêtre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-08 00:00:00.000000000 Z
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -92,7 +92,7 @@ requirements: []
92
92
  rubygems_version: 3.2.32
93
93
  signing_key:
94
94
  specification_version: 4
95
- summary: cucumber-ci-environment-7.0.1
95
+ summary: cucumber-ci-environment-8.0.0
96
96
  test_files:
97
97
  - spec/capture_warnings.rb
98
98
  - spec/cucumber/ci_environment/ci_environment_spec.rb