cucumber-create-meta 6.0.1 → 6.0.2

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: d6ee53160861ac80fab521c7c68e65d3f67992a253096b1bc86eebf071e93084
4
- data.tar.gz: b3a3a1a5272e75af443cb88f736924209563e92f40d8d37bac855a71ddcc9608
3
+ metadata.gz: cbeec9c9555758136e2dab0114910c1ee47bab5cd1ddd0c53bab5d36db42b3aa
4
+ data.tar.gz: 6a740a16b9ab323fc360579ab13259603caa77ee9fc3fb8a0fe2bed07f02fb85
5
5
  SHA512:
6
- metadata.gz: 8a3d47bf29d4e21381473159abafa1262f179c3049eacfbad3725ac0a8c054ba061849d66c585b1f60167e0ca5ecab06615bfc7e73a8d9f19b8d547504cabeb6
7
- data.tar.gz: 451316acb36b939dff9e89e772585bd1acac9d6c07e3d61847bff0b5bad97e7e18e02e8eed097f43b3b61caf4c716eb9f4e798fbc64f5ee6578cddbd3430677c
6
+ metadata.gz: a90d7404c481a3a0da38cad6f44a740982955d43651fb1ffbecec4270aa3e652695879dc8a70e6a6fbd2e05cea5959618788e8de0efe34f5a6975cbd61996a6b
7
+ data.tar.gz: fafdb21be0d5d8c6b76eed939954b858a60bcec4bc4c84d9e3e54bad6658f36565b30b5a7f11df40aa3c2996d0921c1ed06f2b4d3617a81c43d7f72043de474f
@@ -10,25 +10,25 @@ module Cucumber
10
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,17 +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
- buildNumber: evaluate(ci_system['buildNumber'], env),
50
- git: {
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
- }.delete_if {|k,v| v.nil?}
56
- }
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
+ )
57
57
  end
58
58
 
59
59
  def remove_userinfo_from_url(value)
@@ -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: 6.0.1
4
+ version: 6.0.2
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-07-19 00:00:00.000000000 Z
11
+ date: 2021-10-18 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: '17.0'
19
+ version: '17.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 17.0.1
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: '17.0'
29
+ version: '17.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 17.0.1
32
+ version: 17.1.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: sys-uname
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +132,7 @@ requirements: []
132
132
  rubygems_version: 3.1.2
133
133
  signing_key:
134
134
  specification_version: 4
135
- summary: cucumber-create-meta-6.0.1
135
+ summary: cucumber-create-meta-6.0.2
136
136
  test_files:
137
137
  - spec/capture_warnings.rb
138
138
  - spec/cucumber/remove_userinfo_from_url_spec.rb