licensed 3.2.0 → 3.3.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/CHANGELOG.md +44 -1
- data/README.md +1 -1
- data/docs/commands/status.md +1 -0
- data/docs/sources/cargo.md +19 -0
- data/lib/licensed/commands/cache.rb +4 -2
- data/lib/licensed/commands/command.rb +5 -2
- data/lib/licensed/reporters/status_reporter.rb +1 -1
- data/lib/licensed/sources/bundler/definition.rb +36 -0
- data/lib/licensed/sources/bundler/missing_specification.rb +10 -7
- data/lib/licensed/sources/bundler.rb +33 -69
- data/lib/licensed/sources/cargo.rb +70 -0
- data/lib/licensed/sources/dep.rb +2 -2
- data/lib/licensed/sources/go.rb +3 -3
- data/lib/licensed/sources/helpers/content_versioning.rb +2 -1
- data/lib/licensed/sources/nuget.rb +1 -2
- data/lib/licensed/sources.rb +1 -0
- data/lib/licensed/version.rb +1 -1
- data/licensed.gemspec +5 -5
- metadata +27 -41
- data/.github/workflows/release.yml +0 -213
- data/.github/workflows/test.yml +0 -439
- data/.gitignore +0 -57
- data/.licensed.yml +0 -7
- data/.rubocop.yml +0 -8
- data/.ruby-version +0 -1
- data/docker/Dockerfile.build-linux +0 -15
- data/script/bootstrap +0 -6
- data/script/cibuild +0 -7
- data/script/console +0 -15
- data/script/package +0 -20
- data/script/packages/build +0 -95
- data/script/packages/linux +0 -57
- data/script/packages/mac +0 -41
- data/script/setup +0 -5
- data/script/source-setup/bower +0 -17
- data/script/source-setup/bundler +0 -20
- data/script/source-setup/cabal +0 -19
- data/script/source-setup/composer +0 -38
- data/script/source-setup/git_submodule +0 -39
- data/script/source-setup/go +0 -31
- data/script/source-setup/mix +0 -19
- data/script/source-setup/npm +0 -34
- data/script/source-setup/nuget +0 -17
- data/script/source-setup/pip +0 -29
- data/script/source-setup/pipenv +0 -21
- data/script/source-setup/swift +0 -22
- data/script/source-setup/yarn +0 -17
- data/script/test +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f452bd7c6a58fdaa9a56cf7085b20fe4ff3a8f3eb214835ba82a52b2ed1ac71c
|
4
|
+
data.tar.gz: 8b3aff33c001623780455c68d23c014746e988b82a44db0fa243829c2be34cd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0bb95e3496257986e52294a7788824043697d8f99d2745c65e30e3a5c255843bc1471cf47ab3f3cd407d597c658b2d82e1bc27a76e6f985b45af6803d0e98a5
|
7
|
+
data.tar.gz: 93eb593c4389bff724a0a41be7c583e96541bfc308a9c331bf5d34c35217c98160e026733a49cc07b93b654b23e4507a447dbd5ab9ef8f1596a0e38139187757
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,49 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## 3.3.0
|
10
|
+
|
11
|
+
2021-09-18
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- New cargo source enumerates rust dependencies (https://github.com/github/licensed/pull/404)
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Removed non-functional files from gem builds (https://github.com/github/licensed/pull/405)
|
20
|
+
|
21
|
+
## 3.2.3
|
22
|
+
|
23
|
+
2021-09-14
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Bundler source will no longer infinitely recurse when enumerating specifications (https://github.com/github/licensed/pull/402)
|
28
|
+
- Using the `--sources` command line option will no longer delete skipped sources' cached files (https://github.com/github/licensed/pull/401)
|
29
|
+
|
30
|
+
## 3.2.2
|
31
|
+
|
32
|
+
2021-09-09
|
33
|
+
|
34
|
+
### Fixed
|
35
|
+
|
36
|
+
- Bundler source works properly again when used outside of `bundle exec` (https://github.com/github/licensed/pull/397)
|
37
|
+
|
38
|
+
## 3.2.1
|
39
|
+
|
40
|
+
2021-09-06
|
41
|
+
|
42
|
+
### Changed
|
43
|
+
|
44
|
+
- Updated multiple dependency versions (:tada: @mmorel-35 https://github.com/github/licensed/pull/385, https://github.com/github/licensed/pull/389)
|
45
|
+
- Go homepage links use pkg.go.dev instead of godoc.org (:tada: @mmorel-35 https://github.com/github/licensed/commit/73cfbbe954a3e8c8cbaf8b68253053b157e01b79)
|
46
|
+
- Local development ruby version changed to 2.7.4 (https://github.com/github/licensed/pull/393)
|
47
|
+
|
48
|
+
### Fixed
|
49
|
+
|
50
|
+
- Bundler source correctly finds platform specific dependencies (https://github.com/github/licensed/pull/392)
|
51
|
+
|
9
52
|
## 3.2.0
|
10
53
|
|
11
54
|
2021-08-19
|
@@ -466,4 +509,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
466
509
|
|
467
510
|
Initial release :tada:
|
468
511
|
|
469
|
-
[Unreleased]: https://github.com/github/licensed/compare/3.
|
512
|
+
[Unreleased]: https://github.com/github/licensed/compare/3.3.0...HEAD
|
data/README.md
CHANGED
@@ -84,7 +84,7 @@ A configuration file is required for most commands. See the [configuration file
|
|
84
84
|
|
85
85
|
### Available dependency sources
|
86
86
|
|
87
|
-
Licensed can enumerate dependency for many languages, package managers, and frameworks. See the [sources documentation](./docs/sources) for the list of currently available sources. Sources can be explicitly enabled and disabled as a [configuration option](./docs/configuration/
|
87
|
+
Licensed can enumerate dependency for many languages, package managers, and frameworks. See the [sources documentation](./docs/sources) for the list of currently available sources. Sources can be explicitly enabled and disabled as a [configuration option](./docs/configuration/dependency_source_enumerators.md.md).
|
88
88
|
|
89
89
|
### Automation
|
90
90
|
|
data/docs/commands/status.md
CHANGED
@@ -65,6 +65,7 @@ If the dependency does not include license text but does specify that it uses a
|
|
65
65
|
**Resolution:** Review the dependency's usage and specified license with someone familiar with OSS licensing and compliance rules to determine whether the dependency is allowable. Some common resolutions:
|
66
66
|
|
67
67
|
1. The dependency's specified license text differed enough from the standard license text that it was not recognized and classified as `other`. If, with human review, the license text is recognizable then update the `license: other` value in the cached metadata file to the correct license.
|
68
|
+
- An updated classification will persist through version upgrades until the detected license contents have changed. The determination is made by [licensee/licensee](https://github.com/licensee/licensee), the library which this tool uses to detect and classify license contents.
|
68
69
|
1. The dependency might need to be marked as [ignored] or [reviewed] if either of those scenarios are applicable.
|
69
70
|
1. If the used license should be allowable without review (if your entity has a legal team, they may want to review this assessment), ensure the license SPDX is set as [allowed] in the licensed configuration file.
|
70
71
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Cargo
|
2
|
+
|
3
|
+
The cargo source will detect dependencies when `Cargo.toml` is found at an apps `source_path`. The source uses the `cargo metadata` CLI and reports on all dependencies that are listed in the output in `resolve.nodes`, excluding packages that are listed in `workspace_members`.
|
4
|
+
|
5
|
+
## Metadata CLI options
|
6
|
+
|
7
|
+
Licensed by default runs `cargo metadata --format-version=1`. You can specify additional CLI options by specifying them in your licensed configuration file under `cargo.metadata_options`. The configuration can be set as a string, or as an array of strings for multiple options.
|
8
|
+
|
9
|
+
```yml
|
10
|
+
cargo:
|
11
|
+
metadata_options: '--all-features'
|
12
|
+
```
|
13
|
+
|
14
|
+
```yml
|
15
|
+
cargo:
|
16
|
+
metadata_options:
|
17
|
+
- '--all-features'
|
18
|
+
- '--filter-platform x86_64-pc-windows-msvc'
|
19
|
+
```
|
@@ -39,11 +39,13 @@ module Licensed
|
|
39
39
|
#
|
40
40
|
# Returns whether the command succeeded for the dependency source enumerator
|
41
41
|
def run_source(app, source, report)
|
42
|
+
result = super
|
43
|
+
|
42
44
|
# add the full cache path to the list of cache paths
|
43
45
|
# that should be cleaned up after the command run
|
44
|
-
cache_paths << app.cache_path.join(source.class.type)
|
46
|
+
cache_paths << app.cache_path.join(source.class.type) unless result == :skipped
|
45
47
|
|
46
|
-
|
48
|
+
result
|
47
49
|
end
|
48
50
|
|
49
51
|
# Cache dependency record data.
|
@@ -121,13 +121,16 @@ module Licensed
|
|
121
121
|
# source - A dependency source enumerator
|
122
122
|
# report - A report object for this source
|
123
123
|
#
|
124
|
-
# Returns whether the command succeeded for the dependency source enumerator
|
124
|
+
# Returns whether the command succeeded, failed, or was skipped for the dependency source enumerator
|
125
125
|
def run_source(app, source, report)
|
126
126
|
reporter.begin_report_source(source, report)
|
127
127
|
|
128
128
|
if !sources_overrides.empty? && !sources_overrides.include?(source.class.type)
|
129
129
|
report.warnings << "skipped source"
|
130
|
-
|
130
|
+
|
131
|
+
# return a symbol to speficy the source was skipped.
|
132
|
+
# This is truthy and will result in the source being considered successful
|
133
|
+
return :skipped
|
131
134
|
end
|
132
135
|
|
133
136
|
dependencies = source.dependencies.sort_by { |dependency| dependency.name }
|
@@ -48,7 +48,7 @@ module Licensed
|
|
48
48
|
|
49
49
|
errored_reports = all_reports.select { |r| r.errors.any? }.to_a
|
50
50
|
|
51
|
-
dependency_count = all_reports.
|
51
|
+
dependency_count = all_reports.count { |r| r.target.is_a?(Licensed::Dependency) }
|
52
52
|
error_count = errored_reports.sum { |r| r.errors.size }
|
53
53
|
|
54
54
|
if error_count > 0
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Licensed
|
4
|
+
module Bundler
|
5
|
+
module DefinitionExtensions
|
6
|
+
attr_accessor :force_exclude_groups
|
7
|
+
|
8
|
+
# Override specs to avoid logic that would raise Gem::NotFound
|
9
|
+
# which is handled in this ./missing_specification.rb, and to not add
|
10
|
+
# bundler as a dependency if it's not a user-requested gem.
|
11
|
+
#
|
12
|
+
# Newer versions of Bundler have changed the implementation of specs_for
|
13
|
+
# as well which no longer calls this function. Overriding this function
|
14
|
+
# gives a stable access point for licensed
|
15
|
+
def specs
|
16
|
+
@specs ||= begin
|
17
|
+
specs = resolve.materialize(requested_dependencies)
|
18
|
+
|
19
|
+
all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))
|
20
|
+
if all_dependencies.any? { |d| d.name == "bundler" } && !specs["bundler"].any?
|
21
|
+
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", ::Bundler::VERSION)).last
|
22
|
+
specs["bundler"] = bundler
|
23
|
+
end
|
24
|
+
|
25
|
+
specs
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Override requested_groups to also exclude any groups that are
|
30
|
+
# in the "bundler.without" section of the licensed configuration file.
|
31
|
+
def requested_groups
|
32
|
+
super - Array(force_exclude_groups)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -38,17 +38,20 @@ module Licensed
|
|
38
38
|
"could not find #{name} (#{version}) in any sources"
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
module LazySpecification
|
43
|
+
def __materialize__
|
44
|
+
spec = super
|
45
|
+
return spec if spec
|
46
|
+
|
47
|
+
Licensed::Bundler::MissingSpecification.new(name: name, version: version, platform: platform, source: source)
|
48
|
+
end
|
49
|
+
end
|
41
50
|
end
|
42
51
|
end
|
43
52
|
|
44
53
|
module Bundler
|
45
54
|
class LazySpecification
|
46
|
-
|
47
|
-
def __materialize__
|
48
|
-
spec = orig_materialize
|
49
|
-
return spec if spec
|
50
|
-
|
51
|
-
Licensed::Bundler::MissingSpecification.new(name: name, version: version, platform: platform, source: source)
|
52
|
-
end
|
55
|
+
prepend ::Licensed::Bundler::LazySpecification
|
53
56
|
end
|
54
57
|
end
|
@@ -3,6 +3,7 @@ require "delegate"
|
|
3
3
|
begin
|
4
4
|
require "bundler"
|
5
5
|
require "licensed/sources/bundler/missing_specification"
|
6
|
+
require "licensed/sources/bundler/definition"
|
6
7
|
rescue LoadError
|
7
8
|
end
|
8
9
|
|
@@ -37,7 +38,6 @@ module Licensed
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
GEMFILES = { "Gemfile" => "Gemfile.lock", "gems.rb" => "gems.locked" }
|
41
41
|
DEFAULT_WITHOUT_GROUPS = %i{development test}
|
42
42
|
RUBY_PACKER_ERROR = "The bundler source cannot be used from the executable built with ruby-packer. Please install licensed using `gem install` or using bundler."
|
43
43
|
|
@@ -45,15 +45,20 @@ module Licensed
|
|
45
45
|
# running a ruby-packer-built licensed exe when ruby isn't available
|
46
46
|
# could lead to errors if the host ruby doesn't exist
|
47
47
|
return false if ruby_packer? && !Licensed::Shell.tool_available?("ruby")
|
48
|
-
|
48
|
+
|
49
|
+
# if Bundler isn't loaded, this enumerator won't work!
|
50
|
+
return false unless defined?(::Bundler)
|
51
|
+
|
52
|
+
with_application_environment { ::Bundler.default_lockfile&.exist? }
|
53
|
+
rescue ::Bundler::GemfileNotFound
|
54
|
+
false
|
49
55
|
end
|
50
56
|
|
51
57
|
def enumerate_dependencies
|
52
58
|
raise Licensed::Sources::Source::Error.new(RUBY_PACKER_ERROR) if ruby_packer?
|
53
59
|
|
54
|
-
|
55
|
-
specs.map do |spec|
|
56
|
-
next if spec.name == "bundler" && !include_bundler?
|
60
|
+
with_application_environment do
|
61
|
+
definition.specs.map do |spec|
|
57
62
|
next if spec.name == config["name"]
|
58
63
|
|
59
64
|
error = spec.error if spec.respond_to?(:error)
|
@@ -73,41 +78,13 @@ module Licensed
|
|
73
78
|
end
|
74
79
|
end
|
75
80
|
|
76
|
-
# Returns an array of Gem::Specifications for all gem dependencies
|
77
|
-
def specs
|
78
|
-
@specs ||= definition.specs_for(groups)
|
79
|
-
end
|
80
|
-
|
81
|
-
# Returns whether to include bundler as a listed dependency of the project
|
82
|
-
def include_bundler?
|
83
|
-
@include_bundler ||= begin
|
84
|
-
# include if bundler is listed as a direct dependency that should be included
|
85
|
-
requested_dependencies = definition.dependencies.select { |d| (d.groups & groups).any? && d.should_include? }
|
86
|
-
return true if requested_dependencies.any? { |d| d.name == "bundler" }
|
87
|
-
# include if bundler is an indirect dependency
|
88
|
-
return true if specs.flat_map(&:dependencies).any? { |d| d.name == "bundler" }
|
89
|
-
false
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
# Build the bundler definition
|
94
81
|
def definition
|
95
|
-
@definition ||=
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
@groups ||= definition.groups - bundler_setting_array(:without) + bundler_setting_array(:with) - exclude_groups
|
102
|
-
end
|
103
|
-
|
104
|
-
# Returns a bundler setting as an array.
|
105
|
-
# Depending on the version of bundler, array values are either returned as
|
106
|
-
# a raw string ("a:b:c") or as an array ([:a, :b, :c])
|
107
|
-
def bundler_setting_array(key)
|
108
|
-
setting = ::Bundler.settings[key]
|
109
|
-
setting = setting.split(":").map(&:to_sym) if setting.is_a?(String)
|
110
|
-
Array(setting)
|
82
|
+
@definition ||= begin
|
83
|
+
definition = ::Bundler::Definition.build(::Bundler.default_gemfile, ::Bundler.default_lockfile, nil)
|
84
|
+
definition.extend Licensed::Bundler::DefinitionExtensions
|
85
|
+
definition.force_exclude_groups = exclude_groups
|
86
|
+
definition
|
87
|
+
end
|
111
88
|
end
|
112
89
|
|
113
90
|
# Returns any groups to exclude specified from both licensed configuration
|
@@ -121,46 +98,33 @@ module Licensed
|
|
121
98
|
end
|
122
99
|
end
|
123
100
|
|
124
|
-
#
|
125
|
-
def
|
126
|
-
|
127
|
-
.map { |g| config.pwd.join g }
|
128
|
-
.find { |f| f.exist? }
|
129
|
-
end
|
101
|
+
# helper to clear all bundler environment around a yielded block
|
102
|
+
def with_application_environment
|
103
|
+
backup = nil
|
130
104
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
105
|
+
::Bundler.ui.silence do
|
106
|
+
if ::Bundler.root != config.source_path
|
107
|
+
backup = ENV.to_hash
|
108
|
+
ENV.replace(::Bundler.original_env)
|
136
109
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
bundler_ui, ::Bundler.ui = ::Bundler.ui, ::Bundler::UI::Silent.new
|
110
|
+
# reset bundler to load from the current app's source path
|
111
|
+
::Bundler.reset!
|
112
|
+
end
|
141
113
|
|
142
|
-
|
143
|
-
|
144
|
-
# force bundler to use the local gem file
|
145
|
-
original_bundle_gemfile, ENV["BUNDLE_GEMFILE"] = ENV["BUNDLE_GEMFILE"], gemfile_path.to_s
|
114
|
+
# ensure the bundler environment is loaded before enumeration
|
115
|
+
::Bundler.load
|
146
116
|
|
147
|
-
|
148
|
-
::Bundler.reset!
|
149
|
-
# and re-configure with settings for current directory
|
150
|
-
::Bundler.configure
|
117
|
+
yield
|
151
118
|
end
|
152
|
-
|
153
|
-
yield
|
154
119
|
ensure
|
155
|
-
if
|
156
|
-
ENV["BUNDLE_GEMFILE"] = original_bundle_gemfile
|
157
|
-
|
120
|
+
if backup
|
158
121
|
# restore bundler configuration
|
122
|
+
ENV.replace(backup)
|
159
123
|
::Bundler.reset!
|
160
|
-
::Bundler.configure
|
161
124
|
end
|
162
125
|
|
163
|
-
|
126
|
+
# reload the bundler environment after enumeration
|
127
|
+
::Bundler.load
|
164
128
|
end
|
165
129
|
|
166
130
|
# Returns whether the current licensed execution is running ruby-packer
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Licensed
|
6
|
+
module Sources
|
7
|
+
class Cargo < Source
|
8
|
+
# Source is enabled when the cargo tool and Cargo.toml manifest file are available
|
9
|
+
def enabled?
|
10
|
+
return false unless Licensed::Shell.tool_available?("cargo")
|
11
|
+
config.pwd.join("Cargo.toml").exist?
|
12
|
+
end
|
13
|
+
|
14
|
+
def enumerate_dependencies
|
15
|
+
packages.map do |package|
|
16
|
+
Dependency.new(
|
17
|
+
name: "#{package["name"]}-#{package["version"]}",
|
18
|
+
version: package["version"],
|
19
|
+
path: File.dirname(package["manifest_path"]),
|
20
|
+
metadata: {
|
21
|
+
"name" => package["name"],
|
22
|
+
"type" => Cargo.type,
|
23
|
+
"summary" => package["description"],
|
24
|
+
"homepage" => package["homepage"]
|
25
|
+
}
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns the package data for all dependencies used to build the current package
|
31
|
+
def packages
|
32
|
+
cargo_metadata_resolved_node_ids.map { |id| cargo_metadata_packages[id] }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns the ids of all resolved nodes used to build the current package
|
36
|
+
def cargo_metadata_resolved_node_ids
|
37
|
+
cargo_metadata.dig("resolve", "nodes")
|
38
|
+
.map { |node| node["id"] }
|
39
|
+
.reject { |id| cargo_metadata_workspace_members.include?(id) }
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns a hash of id => package pairs sourced from the "packages" cargo metadata property
|
44
|
+
def cargo_metadata_packages
|
45
|
+
@cargo_metadata_packages ||= cargo_metadata["packages"].each_with_object({}) do |package, hsh|
|
46
|
+
hsh[package["id"]] = package
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns a set of the ids of packages in the current workspace
|
51
|
+
def cargo_metadata_workspace_members
|
52
|
+
@cargo_metadata_workspace_members ||= Set.new(Array(cargo_metadata["workspace_members"]))
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns parsed JSON metadata returned from the cargo CLI
|
56
|
+
def cargo_metadata
|
57
|
+
@cargo_metadata ||= JSON.parse(cargo_metadata_command)
|
58
|
+
rescue JSON::ParserError => e
|
59
|
+
message = "Licensed was unable to parse the output from 'cargo metadata'. JSON Error: #{e.message}"
|
60
|
+
raise Licensed::Sources::Source::Error, message
|
61
|
+
end
|
62
|
+
|
63
|
+
# Runs a command to get cargo metadata for the current package
|
64
|
+
def cargo_metadata_command
|
65
|
+
options = Array(config.dig("cargo", "metadata_options")).flat_map(&:split)
|
66
|
+
Licensed::Shell.execute("cargo", "metadata", "--format-version=1", *options)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/licensed/sources/dep.rb
CHANGED
@@ -40,10 +40,10 @@ module Licensed
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# Returns the
|
43
|
+
# Returns the pkg.go.dev page for a package.
|
44
44
|
def homepage(import_path)
|
45
45
|
return unless import_path
|
46
|
-
"https://
|
46
|
+
"https://pkg.go.dev/#{import_path}"
|
47
47
|
end
|
48
48
|
|
49
49
|
# Returns whether the package is part of the go std list. Replaces
|
data/lib/licensed/sources/go.rb
CHANGED
@@ -98,7 +98,7 @@ module Licensed
|
|
98
98
|
# Returns whether the package is local to the current project
|
99
99
|
def local_package?(package)
|
100
100
|
return false unless package && package["Dir"]
|
101
|
-
return false unless File.fnmatch?("#{config.root
|
101
|
+
return false unless File.fnmatch?("#{config.root}*", package["Dir"], File::FNM_CASEFOLD)
|
102
102
|
vendored_path_parts(package).nil?
|
103
103
|
end
|
104
104
|
|
@@ -132,10 +132,10 @@ module Licensed
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
# Returns the
|
135
|
+
# Returns the pkg.go.dev page for a package.
|
136
136
|
def homepage(import_path)
|
137
137
|
return unless import_path
|
138
|
-
"https://
|
138
|
+
"https://pkg.go.dev/#{import_path}"
|
139
139
|
end
|
140
140
|
|
141
141
|
# Returns the root directory to search for a package license
|
@@ -61,11 +61,12 @@ module Licensed
|
|
61
61
|
|
62
62
|
paths = paths.compact.select { |path| File.file?(path) }
|
63
63
|
return if paths.empty?
|
64
|
-
|
64
|
+
# rubocop:disable GitHub/InsecureHashAlgorithm
|
65
65
|
paths.sort
|
66
66
|
.reduce(Digest::XXHash64.new, :file)
|
67
67
|
.digest
|
68
68
|
.to_s(16) # convert to hex
|
69
|
+
# rubocop:enable GitHub/InsecureHashAlgorithm
|
69
70
|
end
|
70
71
|
end
|
71
72
|
end
|
data/lib/licensed/sources.rb
CHANGED
@@ -5,6 +5,7 @@ module Licensed
|
|
5
5
|
require "licensed/sources/bower"
|
6
6
|
require "licensed/sources/bundler"
|
7
7
|
require "licensed/sources/cabal"
|
8
|
+
require "licensed/sources/cargo"
|
8
9
|
require "licensed/sources/composer"
|
9
10
|
require "licensed/sources/dep"
|
10
11
|
require "licensed/sources/git_submodule"
|
data/lib/licensed/version.rb
CHANGED
data/licensed.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = "https://github.com/github/licensed"
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
19
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test/|script/|docker/|\..+)}) }
|
20
20
|
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
@@ -26,16 +26,16 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency "licensee", ">= 9.14.0", "< 10.0.0"
|
27
27
|
spec.add_dependency "thor", ">= 0.19"
|
28
28
|
spec.add_dependency "pathname-common_prefix", "~> 0.0.1"
|
29
|
-
spec.add_dependency "tomlrb", "
|
29
|
+
spec.add_dependency "tomlrb", ">= 1.2", "< 3.0"
|
30
30
|
spec.add_dependency "bundler", ">= 1.10"
|
31
31
|
spec.add_dependency "ruby-xxHash", "~> 0.4"
|
32
32
|
spec.add_dependency "parallel", ">= 0.18.0"
|
33
|
-
spec.add_dependency "reverse_markdown", "
|
33
|
+
spec.add_dependency "reverse_markdown", ">= 1", "< 3"
|
34
34
|
|
35
35
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
36
36
|
spec.add_development_dependency "minitest", "~> 5.8"
|
37
37
|
spec.add_development_dependency "mocha", "~> 1.0"
|
38
|
-
spec.add_development_dependency "rubocop", "~> 0.49", "<
|
38
|
+
spec.add_development_dependency "rubocop", "~> 0.49", "< 1.20"
|
39
39
|
spec.add_development_dependency "rubocop-github", "~> 0.6"
|
40
|
-
spec.add_development_dependency "byebug", "~>
|
40
|
+
spec.add_development_dependency "byebug", "~> 11.0.1"
|
41
41
|
end
|