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 +4 -4
- data/lib/cucumber/ciDict.json +2 -2
- data/lib/cucumber/create_meta.rb +40 -27
- data/spec/cucumber/remove_userinfo_from_url_spec.rb +29 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbdf3f86379a4f4dd927107934be7f8f76dfc6f8074e58c3bfd416f721464e94
|
4
|
+
data.tar.gz: e2deca2d48e54912f16d398c710b8ef9be6fd516525f6286db6ec117c058f884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d40548b2963719ed2e36c01d0bcb637a62591383465ccbd9c9bd273de28bb614bc29d320b36a699a376a7907fd1ba8a4c551c3c6a4fc95f2cf9cea29dc9843
|
7
|
+
data.tar.gz: e77db158dc98e3895902a28741cf96053a98d8db5156f9d3c90e0cb7bcb96fd10253beee705638b7c17c84ea9796ba5667cf4f937752a0d57b0f103406418113
|
data/lib/cucumber/ciDict.json
CHANGED
@@ -45,9 +45,9 @@
|
|
45
45
|
}
|
46
46
|
},
|
47
47
|
"GitHub Actions": {
|
48
|
-
"url": "${
|
48
|
+
"url": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}",
|
49
49
|
"git": {
|
50
|
-
"remote": "${
|
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}"
|
data/lib/cucumber/create_meta.rb
CHANGED
@@ -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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
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:
|
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-
|
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: '
|
19
|
+
version: '13.1'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
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: '
|
29
|
+
version: '13.1'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
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-
|
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
|