cucumber-ci-environment 9.0.2 → 9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cucumber/ci_environment.rb +12 -11
- data/spec/cucumber/ci_environment/ci_environment_spec.rb +1 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def09edbd232a904d08ad1a5dc9e295a305d6129f0bac041ccb808781f8b5cb8
|
4
|
+
data.tar.gz: 6fd599a8e1ca5720d2a6d080e4ad98577681b2026e515e27c3629ea4c0d3ac02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a9980b1bae64dc2e9060eecb9b9eec00cd6046698ba6938074538429ea723c48badfab2e86495c599aee802fe80663777882fea4ccc7497cb0c7db29dc00a4b
|
7
|
+
data.tar.gz: bc6dc4f507b476eb7e278f9dec8b3c43487aa2463f1b8903b0c91fe886f4069b02e9996fbe1518c3c466210c3774b2dff9570b7bf26bc360e748f77bf70f8375
|
@@ -7,17 +7,17 @@ module Cucumber
|
|
7
7
|
extend VariableExpression
|
8
8
|
CI_ENVIRONMENTS_PATH = File.join(File.dirname(__FILE__), 'ci_environment/CiEnvironments.json')
|
9
9
|
|
10
|
-
def detect_ci_environment(env
|
11
|
-
ci_environments = JSON.parse(
|
10
|
+
def detect_ci_environment(env)
|
11
|
+
ci_environments = JSON.parse(IO.read(CI_ENVIRONMENTS_PATH))
|
12
12
|
ci_environments.each do |ci_environment|
|
13
|
-
detected = detect(ci_environment, env
|
13
|
+
detected = detect(ci_environment, env)
|
14
14
|
return detected unless detected.nil?
|
15
15
|
end
|
16
16
|
|
17
17
|
nil
|
18
18
|
end
|
19
19
|
|
20
|
-
def detect(ci_environment, env
|
20
|
+
def detect(ci_environment, env)
|
21
21
|
url = evaluate(ci_environment['url'], env)
|
22
22
|
return nil if url.nil?
|
23
23
|
|
@@ -27,13 +27,13 @@ module Cucumber
|
|
27
27
|
buildNumber: evaluate(ci_environment['buildNumber'], env),
|
28
28
|
}
|
29
29
|
|
30
|
-
detected_git = detect_git(ci_environment, env
|
30
|
+
detected_git = detect_git(ci_environment, env)
|
31
31
|
result[:git] = detected_git if detected_git
|
32
32
|
result
|
33
33
|
end
|
34
34
|
|
35
|
-
def detect_git(ci_environment, env
|
36
|
-
revision = detect_revision(ci_environment, env
|
35
|
+
def detect_git(ci_environment, env)
|
36
|
+
revision = detect_revision(ci_environment, env)
|
37
37
|
return nil if revision.nil?
|
38
38
|
|
39
39
|
remote = evaluate(ci_environment['git']['remote'], env)
|
@@ -51,12 +51,13 @@ module Cucumber
|
|
51
51
|
git_info
|
52
52
|
end
|
53
53
|
|
54
|
-
def detect_revision(ci_environment, env
|
54
|
+
def detect_revision(ci_environment, env)
|
55
55
|
if env['GITHUB_EVENT_NAME'] == 'pull_request'
|
56
56
|
raise StandardError('GITHUB_EVENT_PATH not set') unless env['GITHUB_EVENT_PATH']
|
57
|
-
event = JSON.parse(
|
58
|
-
|
59
|
-
|
57
|
+
event = JSON.parse(IO.read(env['GITHUB_EVENT_PATH']))
|
58
|
+
revision = event['pull_request']['head']['sha'] rescue nil
|
59
|
+
raise StandardError("Could not find .pull_request.head.sha in #{env['GITHUB_EVENT_PATH']}:\n#{JSON.pretty_generate(event)}") if revision.nil?
|
60
|
+
return revision
|
60
61
|
end
|
61
62
|
|
62
63
|
return evaluate(ci_environment['git']['revision'], env)
|
@@ -8,12 +8,7 @@ describe 'detect_ci_environment' do
|
|
8
8
|
context "with #{File.basename(test_data_file, '.txt')}" do
|
9
9
|
subject { JSON.parse(ci_environment.to_json) }
|
10
10
|
|
11
|
-
|
12
|
-
return '{"after": "2436f28fad432a895bfc595bce16e907144b0dc3"}' if path.end_with?('_github_workflow/event.json')
|
13
|
-
IO.read(path)
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:ci_environment) { Cucumber::CiEnvironment.detect_ci_environment(env, method(:mock_reader)) }
|
11
|
+
let(:ci_environment) { Cucumber::CiEnvironment.detect_ci_environment(env) }
|
17
12
|
let(:env) { Hash[entries] }
|
18
13
|
let(:entries) { env_data.split(/\n/).map { |line| line.split(/=/) } }
|
19
14
|
let(:env_data) { IO.read(test_data_file) }
|
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: 9.0
|
4
|
+
version: 9.1.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: 2022-
|
11
|
+
date: 2022-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -90,10 +90,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.2.
|
93
|
+
rubygems_version: 3.2.33
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
|
-
summary: cucumber-ci-environment-9.0
|
96
|
+
summary: cucumber-ci-environment-9.1.0
|
97
97
|
test_files:
|
98
98
|
- spec/capture_warnings.rb
|
99
99
|
- spec/cucumber/ci_environment/ci_environment_spec.rb
|