papers 2.4.3 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +8 -2
- data/lib/papers/dependency_specification.rb +18 -18
- data/lib/papers/manifest_updater.rb +10 -7
- data/lib/papers/version.rb +1 -1
- data/spec/manifest_updater_spec.rb +71 -0
- data/spec/spec_helper.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 174c6341ec833049a5cb09f89779966021a1c50b8152e96bb9be8866a4446b7e
|
4
|
+
data.tar.gz: f7b0dc8ef6a71ef26698f95eb9264fb66c2235c13113eacba5694c506f64946b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b187474da6f2d1d898916db86b673935618c9e3dc9fbc2c005d7363d7a45eeccce39ee1742662eb94a31097a320475e64371189df8dad0321ebfcaeb8578d87
|
7
|
+
data.tar.gz: f151154a7a5f36bd62acec733f17fa5d9313765d11bdddab9dce97a85643d81b0736669f0e1ea447e818676a723820e71a4735e437dd30e501259c04da48c6cf
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
module Papers
|
2
4
|
class DependencySpecification
|
3
5
|
attr_accessor :name, :license, :license_url, :project_url
|
@@ -16,27 +18,25 @@ module Papers
|
|
16
18
|
|
17
19
|
def acceptable_license?
|
18
20
|
Papers.config.license_whitelist.include?(license) ||
|
19
|
-
|
20
|
-
|
21
|
+
Papers.config.version_whitelisted_license == license ||
|
22
|
+
Papers.config.package_whitelist.include?(name)
|
21
23
|
end
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end.sort { |a, b| a.name.downcase <=> b.name.downcase }
|
32
|
-
end
|
25
|
+
def self.all_from_manifest(manifest)
|
26
|
+
(manifest[manifest_key] || []).map do |name, info|
|
27
|
+
license_url = info['license_url']
|
28
|
+
license = info['license']
|
29
|
+
project_url = info['project_url']
|
30
|
+
new(name: name, license: license, license_url: license_url, project_url: project_url)
|
31
|
+
end.sort { |a, b| a.name.downcase <=> b.name.downcase }
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def self.missing_from_manifest(manifest)
|
35
|
+
introspected.to_set - all_from_manifest(manifest).map(&:name).to_set
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
def self.unknown_in_manifest(manifest)
|
39
|
+
all_from_manifest(manifest).map(&:name).to_set - introspected.to_set
|
40
|
+
end
|
41
41
|
end
|
42
42
|
end
|
@@ -27,9 +27,9 @@ module Papers
|
|
27
27
|
result = YAML.load(original_content)
|
28
28
|
|
29
29
|
update_gems(result)
|
30
|
-
update_javascript(result,
|
31
|
-
update_javascript(result,
|
32
|
-
update_javascript(result,
|
30
|
+
update_javascript(result, 'javascripts', get_installed_javascripts)
|
31
|
+
update_javascript(result, 'bower_components', get_installed_bower_components)
|
32
|
+
update_javascript(result, 'npm_packages', get_installed_npm_packages)
|
33
33
|
|
34
34
|
manifest_content = build_header + YAML.dump(result)
|
35
35
|
|
@@ -38,7 +38,7 @@ module Papers
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def update_gems(result)
|
41
|
-
result_gems = result[
|
41
|
+
result_gems = result['gems']
|
42
42
|
return unless result_gems
|
43
43
|
|
44
44
|
manifest_names = manifest_names(result_gems)
|
@@ -72,12 +72,15 @@ module Papers
|
|
72
72
|
|
73
73
|
def update_gem(result_gems, gemspec, manifest_gem_key)
|
74
74
|
manifest_gem = result_gems.delete(manifest_gem_key)
|
75
|
-
if gemspec.license && gemspec.license != manifest_gem[
|
75
|
+
if gemspec.license && gemspec.license != manifest_gem['license']
|
76
76
|
new_licenses = gemspec.licenses || []
|
77
77
|
new_licenses << gemspec.license
|
78
78
|
new_licenses.uniq!
|
79
79
|
|
80
|
-
|
80
|
+
# license key could be an array to_s to protect against that
|
81
|
+
unless manifest_gem['license'].to_s.match(/^License Change! Was '.+', is now .+$/)
|
82
|
+
manifest_gem['license'] = "License Change! Was '#{manifest_gem['license']}', is now #{new_licenses}"
|
83
|
+
end
|
81
84
|
end
|
82
85
|
|
83
86
|
name = gem_name_and_version(gemspec)
|
@@ -99,7 +102,7 @@ module Papers
|
|
99
102
|
end
|
100
103
|
|
101
104
|
def name_from_key(key)
|
102
|
-
key.include?(
|
105
|
+
key.include?('-') ? key.rpartition('-').first : key
|
103
106
|
end
|
104
107
|
|
105
108
|
def manifest_names(result_gems)
|
data/lib/papers/version.rb
CHANGED
@@ -45,6 +45,77 @@ EOS
|
|
45
45
|
EOS
|
46
46
|
}
|
47
47
|
|
48
|
+
let(:foo_license) { <<EOS
|
49
|
+
signed_payload-2.0.1:
|
50
|
+
license: License Change! Was 'New Relic', is now ["Nonstandard"]
|
51
|
+
license_url:
|
52
|
+
project_url: https://source.datanerd.us/account-auth-and-access/signed_payload
|
53
|
+
EOS
|
54
|
+
}
|
55
|
+
|
56
|
+
it 'should avoid nesting license change messages' do
|
57
|
+
gemspec = double(name: 'foo', version: '1.2.3', license: "some License Change! Was 'New Relic', is now [\"Nonstandard\"]", licenses: [], homepage: 'foo.com')
|
58
|
+
|
59
|
+
result_gems = {}
|
60
|
+
manifest_gem_key = 'foo'
|
61
|
+
allow(result_gems).to receive(:delete).with(manifest_gem_key).and_return({
|
62
|
+
'name' => 'foo',
|
63
|
+
'version' => '1.2.3',
|
64
|
+
'license' => "License Change! Was 'New Relic', is now [\"Nonstandard\"]",
|
65
|
+
'homepage' => 'foo.com'
|
66
|
+
})
|
67
|
+
|
68
|
+
updater.update_gem(result_gems, gemspec, manifest_gem_key)
|
69
|
+
expect(result_gems['foo']).to eq({
|
70
|
+
'name' => 'foo',
|
71
|
+
'version' => '1.2.3',
|
72
|
+
'license' => "License Change! Was 'New Relic', is now [\"Nonstandard\"]",
|
73
|
+
'homepage' => 'foo.com'
|
74
|
+
})
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should work as normal for non nested changes' do
|
78
|
+
gemspec = double(name: 'foo', version: '1.2.3', license: "asdf", licenses: [], homepage: 'foo.com')
|
79
|
+
|
80
|
+
result_gems = {}
|
81
|
+
manifest_gem_key = 'foo'
|
82
|
+
allow(result_gems).to receive(:delete).with(manifest_gem_key).and_return({
|
83
|
+
'name' => 'foo',
|
84
|
+
'version' => '1.2.3',
|
85
|
+
'license' => "ldkadfaldfjalkdsfj",
|
86
|
+
'homepage' => 'foo.com'
|
87
|
+
})
|
88
|
+
|
89
|
+
updater.update_gem(result_gems, gemspec, manifest_gem_key)
|
90
|
+
expect(result_gems['foo']).to eq({
|
91
|
+
'name' => 'foo',
|
92
|
+
'version' => '1.2.3',
|
93
|
+
'license' => "License Change! Was 'ldkadfaldfjalkdsfj', is now [\"asdf\"]",
|
94
|
+
'homepage' => 'foo.com'
|
95
|
+
})
|
96
|
+
end
|
97
|
+
|
98
|
+
# We don't want to support it fully, but don't bomb out if we find an array
|
99
|
+
it 'should handle array in manifest' do
|
100
|
+
gemspec = double(name: 'foo', version: '1.2.3', license: "asdf", licenses: ["asdf", "new"], homepage: 'foo.com')
|
101
|
+
|
102
|
+
result_gems = {}
|
103
|
+
manifest_gem_key = 'foo'
|
104
|
+
allow(result_gems).to receive(:delete).with(manifest_gem_key).and_return({
|
105
|
+
'name' => 'foo',
|
106
|
+
'version' => '1.2.3',
|
107
|
+
'license' => ["asdf", "old"],
|
108
|
+
'homepage' => 'foo.com'
|
109
|
+
})
|
110
|
+
|
111
|
+
updater.update_gem(result_gems, gemspec, manifest_gem_key)
|
112
|
+
expect(result_gems['foo']).to eq({
|
113
|
+
'name' => 'foo',
|
114
|
+
'version' => '1.2.3',
|
115
|
+
'license' => "License Change! Was '[\"asdf\", \"old\"]', is now [\"asdf\", \"new\"]",
|
116
|
+
'homepage' => 'foo.com'
|
117
|
+
})
|
118
|
+
end
|
48
119
|
|
49
120
|
it "avoids unnecessary updates" do
|
50
121
|
allow(updater).to receive(:gemspecs).and_return([
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: papers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ralph Bodenner
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Andrew Bloomgarden
|
10
10
|
- Lucas Charles
|
11
11
|
- David Celis
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -84,7 +84,7 @@ homepage: http://github.com/newrelic/papers
|
|
84
84
|
licenses:
|
85
85
|
- MIT
|
86
86
|
metadata: {}
|
87
|
-
post_install_message:
|
87
|
+
post_install_message:
|
88
88
|
rdoc_options: []
|
89
89
|
require_paths:
|
90
90
|
- lib
|
@@ -99,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
102
|
+
rubygems_version: 3.1.4
|
103
|
+
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Validate the licenses of software dependencies you use
|
106
106
|
test_files:
|