cucumber-ci-environment 9.0.2 → 9.0.3
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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb3770efbf64c848ff0784bc16b46bd1aac7310bb3543af9354eefaf934d590
|
4
|
+
data.tar.gz: 963b15c15a33c7b706b43bc3d7e83ca96b4dbe6d8562b3afc3a8909fceb0d4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6a3f4a3091dba40f37fe3f4831e9eaab18230750536770c891d657d14886ce651e440b136f9a731b2e20f7fb6d0878c92ce8fa6e98ccc2f2569e6e9b88e3b9
|
7
|
+
data.tar.gz: dafdfbf95a1e2a2283844256ddcbabde2c32edd8923c80e515d966e7e8f330f9e0e3a2ee9ef9ccd81cfc433fbc38dfd9c85653b78903dd09fca60238e6080863
|
@@ -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,7 +1,7 @@
|
|
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.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Prêtre
|
@@ -93,7 +93,7 @@ requirements: []
|
|
93
93
|
rubygems_version: 3.2.32
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
|
-
summary: cucumber-ci-environment-9.0.
|
96
|
+
summary: cucumber-ci-environment-9.0.3
|
97
97
|
test_files:
|
98
98
|
- spec/capture_warnings.rb
|
99
99
|
- spec/cucumber/ci_environment/ci_environment_spec.rb
|