cucumber-create-meta 1.2.0 → 2.0.4

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: fe34f960426eb2d2765cd2342d5fb0dad62f25e7cd4f16741d5f43fe28958ab4
4
- data.tar.gz: 6054813914d6d69de6ad2ce26abcfb92e63723679f5b33706b673d7c9ef8f550
3
+ metadata.gz: dbdf3f86379a4f4dd927107934be7f8f76dfc6f8074e58c3bfd416f721464e94
4
+ data.tar.gz: e2deca2d48e54912f16d398c710b8ef9be6fd516525f6286db6ec117c058f884
5
5
  SHA512:
6
- metadata.gz: 88d95eca9d736eac2613e00a166d5f3da4d807685827a1988a652dff5c08b1fe31264da5f6088f41c0f484d8ebe2caf6d359306062d085e5107a098bbaa5ee09
7
- data.tar.gz: 6f0ece8bc4ee73f9e321b23e4f6777e5c1d52960cd0889eea439d5748060ade2ef39eb3745a25ed249dd3c640418210a7472c38346c08434bfa22bbc8ca665b1
6
+ metadata.gz: f6d40548b2963719ed2e36c01d0bcb637a62591383465ccbd9c9bd273de28bb614bc29d320b36a699a376a7907fd1ba8a4c551c3c6a4fc95f2cf9cea29dc9843
7
+ data.tar.gz: e77db158dc98e3895902a28741cf96053a98d8db5156f9d3c90e0cb7bcb96fd10253beee705638b7c17c84ea9796ba5667cf4f937752a0d57b0f103406418113
@@ -45,9 +45,9 @@
45
45
  }
46
46
  },
