licensed 5.0.6 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -24
- data/README.md +1 -1
- data/lib/licensed/sources/pip.rb +53 -5
- data/lib/licensed/version.rb +51 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93373cde622ea3d33acda4c6a94ddff7c309d6381b5578c5d8224aca5d899cf3
|
|
4
|
+
data.tar.gz: c03ab707bbc5f0aaecca317e2bfa3418d716a4aaba648cd1327626ef67ec8454
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c440e8a50d67a00eedd20ab514c66d922b6ffa7c7d24a8419ed558839d2355c8315dc865785110d176718015ed93004023557b763ff6e2c5003025e27ff3a770
|
|
7
|
+
data.tar.gz: 422a67416d5799789e0f2755190a112561cf1870627dc46d628311b175f1c96d27a222c7cc67113636853ef320348f45e8affd3e1c646b1b0a3005fb49eb95c4
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
licensed (5.0.
|
|
4
|
+
licensed (5.0.7)
|
|
5
5
|
csv (~> 3.3)
|
|
6
6
|
json (~> 2.6)
|
|
7
7
|
licensee (~> 9.16)
|
|
@@ -16,27 +16,27 @@ PATH
|
|
|
16
16
|
GEM
|
|
17
17
|
remote: https://rubygems.org/
|
|
18
18
|
specs:
|
|
19
|
-
activesupport (
|
|
19
|
+
activesupport (8.1.3)
|
|
20
20
|
base64
|
|
21
|
-
benchmark (>= 0.3)
|
|
22
21
|
bigdecimal
|
|
23
22
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
24
23
|
connection_pool (>= 2.2.5)
|
|
25
24
|
drb
|
|
26
25
|
i18n (>= 1.6, < 2)
|
|
26
|
+
json
|
|
27
27
|
logger (>= 1.4.2)
|
|
28
28
|
minitest (>= 5.1)
|
|
29
29
|
securerandom (>= 0.3)
|
|
30
30
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
31
|
-
|
|
31
|
+
uri (>= 0.13.1)
|
|
32
|
+
addressable (2.9.0)
|
|
32
33
|
public_suffix (>= 2.0.2, < 8.0)
|
|
33
34
|
ast (2.4.3)
|
|
34
35
|
base64 (0.3.0)
|
|
35
|
-
|
|
36
|
-
bigdecimal (4.0.1)
|
|
36
|
+
bigdecimal (4.1.1)
|
|
37
37
|
byebug (12.0.0)
|
|
38
38
|
concurrent-ruby (1.3.6)
|
|
39
|
-
connection_pool (
|
|
39
|
+
connection_pool (3.0.2)
|
|
40
40
|
csv (3.3.5)
|
|
41
41
|
dotenv (3.2.0)
|
|
42
42
|
drb (2.2.3)
|
|
@@ -48,11 +48,11 @@ GEM
|
|
|
48
48
|
net-http (~> 0.5)
|
|
49
49
|
i18n (1.14.8)
|
|
50
50
|
concurrent-ruby (~> 1.0)
|
|
51
|
-
json (2.
|
|
51
|
+
json (2.19.3)
|
|
52
52
|
language_server-protocol (3.17.0.5)
|
|
53
|
-
licensee (9.
|
|
53
|
+
licensee (9.19.0)
|
|
54
54
|
dotenv (>= 2, < 4)
|
|
55
|
-
octokit (>= 4.20, <
|
|
55
|
+
octokit (>= 4.20, < 11.0)
|
|
56
56
|
reverse_markdown (>= 1, < 4)
|
|
57
57
|
rugged (>= 0.24, < 2.0)
|
|
58
58
|
thor (>= 0.19, < 2.0)
|
|
@@ -62,46 +62,46 @@ GEM
|
|
|
62
62
|
minitest (5.27.0)
|
|
63
63
|
minitest-hooks (1.5.3)
|
|
64
64
|
minitest (> 5.3)
|
|
65
|
-
mocha (3.0
|
|
65
|
+
mocha (3.1.0)
|
|
66
66
|
ruby2_keywords (>= 0.0.5)
|
|
67
67
|
net-http (0.9.1)
|
|
68
68
|
uri (>= 0.11.1)
|
|
69
|
-
nokogiri (1.19.
|
|
69
|
+
nokogiri (1.19.2)
|
|
70
70
|
mini_portile2 (~> 2.8.2)
|
|
71
71
|
racc (~> 1.4)
|
|
72
|
-
octokit (
|
|
72
|
+
octokit (10.0.0)
|
|
73
73
|
faraday (>= 1, < 3)
|
|
74
74
|
sawyer (~> 0.9)
|
|
75
75
|
ostruct (0.6.3)
|
|
76
|
-
parallel (1.
|
|
77
|
-
parser (3.3.
|
|
76
|
+
parallel (1.28.0)
|
|
77
|
+
parser (3.3.11.1)
|
|
78
78
|
ast (~> 2.4.1)
|
|
79
79
|
racc
|
|
80
80
|
pathname-common_prefix (0.0.2)
|
|
81
81
|
prism (1.9.0)
|
|
82
|
-
public_suffix (
|
|
82
|
+
public_suffix (7.0.5)
|
|
83
83
|
racc (1.8.1)
|
|
84
|
-
rack (3.2.
|
|
84
|
+
rack (3.2.6)
|
|
85
85
|
rainbow (3.1.1)
|
|
86
|
-
rake (13.
|
|
87
|
-
regexp_parser (2.
|
|
86
|
+
rake (13.4.1)
|
|
87
|
+
regexp_parser (2.12.0)
|
|
88
88
|
reverse_markdown (3.0.2)
|
|
89
89
|
nokogiri
|
|
90
|
-
rubocop (1.
|
|
90
|
+
rubocop (1.86.1)
|
|
91
91
|
json (~> 2.3)
|
|
92
92
|
language_server-protocol (~> 3.17.0.2)
|
|
93
93
|
lint_roller (~> 1.1.0)
|
|
94
|
-
parallel (
|
|
94
|
+
parallel (>= 1.10)
|
|
95
95
|
parser (>= 3.3.0.2)
|
|
96
96
|
rainbow (>= 2.2.2, < 4.0)
|
|
97
97
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
98
98
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
99
99
|
ruby-progressbar (~> 1.7)
|
|
100
100
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
101
|
-
rubocop-ast (1.49.
|
|
101
|
+
rubocop-ast (1.49.1)
|
|
102
102
|
parser (>= 3.3.7.2)
|
|
103
103
|
prism (~> 1.7)
|
|
104
|
-
rubocop-github (0.
|
|
104
|
+
rubocop-github (0.27.0)
|
|
105
105
|
rubocop (>= 1.76)
|
|
106
106
|
rubocop-performance (>= 1.24)
|
|
107
107
|
rubocop-rails (>= 2.23)
|
|
@@ -145,4 +145,4 @@ DEPENDENCIES
|
|
|
145
145
|
rubocop-github (~> 0.20)
|
|
146
146
|
|
|
147
147
|
BUNDLED WITH
|
|
148
|
-
4.0.
|
|
148
|
+
4.0.8
|
data/README.md
CHANGED
|
@@ -94,7 +94,7 @@ To get started after checking out the repo, run
|
|
|
94
94
|
|
|
95
95
|
You can also run `script/console` for an interactive prompt that will allow you to experiment.
|
|
96
96
|
|
|
97
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version,
|
|
97
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, create a GitHub release from the matching `vX.Y.Z` tag.
|
|
98
98
|
|
|
99
99
|
### Adding a new source
|
|
100
100
|
|
data/lib/licensed/sources/pip.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Licensed
|
|
|
20
20
|
metadata: {
|
|
21
21
|
"type" => self.class.type,
|
|
22
22
|
"summary" => package["Summary"],
|
|
23
|
-
"homepage" => package
|
|
23
|
+
"homepage" => homepage(package)
|
|
24
24
|
}
|
|
25
25
|
)
|
|
26
26
|
end
|
|
@@ -83,14 +83,30 @@ module Licensed
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
# Returns a hash filled with package info parsed from the email-header formatted output
|
|
86
|
-
# returned by `pip show
|
|
86
|
+
# returned by `pip show --verbose`, including continuation lines for multi-line fields.
|
|
87
87
|
def parse_package_info(package_info)
|
|
88
|
+
current_key = nil
|
|
89
|
+
|
|
88
90
|
package_info.lines.each_with_object(Hash.new(0)) do |pkg, a|
|
|
89
|
-
|
|
91
|
+
if pkg.match?(/^\s/)
|
|
92
|
+
if current_key
|
|
93
|
+
current_value = a[current_key]
|
|
94
|
+
continuation = pkg.strip
|
|
95
|
+
a[current_key] =
|
|
96
|
+
if current_value.to_s.empty?
|
|
97
|
+
continuation
|
|
98
|
+
else
|
|
99
|
+
"#{current_value}\n#{continuation}"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
next
|
|
103
|
+
end
|
|
90
104
|
|
|
91
105
|
k, v = pkg.split(":", 2)
|
|
92
106
|
next if k.nil? || k.empty?
|
|
93
|
-
|
|
107
|
+
|
|
108
|
+
current_key = k.strip
|
|
109
|
+
a[current_key] = v&.strip
|
|
94
110
|
end
|
|
95
111
|
end
|
|
96
112
|
|
|
@@ -101,7 +117,39 @@ module Licensed
|
|
|
101
117
|
|
|
102
118
|
# Returns the output from `pip show <package> <package> ...`
|
|
103
119
|
def pip_show_command(package)
|
|
104
|
-
Licensed::Shell.execute(*pip_command, "--disable-pip-version-check", "show", package)
|
|
120
|
+
Licensed::Shell.execute(*pip_command, "--disable-pip-version-check", "show", "--verbose", package)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Returns the package homepage from pip package metadata
|
|
124
|
+
def homepage(package)
|
|
125
|
+
home_page = package["Home-page"]
|
|
126
|
+
return home_page unless home_page.to_s.empty?
|
|
127
|
+
|
|
128
|
+
homepage_from_project_urls(package["Project-URL"] || package["Project-URLs"]) || home_page
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Returns best-effort homepage URL extracted from Project-URL(s) metadata
|
|
132
|
+
# With priority given to Home > Repository > Source, otherwise the first URL
|
|
133
|
+
def homepage_from_project_urls(project_urls)
|
|
134
|
+
return if project_urls.to_s.empty?
|
|
135
|
+
|
|
136
|
+
entries = project_urls
|
|
137
|
+
.to_s
|
|
138
|
+
.split("\n")
|
|
139
|
+
.map(&:strip)
|
|
140
|
+
.reject(&:empty?)
|
|
141
|
+
|
|
142
|
+
candidates = entries.filter_map do |entry|
|
|
143
|
+
label, url = entry.split(",", 2).map { |value| value&.strip }
|
|
144
|
+
next unless url&.match?(%r{^https?://})
|
|
145
|
+
|
|
146
|
+
[label.to_s, url]
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
preferred = candidates.find { |label, _| label.match?(/home/i) } ||
|
|
150
|
+
candidates.find { |label, _| label.match?(/repo/i) } ||
|
|
151
|
+
candidates.find { |label, _| label.match?(/source/i) }
|
|
152
|
+
preferred&.last || candidates.first&.last
|
|
105
153
|
end
|
|
106
154
|
|
|
107
155
|
def virtual_env_dir
|
data/lib/licensed/version.rb
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require "open3"
|
|
3
|
+
|
|
2
4
|
module Licensed
|
|
3
|
-
VERSION =
|
|
5
|
+
VERSION = begin
|
|
6
|
+
root = File.expand_path("../..", __dir__)
|
|
7
|
+
loaded_spec = Gem.loaded_specs["licensed"]
|
|
8
|
+
loaded_from = loaded_spec&.loaded_from && File.expand_path(loaded_spec.loaded_from)
|
|
9
|
+
|
|
10
|
+
# Published gems should report the version stored in gem metadata. Source
|
|
11
|
+
# checkouts need to ignore Bundler's path gemspec so development builds can
|
|
12
|
+
# infer the next release version from git tags.
|
|
13
|
+
if loaded_spec&.version && loaded_from != File.join(root, "licensed.gemspec")
|
|
14
|
+
loaded_spec.version.to_s
|
|
15
|
+
else
|
|
16
|
+
git_error = nil
|
|
17
|
+
|
|
18
|
+
begin
|
|
19
|
+
output, status = Open3.capture2e(
|
|
20
|
+
"git",
|
|
21
|
+
"describe",
|
|
22
|
+
"--tags",
|
|
23
|
+
chdir: root
|
|
24
|
+
)
|
|
25
|
+
rescue SystemCallError => e
|
|
26
|
+
git_error = e.message
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
if status&.success?
|
|
30
|
+
described_version = output.strip.delete_prefix("v")
|
|
31
|
+
|
|
32
|
+
# Exact tags build that tag's version. Commits after a tag build the
|
|
33
|
+
# next patch version Homebrew and the release workflow should expect.
|
|
34
|
+
if (match = described_version.match(/\A(.+)-\d+-g[0-9a-f]+(?:-dirty)?\z/))
|
|
35
|
+
match[1].sub(/\d+\z/) { |segment| (segment.to_i + 1).to_s.rjust(segment.length, "0") }
|
|
36
|
+
else
|
|
37
|
+
described_version
|
|
38
|
+
end
|
|
39
|
+
elsif File.exist?(lockfile = File.join(root, "Gemfile.lock"))
|
|
40
|
+
# Shallow CI checkouts do not fetch tags in the broad test matrix. The
|
|
41
|
+
# lockfile keeps Bundler setup fast and deterministic there.
|
|
42
|
+
lockfile_version = File.read(lockfile)[/^ licensed \(([^)]+)\)$/, 1]
|
|
43
|
+
raise "Unable to determine licensed version from Gemfile.lock" unless lockfile_version
|
|
44
|
+
|
|
45
|
+
lockfile_version
|
|
46
|
+
else
|
|
47
|
+
error_output = output.to_s.strip
|
|
48
|
+
raise "Unable to determine licensed version" if git_error.to_s.empty? && error_output.empty?
|
|
49
|
+
|
|
50
|
+
raise "Unable to determine licensed version: #{git_error || error_output}"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end.freeze
|
|
4
54
|
|
|
5
55
|
def self.previous_major_versions
|
|
6
56
|
major_version = Gem::Version.new(Licensed::VERSION).segments.first
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: licensed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0
|
|
4
|
+
version: 5.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitHub
|
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
375
375
|
- !ruby/object:Gem::Version
|
|
376
376
|
version: '0'
|
|
377
377
|
requirements: []
|
|
378
|
-
rubygems_version: 4.0.
|
|
378
|
+
rubygems_version: 4.0.6
|
|
379
379
|
specification_version: 4
|
|
380
380
|
summary: Extract and validate the licenses of dependencies.
|
|
381
381
|
test_files: []
|