cucumber-ci-environment 8.0.1 → 9.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b113a16cc3df5fa4c163edac4bed8dc9cc479b03d7bc873d0e35e551b17e133
|
4
|
+
data.tar.gz: b350572faa0a9f959d12dfbda6b3b323cf3d18e9a46635d813af29a808f6dd27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b094712321f9251fab4120c75ed7fd261e187cced6aea4ed0e5fffaf8703b9dc679f5b0a7eb9979c6ff66fe7d40427fface9b156940d2f6c120b9d2785948475
|
7
|
+
data.tar.gz: 71a3c6542c46d9064cc4f276378ca4c9296cbff2be31a7a6073bf78d36f74c88ef23affc4f941eedcd35ca25cc4bb1e155f27c83b87f86dd5e344010a9e8873c
|
@@ -17,8 +17,7 @@
|
|
17
17
|
"git": {
|
18
18
|
"remote": "${bamboo_planRepository_repositoryUrl}",
|
19
19
|
"revision": "${bamboo_planRepository_revision}",
|
20
|
-
"branch": "${bamboo_planRepository_branch}"
|
21
|
-
"tag": null
|
20
|
+
"branch": "${bamboo_planRepository_branch}"
|
22
21
|
}
|
23
22
|
},
|
24
23
|
{
|
@@ -61,8 +60,7 @@
|
|
61
60
|
"git": {
|
62
61
|
"remote": "${CF_COMMIT_URL/(.*)\\/commit.+$/\\1}.git",
|
63
62
|
"revision": "${CF_REVISION}",
|
64
|
-
"branch": "${CF_BRANCH}"
|
65
|
-
"tag": null
|
63
|
+
"branch": "${CF_BRANCH}"
|
66
64
|
}
|
67
65
|
},
|
68
66
|
{
|
@@ -72,8 +70,7 @@
|
|
72
70
|
"git": {
|
73
71
|
"remote": "${CI_PULL_REQUEST/(.*)\\/pull\\/\\d+/\\1.git}",
|
74
72
|
"revision": "${CI_COMMIT_ID}",
|
75
|
-
"branch": "${CI_BRANCH}"
|
76
|
-
"tag": null
|
73
|
+
"branch": "${CI_BRANCH}"
|
77
74
|
}
|
78
75
|
},
|
79
76
|
{
|
@@ -105,8 +102,7 @@
|
|
105
102
|
"git": {
|
106
103
|
"remote": "${GO_SCM_*_PR_URL/(.*)\\/pull\\/\\d+/\\1.git}",
|
107
104
|
"revision": "${GO_REVISION}",
|
108
|
-
"branch": "${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}"
|
109
|
-
"tag": null
|
105
|
+
"branch": "${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}"
|
110
106
|
}
|
111
107
|
},
|
112
108
|
{
|
@@ -116,8 +112,7 @@
|
|
116
112
|
"git": {
|
117
113
|
"remote": "${GIT_URL}",
|
118
114
|
"revision": "${GIT_COMMIT}",
|
119
|
-
"branch": "${GIT_LOCAL_BRANCH}"
|
120
|
-
"tag": null
|
115
|
+
"branch": "${GIT_LOCAL_BRANCH}"
|
121
116
|
}
|
122
117
|
},
|
123
118
|
{
|
@@ -149,8 +144,7 @@
|
|
149
144
|
"git": {
|
150
145
|
"remote": "https://${WERCKER_GIT_DOMAIN}/${WERCKER_GIT_OWNER}/${WERCKER_GIT_REPOSITORY}.git",
|
151
146
|
"revision": "${WERCKER_GIT_COMMIT}",
|
152
|
-
"branch": "${WERCKER_GIT_BRANCH}"
|
153
|
-
"tag": null
|
147
|
+
"branch": "${WERCKER_GIT_BRANCH}"
|
154
148
|
}
|
155
149
|
}
|
156
150
|
]
|
@@ -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, file_reader = IO.method(:read))
|
11
|
+
ci_environments = JSON.parse(file_reader.call(CI_ENVIRONMENTS_PATH))
|
12
12
|
ci_environments.each do |ci_environment|
|
13
|
-
detected = detect(ci_environment, env)
|
13
|
+
detected = detect(ci_environment, env, file_reader)
|
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, file_reader)
|
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, file_reader)
|
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 =
|
35
|
+
def detect_git(ci_environment, env, file_reader)
|
36
|
+
revision = detect_revision(ci_environment, env, file_reader)
|
37
37
|
return nil if revision.nil?
|
38
38
|
|
39
39
|
remote = evaluate(ci_environment['git']['remote'], env)
|
@@ -51,6 +51,17 @@ module Cucumber
|
|
51
51
|
git_info
|
52
52
|
end
|
53
53
|
|
54
|
+
def detect_revision(ci_environment, env, file_reader)
|
55
|
+
if env['GITHUB_EVENT_NAME'] == 'pull_request'
|
56
|
+
raise StandardError('GITHUB_EVENT_PATH not set') unless env['GITHUB_EVENT_PATH']
|
57
|
+
event = JSON.parse(file_reader.call(env['GITHUB_EVENT_PATH']))
|
58
|
+
raise StandardError('GITHUB_EVENT_PATH not set') unless event['before']
|
59
|
+
return event['before']
|
60
|
+
end
|
61
|
+
|
62
|
+
return evaluate(ci_environment['git']['revision'], env)
|
63
|
+
end
|
64
|
+
|
54
65
|
def remove_userinfo_from_url(value)
|
55
66
|
return nil if value.nil?
|
56
67
|
|
@@ -63,6 +74,6 @@ module Cucumber
|
|
63
74
|
end
|
64
75
|
end
|
65
76
|
|
66
|
-
module_function :detect_ci_environment, :detect, :detect_git, :remove_userinfo_from_url
|
77
|
+
module_function :detect_ci_environment, :detect, :detect_git, :detect_revision, :remove_userinfo_from_url
|
67
78
|
end
|
68
79
|
end
|
@@ -8,7 +8,12 @@ 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
|
-
|
11
|
+
def mock_reader(path)
|
12
|
+
return '{"before": "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)) }
|
12
17
|
let(:env) { Hash[entries] }
|
13
18
|
let(:entries) { env_data.split(/\n/).map { |line| line.split(/=/) } }
|
14
19
|
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:
|
4
|
+
version: 9.0.1
|
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:
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -36,20 +36,20 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '3.
|
39
|
+
version: '3.11'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.
|
42
|
+
version: 3.11.0
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '3.
|
49
|
+
version: '3.11'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 3.
|
52
|
+
version: 3.11.0
|
53
53
|
description: Detect CI Environment from environment variables
|
54
54
|
email: cukes@googlegroups.com
|
55
55
|
executables: []
|
@@ -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-
|
95
|
+
summary: cucumber-ci-environment-9.0.1
|
96
96
|
test_files:
|
97
97
|
- spec/capture_warnings.rb
|
98
98
|
- spec/cucumber/ci_environment/ci_environment_spec.rb
|