47
47
  "GitHub Actions": {
48
- "url": "${_GITHUB_BASEURL | https://github.com/}${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}",
48
+ "url": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}",
49
49
  "git": {
50
- "remote": "${_GITHUB_BASEURL | https://github.com/}${GITHUB_REPOSITORY}.git",
50
+ "remote": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git",
51
51
  "revision": "${GITHUB_SHA}",
52
52
  "branch": "${refbranch GITHUB_REF}",
53
53
  "tag": "${reftag GITHUB_REF}"
@@ -1,29 +1,31 @@
1
+ require 'uri'
1
2
  require 'cucumber/messages'
2
3
  require 'sys/uname'
3
4
  require 'json'
4
5
 
5
6
  module Cucumber
6
7
  module CreateMeta
7
- CI_DICT = JSON.parse(IO.read(File.join(File.dirname(__FILE__),"ciDict.json")))
8
+ CI_DICT = JSON.parse(IO.read(File.join(File.dirname(__FILE__), "ciDict.json")))
8
9
 
9
- def create_meta(tool_name, tool_version)
10
+ def create_meta(tool_name, tool_version, env = ENV)
10
11
  Cucumber::Messages::Meta.new(
11
- protocol_version: Cucumber::Messages::VERSION,
12
- implementation: Cucumber::Messages::Meta::Product.new(
13
- name: tool_name,
14
- version: tool_version
15
- ),
16
- runtime: Cucumber::Messages::Meta::Product.new(
17
- name: RUBY_ENGINE,
18
- version: RUBY_VERSION
19
- ),
20
- os: Cucumber::Messages::Meta::Product.new(
21
- name: RbConfig::CONFIG['target_os'],
22
- version: Sys::Uname.uname.version
23
- ),
24
- cpu: Cucumber::Messages::Meta::Product.new(
25
- name: RbConfig::CONFIG['target_cpu']
26
- )
12
+ protocol_version: Cucumber::Messages::VERSION,
13
+ implementation: Cucumber::Messages::Meta::Product.new(
14
+ name: tool_name,
15
+ version: tool_version
16
+ ),
17
+ runtime: Cucumber::Messages::Meta::Product.new(
18
+ name: RUBY_ENGINE,
19
+ version: RUBY_VERSION
20
+ ),
21
+ os: Cucumber::Messages::Meta::Product.new(
22
+ name: RbConfig::CONFIG['target_os'],
23
+ version: Sys::Uname.uname.version
24
+ ),
25
+ cpu: Cucumber::Messages::Meta::Product.new(
26
+ name: RbConfig::CONFIG['target_cpu']
27
+ ),
28
+ ci: detect_ci(env)
27
29
  )
28
30
  end
29
31
 
@@ -40,14 +42,14 @@ module Cucumber
40
42
  return nil if url.nil?
41
43
 
42
44
  Cucumber::Messages::Meta::CI.new(
43
- url: url,
44
- name: ci_name,
45
- git: Cucumber::Messages::Meta::CI::Git.new(
46
- remote: evaluate(ci_system['git']['remote'], env),
47
- revision: evaluate(ci_system['git']['revision'], env),
48
- branch: evaluate(ci_system['git']['branch'], env),
49
- tag: evaluate(ci_system['git']['tag'], env),
50
- )
45
+ url: url,
46
+ name: ci_name,
47
+ git: Cucumber::Messages::Meta::CI::Git.new(
48
+ remote: remove_userinfo_from_url(evaluate(ci_system['git']['remote'], env)),
49
+ revision: evaluate(ci_system['git']['revision'], env),
50
+ branch: evaluate(ci_system['git']['branch'], env),
51
+ tag: evaluate(ci_system['git']['tag'], env),
52
+ )
51
53
  )
52
54
  end
53
55
 
@@ -79,6 +81,17 @@ module Cucumber
79
81
  m[1]
80
82
  end
81
83
 
82
- module_function :create_meta, :detect_ci, :create_ci, :group1, :evaluate
84
+ def remove_userinfo_from_url(value)
85
+ return nil if value.nil?
86
+ begin
87
+ uri = URI(value)
88
+ uri.userinfo = ''
89
+ uri.to_s
90
+ rescue
91
+ value
92
+ end
93
+ end
94
+
95
+ module_function :create_meta, :detect_ci, :create_ci, :group1, :evaluate, :remove_userinfo_from_url
83
96
  end
84
97
  end
@@ -0,0 +1,29 @@
1
+ require 'cucumber/create_meta'
2
+
3
+ describe 'remove_user_info_from_url' do
4
+ it 'returns nil for nil' do
5
+ expect(Cucumber::CreateMeta.remove_userinfo_from_url(nil)).to be_nil
6
+ end
7
+
8
+ it 'returns empty string for empty string' do
9
+ expect(Cucumber::CreateMeta.remove_userinfo_from_url('')).to eq('')
10
+ end
11
+
12
+ it 'leaves the data intact when no sensitive information is detected' do
13
+ expect(Cucumber::CreateMeta.remove_userinfo_from_url('pretty safe')).to eq('pretty safe')
14
+ end
15
+
16
+ context 'with URLs' do
17
+ it 'leaves intact when no password is found' do
18
+ expect(Cucumber::CreateMeta.remove_userinfo_from_url('https://example.com/git/repo.git')).to eq('https://example.com/git/repo.git')
19
+ end
20
+
21
+ it 'removes credentials when found' do
22
+ expect(Cucumber::CreateMeta.remove_userinfo_from_url('http://login@example.com/git/repo.git')).to eq('http://example.com/git/repo.git')
23
+ end
24
+
25
+ it 'removes credentials and passwords when found' do
26
+ expect(Cucumber::CreateMeta.remove_userinfo_from_url('ssh://login:password@example.com/git/repo.git')).to eq('ssh://example.com/git/repo.git')
27
+ end
28
+ end
29
+ 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: 1.2.0
4
+ version: 2.0.4
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: 2020-07-31 00:00:00.000000000 Z
11
+ date: 2020-10-29 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: '12.4'
19
+ version: '13.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 12.4.0
22
+ version: 13.1.0
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: '12.4'
29
+ version: '13.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 12.4.0
32
+ version: 13.1.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: sys-uname
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +101,7 @@ files:
101
101
  - lib/cucumber/create_meta.rb
102
102
  - spec/capture_warnings.rb
103
103
  - spec/cucumber/create_meta_spec.rb
104
+ - spec/cucumber/remove_userinfo_from_url_spec.rb
104
105
  homepage: https://github.com/cucumber/create-meta-ruby
105
106
  licenses:
106
107
  - MIT
@@ -129,7 +130,8 @@ requirements: []
129
130
  rubygems_version: 3.1.2
130
131
  signing_key:
131
132
  specification_version: 4
132
- summary: cucumber-create-meta-1.2.0
133
+ summary: cucumber-create-meta-2.0.4
133
134
  test_files:
134
135
  - spec/capture_warnings.rb
135
136
  - spec/cucumber/create_meta_spec.rb
137
+ - spec/cucumber/remove_userinfo_from_url_spec.rb