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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f655f885d4b250da9d8923262231aca56d2c2aff33788fbfc55ed1c86318c58
4
- data.tar.gz: 7cc5d5a2e4ac40b40652373ee8afd8a61a3db34be2e58780945b7361b82ce906
3
+ metadata.gz: 683fb4b95e55fbb4f6ff2416f93caf823c8c1ceb64c00025c875ea8b6b935cd7
4
+ data.tar.gz: 7ee13b6e2bfbd50f40abbb8d2507f042cd2d0bad82653eb7309e8d56f469da01
5
5
  SHA512:
6
- metadata.gz: e743ddae1ad514729be26e52995f2ab9e5b82f4b29d0ca60c92d48df8a19befb0653476d29326a23c7dc1f1539629cb19f0dea57280d65c919451c1a577e8f72
7
- data.tar.gz: 54ce5d5d9ed2a044f68749d0127c4f6e543982d53ecdd746e6c5347dee3f72ba245c1cfb0d10172c8057da259bd4d3c5188f3f03b6264f1a679e3dda4dd3b1b9
6
+ metadata.gz: 9c05e86d15d9b4e46e791044b64cb8a0f76c4fd7fea563e4448b35b2d9d842e4764e47f15d8c396aa4e9d19c3e77a5ab4515d4b3df0fe552edae34593cb69d3b
7
+ data.tar.gz: 463c982c9731b39cf1ea15e20d29bcbfbf14187e09505b8f7b6bbb440adca1e47c20401686f2e301d4868a632094f0640d9b316f83e8eda9e1dbb87f808a393a
@@ -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__), "ciDict.json")))
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
- protocol_version: Cucumber::Messages::VERSION,
15
- implementation: {
16
- name: tool_name,
17
- version: tool_version
18
- },
19
- runtime: {
20
- name: RUBY_ENGINE,
21
- version: RUBY_VERSION
22
- },
23
- os: {
24
- name: RbConfig::CONFIG['target_os'],
25
- version: Sys::Uname.uname.version
26
- },
27
- cpu: {
28
- name: RbConfig::CONFIG['target_cpu']
29
- },
30
- ci: detect_ci(env)
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
- url: url,
48
- name: ci_name,
49
- git: {
50
- remote: remove_userinfo_from_url(evaluate(ci_system['git']['remote'], env)),
51
- revision: evaluate(ci_system['git']['revision'], env),
52
- branch: evaluate(ci_system['git']['branch'], env),
53
- tag: evaluate(ci_system['git']['tag'], env),
54
- }.delete_if {|k,v| v.nil?}
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[: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(/.+/)
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: 5.0.0
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-05-17 00:00:00.000000000 Z
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: '16.0'
19
+ version: '17.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 16.0.0
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: '16.0'
29
+ version: '17.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 16.0.0
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.3
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.3
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/cucumber/issues
112
- changelog_uri: https://github.com/cucumber/cucumber/blob/master/gherkin/CHANGELOG.md
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/cucumber/blob/master/gherkin/ruby
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-5.0.0
135
+ summary: cucumber-create-meta-6.0.3
136
136
  test_files:
137
- - spec/capture_warnings.rb
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
@@ -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
- }