cucumber-create-meta 5.0.0 → 6.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/create_meta.rb +31 -30
- data/spec/acceptance/create_meta_spec.rb +25 -0
- data/spec/cucumber/create_meta_spec.rb +29 -9
- metadata +17 -16
- data/lib/cucumber/ciDict.json +0 -137
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 683fb4b95e55fbb4f6ff2416f93caf823c8c1ceb64c00025c875ea8b6b935cd7
|
4
|
+
data.tar.gz: 7ee13b6e2bfbd50f40abbb8d2507f042cd2d0bad82653eb7309e8d56f469da01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c05e86d15d9b4e46e791044b64cb8a0f76c4fd7fea563e4448b35b2d9d842e4764e47f15d8c396aa4e9d19c3e77a5ab4515d4b3df0fe552edae34593cb69d3b
|
7
|
+
data.tar.gz: 463c982c9731b39cf1ea15e20d29bcbfbf14187e09505b8f7b6bbb440adca1e47c20401686f2e301d4868a632094f0640d9b316f83e8eda9e1dbb87f808a393a
|
data/lib/cucumber/create_meta.rb
CHANGED
@@ -7,28 +7,28 @@ require 'cucumber/create_meta/variable_expression'
|
|
7
7
|
module Cucumber
|
8
8
|
module CreateMeta
|
9
9
|
extend Cucumber::CreateMeta::VariableExpression
|
10
|
-
CI_DICT = JSON.parse(IO.read(File.join(File.dirname(__FILE__),
|
10
|
+
CI_DICT = JSON.parse(IO.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'ciDict.json')))
|
11
11
|
|
12
12
|
def create_meta(tool_name, tool_version, env = ENV)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
Cucumber::Messages::Meta.new(
|
14
|
+
protocol_version: Cucumber::Messages::VERSION,
|
15
|
+
implementation: Cucumber::Messages::Product.new(
|
16
|
+
name: tool_name,
|
17
|
+
version: tool_version
|
18
|
+
),
|
19
|
+
runtime: Cucumber::Messages::Product.new(
|
20
|
+
name: RUBY_ENGINE,
|
21
|
+
version: RUBY_VERSION
|
22
|
+
),
|
23
|
+
os: Cucumber::Messages::Product.new(
|
24
|
+
name: RbConfig::CONFIG['target_os'],
|
25
|
+
version: Sys::Uname.uname.version
|
26
|
+
),
|
27
|
+
cpu: Cucumber::Messages::Product.new(
|
28
|
+
name: RbConfig::CONFIG['target_cpu']
|
29
|
+
),
|
30
|
+
ci: detect_ci(env)
|
31
|
+
)
|
32
32
|
end
|
33
33
|
|
34
34
|
def detect_ci(env)
|
@@ -43,16 +43,17 @@ module Cucumber
|
|
43
43
|
url = evaluate(ci_system['url'], env)
|
44
44
|
return nil if url.nil?
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
Cucumber::Messages::Ci.new(
|
47
|
+
url: url,
|
48
|
+
name: ci_name,
|
49
|
+
build_number: evaluate(ci_system['buildNumber'], env),
|
50
|
+
git: Cucumber::Messages::Git.new(
|
51
|
+
remote: remove_userinfo_from_url(evaluate(ci_system['git']['remote'], env)),
|
52
|
+
revision: evaluate(ci_system['git']['revision'], env),
|
53
|
+
branch: evaluate(ci_system['git']['branch'], env),
|
54
|
+
tag: evaluate(ci_system['git']['tag'], env),
|
55
|
+
)
|
56
|
+
)
|
56
57
|
end
|
57
58
|
|
58
59
|
def remove_userinfo_from_url(value)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cucumber/create_meta'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
TEST_DATA_DIR = '../testdata'
|
7
|
+
|
8
|
+
describe 'CreateMeta' do
|
9
|
+
Dir.each_child(TEST_DATA_DIR) do |test_data_file|
|
10
|
+
next unless File.extname(test_data_file) == '.txt'
|
11
|
+
|
12
|
+
context "with #{File.basename(test_data_file, '.*')}" do
|
13
|
+
subject { JSON.parse(meta.ci.to_json) }
|
14
|
+
|
15
|
+
let(:meta) { Cucumber::CreateMeta.create_meta('cucumber-something', '1.2.3', env) }
|
16
|
+
let(:env) { Hash[entries] }
|
17
|
+
let(:entries) { env_data.split(/\n/).map { |line| line.split(/=/) } }
|
18
|
+
let(:env_data) { IO.read("#{TEST_DATA_DIR}/#{test_data_file}") }
|
19
|
+
|
20
|
+
let(:expected_json) { File.read("#{TEST_DATA_DIR}/#{test_data_file}.json") }
|
21
|
+
|
22
|
+
it { is_expected.to eq JSON.parse(expected_json) }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,15 +2,35 @@ require 'cucumber/create_meta'
|
|
2
2
|
|
3
3
|
describe 'create_meta' do
|
4
4
|
it 'generates a Meta message with platform information' do
|
5
|
-
meta = Cucumber::CreateMeta.create_meta('cucumba-ruby', 'X.Y.Z')
|
5
|
+
meta = Cucumber::CreateMeta.create_meta('cucumba-ruby', 'X.Y.Z', [])
|
6
6
|
|
7
|
-
expect(meta
|
8
|
-
expect(meta
|
9
|
-
expect(meta
|
10
|
-
expect(meta
|
11
|
-
expect(meta
|
12
|
-
expect(meta
|
13
|
-
expect(meta
|
14
|
-
expect(meta
|
7
|
+
expect(meta.protocol_version).to match(/\d+\.\d+\.\d+/)
|
8
|
+
expect(meta.implementation.name).to eq('cucumba-ruby')
|
9
|
+
expect(meta.implementation.version).to eq('X.Y.Z')
|
10
|
+
expect(meta.runtime.name).to match(/(jruby|ruby)/)
|
11
|
+
expect(meta.runtime.version).to eq(RUBY_VERSION)
|
12
|
+
expect(meta.os.name).to match(/.+/)
|
13
|
+
expect(meta.os.version).to match(/.+/)
|
14
|
+
expect(meta.cpu.name).to match(/.+/)
|
15
|
+
expect(meta.ci).to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'generates a Meta message with CI information' do
|
19
|
+
env = {
|
20
|
+
'BUILD_URL' => 'url of the build',
|
21
|
+
'BUILD_NUMBER' => '42',
|
22
|
+
'GIT_URL' => 'url of git',
|
23
|
+
'GIT_COMMIT' => 'git_sha1',
|
24
|
+
'GIT_LOCAL_BRANCH' => 'main'
|
25
|
+
}
|
26
|
+
|
27
|
+
meta = Cucumber::CreateMeta.create_meta('cucumba-ruby', 'X.Y.Z', env)
|
28
|
+
|
29
|
+
expect(meta.ci).not_to be_nil
|
30
|
+
expect(meta.ci.url).to eq env['BUILD_URL']
|
31
|
+
expect(meta.ci.build_number).to eq env['BUILD_NUMBER']
|
32
|
+
expect(meta.ci.git.remote).to eq env['GIT_URL']
|
33
|
+
expect(meta.ci.git.revision).to eq env['GIT_COMMIT']
|
34
|
+
expect(meta.ci.git.branch).to eq env['GIT_LOCAL_BRANCH']
|
15
35
|
end
|
16
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-create-meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.3
|
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-
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber-messages
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '17.1'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 17.1.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '17.1'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 17.1.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: sys-uname
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: '13.0'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 13.0.
|
62
|
+
version: 13.0.6
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '13.0'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 13.0.
|
72
|
+
version: 13.0.6
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rspec
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,9 +97,9 @@ extensions: []
|
|
97
97
|
extra_rdoc_files: []
|
98
98
|
files:
|
99
99
|
- LICENSE
|
100
|
-
- lib/cucumber/ciDict.json
|
101
100
|
- lib/cucumber/create_meta.rb
|
102
101
|
- lib/cucumber/create_meta/variable_expression.rb
|
102
|
+
- spec/acceptance/create_meta_spec.rb
|
103
103
|
- spec/capture_warnings.rb
|
104
104
|
- spec/cucumber/create_meta_spec.rb
|
105
105
|
- spec/cucumber/evaluate_variable_expression_spec.rb
|
@@ -108,11 +108,11 @@ homepage: https://github.com/cucumber/create-meta-ruby
|
|
108
108
|
licenses:
|
109
109
|
- MIT
|
110
110
|
metadata:
|
111
|
-
bug_tracker_uri: https://github.com/cucumber/
|
112
|
-
changelog_uri: https://github.com/cucumber/
|
111
|
+
bug_tracker_uri: https://github.com/cucumber/common/issues
|
112
|
+
changelog_uri: https://github.com/cucumber/common/blob/main/create-meta/CHANGELOG.md
|
113
113
|
documentation_uri: https://cucumber.io/docs/gherkin/
|
114
114
|
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
115
|
-
source_code_uri: https://github.com/cucumber/
|
115
|
+
source_code_uri: https://github.com/cucumber/common/tree/main/create-meta/ruby
|
116
116
|
post_install_message:
|
117
117
|
rdoc_options:
|
118
118
|
- "--charset=UTF-8"
|
@@ -132,9 +132,10 @@ requirements: []
|
|
132
132
|
rubygems_version: 3.1.2
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
|
-
summary: cucumber-create-meta-
|
135
|
+
summary: cucumber-create-meta-6.0.3
|
136
136
|
test_files:
|
137
|
-
- spec/
|
138
|
-
- spec/cucumber/create_meta_spec.rb
|
139
|
-
- spec/cucumber/evaluate_variable_expression_spec.rb
|
137
|
+
- spec/acceptance/create_meta_spec.rb
|
140
138
|
- spec/cucumber/remove_userinfo_from_url_spec.rb
|
139
|
+
- spec/cucumber/evaluate_variable_expression_spec.rb
|
140
|
+
- spec/cucumber/create_meta_spec.rb
|
141
|
+
- spec/capture_warnings.rb
|
data/lib/cucumber/ciDict.json
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"Azure Pipelines": {
|
3
|
-
"url": "${BUILD_URI}",
|
4
|
-
"git": {
|
5
|
-
"remote": "${BUILD_REPOSITORY_URI}",
|
6
|
-
"revision": "${BUILD_SOURCEVERSION}",
|
7
|
-
"branch": "${BUILD_SOURCEBRANCH/refs\/heads\/(.*)/\\1}",
|
8
|
-
"tag": "${BUILD_SOURCEBRANCH/refs\/tags\/(.*)/\\1}"
|
9
|
-
}
|
10
|
-
},
|
11
|
-
"Bamboo": {
|
12
|
-
"url": "${bamboo.buildResultsUrl}",
|
13
|
-
"git": {
|
14
|
-
"remote": "${bamboo.planRepository.1.repositoryUrl}",
|
15
|
-
"revision": "${bamboo.planRepository.1.revision}",
|
16
|
-
"branch": "${bamboo.planRepository.1.branch}",
|
17
|
-
"tag": null
|
18
|
-
}
|
19
|
-
},
|
20
|
-
"Buddy": {
|
21
|
-
"url": "${BUDDY_EXECUTION_URL}",
|
22
|
-
"git": {
|
23
|
-
"remote": "${BUDDY_SCM_URL}",
|
24
|
-
"revision": "${BUDDY_EXECUTION_REVISION}",
|
25
|
-
"branch": "${BUDDY_EXECUTION_BRANCH}",
|
26
|
-
"tag": "${BUDDY_EXECUTION_TAG}"
|
27
|
-
}
|
28
|
-
},
|
29
|
-
"Bitrise": {
|
30
|
-
"url": "${BITRISE_BUILD_URL}",
|
31
|
-
"git": {
|
32
|
-
"remote": "${GIT_REPOSITORY_URL}",
|
33
|
-
"revision": "${BITRISE_GIT_COMMIT}",
|
34
|
-
"branch": "${BITRISE_GIT_BRANCH}",
|
35
|
-
"tag": "${BITRISE_GIT_TAG}"
|
36
|
-
}
|
37
|
-
},
|
38
|
-
"CircleCI": {
|
39
|
-
"url": "${CIRCLE_BUILD_URL}",
|
40
|
-
"git": {
|
41
|
-
"remote": "${CIRCLE_REPOSITORY_URL}",
|
42
|
-
"revision": "${CIRCLE_SHA1}",
|
43
|
-
"branch": "${CIRCLE_BRANCH}",
|
44
|
-
"tag": "${CIRCLE_TAG}"
|
45
|
-
}
|
46
|
-
},
|
47
|
-
"CodeFresh": {
|
48
|
-
"url": "${CF_BUILD_URL}",
|
49
|
-
"git": {
|
50
|
-
"remote": "${CF_COMMIT_URL}",
|
51
|
-
"revision": "${CF_REVISION}",
|
52
|
-
"branch": "${CF_BRANCH}",
|
53
|
-
"tag": null
|
54
|
-
}
|
55
|
-
},
|
56
|
-
"CodeShip": {
|
57
|
-
"url": "${CI_BUILD_URL}",
|
58
|
-
"git": {
|
59
|
-
"remote": "${CI_PULL_REQUEST/(.*)\\/pull\\/\\d+/\\1.git}",
|
60
|
-
"revision": "${CI_COMMIT_ID}",
|
61
|
-
"branch": "${CI_BRANCH}",
|
62
|
-
"tag": null
|
63
|
-
}
|
64
|
-
},
|
65
|
-
"GitHub Actions": {
|
66
|
-
"url": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}",
|
67
|
-
"git": {
|
68
|
-
"remote": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git",
|
69
|
-
"revision": "${GITHUB_SHA}",
|
70
|
-
"branch": "${GITHUB_REF/refs\/heads\/(.*)/\\1}",
|
71
|
-
"tag": "${GITHUB_REF/refs\/tags\/(.*)/\\1}"
|
72
|
-
}
|
73
|
-
},
|
74
|
-
"GitLab": {
|
75
|
-
"url": "${CI_JOB_URL}",
|
76
|
-
"git": {
|
77
|
-
"remote": "${CI_REPOSITORY_URL}",
|
78
|
-
"revision": "${CI_COMMIT_SHA}",
|
79
|
-
"branch": "${CI_COMMIT_BRANCH}",
|
80
|
-
"tag": "${CI_COMMIT_TAG}"
|
81
|
-
}
|
82
|
-
},
|
83
|
-
"GoCD": {
|
84
|
-
"url": "${GO_SERVER_URL}/pipelines/${GO_PIPELINE_NAME}/${GO_PIPELINE_COUNTER}/${GO_STAGE_NAME}/${GO_STAGE_COUNTER}",
|
85
|
-
"git": {
|
86
|
-
"remote": "${GO_SCM_*_PR_URL/(.*)\\/pull\\/\\d+/\\1.git}",
|
87
|
-
"revision": "${GO_REVISION}",
|
88
|
-
"branch": "${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}",
|
89
|
-
"tag": null
|
90
|
-
}
|
91
|
-
},
|
92
|
-
"Jenkins": {
|
93
|
-
"url": "${BUILD_URL}",
|
94
|
-
"git": {
|
95
|
-
"remote": "${GIT_URL}",
|
96
|
-
"revision": "${GIT_COMMIT}",
|
97
|
-
"branch": "${GIT_LOCAL_BRANCH}",
|
98
|
-
"tag": null
|
99
|
-
}
|
100
|
-
},
|
101
|
-
"Semaphore": {
|
102
|
-
"url": "${SEMAPHORE_ORGANIZATION_URL}/jobs/${SEMAPHORE_JOB_ID}",
|
103
|
-
"git": {
|
104
|
-
"remote": "${SEMAPHORE_GIT_URL}",
|
105
|
-
"revision": "${SEMAPHORE_GIT_SHA}",
|
106
|
-
"branch": "${SEMAPHORE_GIT_BRANCH}",
|
107
|
-
"tag": "${SEMAPHORE_GIT_TAG_NAME}"
|
108
|
-
}
|
109
|
-
},
|
110
|
-
"TeamCity": {
|
111
|
-
"url": "${teamcity.serverUrl}/app/rest/builds/id:${teamcity.build.id}",
|
112
|
-
"git": {
|
113
|
-
"remote": null,
|
114
|
-
"revision": "${build.vcs.number}",
|
115
|
-
"branch": "${teamcity.build.branch}",
|
116
|
-
"tag": null
|
117
|
-
}
|
118
|
-
},
|
119
|
-
"Travis CI": {
|
120
|
-
"url": "${TRAVIS_BUILD_WEB_URL}",
|
121
|
-
"git": {
|
122
|
-
"remote": "https://github.com/${TRAVIS_REPO_SLUG}.git",
|
123
|
-
"revision": "${TRAVIS_COMMIT}",
|
124
|
-
"branch": "${TRAVIS_BRANCH}",
|
125
|
-
"tag": "${TRAVIS_TAG}"
|
126
|
-
}
|
127
|
-
},
|
128
|
-
"Wercker": {
|
129
|
-
"url": "${WERCKER_RUN_URL}",
|
130
|
-
"git": {
|
131
|
-
"remote": "https://${WERCKER_GIT_DOMAIN}/${WERCKER_GIT_OWNER}/${WERCKER_GIT_REPOSITORY}.git",
|
132
|
-
"revision": "${WERCKER_GIT_COMMIT}",
|
133
|
-
"branch": "${WERCKER_GIT_BRANCH}",
|
134
|
-
"tag": null
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|