licensed 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +28 -11
- data/CHANGELOG.md +19 -0
- data/README.md +25 -80
- data/docs/adding_a_new_source.md +11 -8
- data/docs/commands/README.md +59 -0
- data/docs/commands/cache.md +35 -0
- data/docs/commands/env.md +10 -0
- data/docs/commands/list.md +23 -0
- data/docs/commands/migrate.md +10 -0
- data/docs/commands/notices.md +12 -0
- data/docs/commands/status.md +73 -0
- data/docs/commands/version.md +3 -0
- data/docs/configuration.md +9 -173
- data/docs/configuration/README.md +11 -0
- data/docs/configuration/allowed_licenses.md +17 -0
- data/docs/configuration/application_name.md +63 -0
- data/docs/configuration/application_source.md +64 -0
- data/docs/configuration/configuration_root.md +27 -0
- data/docs/configuration/configuring_multiple_apps.md +58 -0
- data/docs/configuration/dependency_source_enumerators.md +28 -0
- data/docs/configuration/ignoring_dependencies.md +19 -0
- data/docs/configuration/metadata_cache.md +106 -0
- data/docs/configuration/reviewing_dependencies.md +18 -0
- data/lib/licensed.rb +1 -0
- data/lib/licensed/cli.rb +2 -2
- data/lib/licensed/commands/cache.rb +19 -20
- data/lib/licensed/commands/command.rb +104 -72
- data/lib/licensed/commands/environment.rb +12 -11
- data/lib/licensed/commands/list.rb +0 -19
- data/lib/licensed/commands/notices.rb +0 -19
- data/lib/licensed/commands/status.rb +13 -15
- data/lib/licensed/configuration.rb +77 -7
- data/lib/licensed/report.rb +44 -0
- data/lib/licensed/reporters/cache_reporter.rb +48 -64
- data/lib/licensed/reporters/json_reporter.rb +19 -21
- data/lib/licensed/reporters/list_reporter.rb +45 -58
- data/lib/licensed/reporters/notices_reporter.rb +33 -46
- data/lib/licensed/reporters/reporter.rb +37 -104
- data/lib/licensed/reporters/status_reporter.rb +58 -56
- data/lib/licensed/reporters/yaml_reporter.rb +19 -21
- data/lib/licensed/sources/bundler.rb +1 -1
- data/lib/licensed/sources/gradle.rb +2 -2
- data/lib/licensed/sources/npm.rb +4 -3
- data/lib/licensed/version.rb +1 -1
- data/script/source-setup/go +1 -1
- metadata +21 -3
- data/docs/commands.md +0 -95
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46db33bf2c824a144fbe5a85acfef469c35faeec69c3afd15a6df0c363025174
|
4
|
+
data.tar.gz: 73e300eaeebd28afed3ded55f60fc24b0fae9d20795ac150322c1b1975052215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d487c920e977198ac91f7eeac4fbea8c4c49a326c6d449532a06e206e9472d75276879a6e3247fee7f6e64d87f595300b3c7ee995e8d1d595fb53401888ccec
|
7
|
+
data.tar.gz: 77ac80e1833b1c02cbb67aac8a79422e2af24958f89a577f07a0885fb7c3cbbc71dc61e0d5fb1bd453b58a1e6d8d0c5b47bf65fdf669edec4347012af83363b9
|
data/.github/workflows/test.yml
CHANGED
@@ -33,7 +33,7 @@ jobs:
|
|
33
33
|
runs-on: ubuntu-latest
|
34
34
|
strategy:
|
35
35
|
matrix:
|
36
|
-
bundler: [ '~> 1.
|
36
|
+
bundler: [ '~> 1.17.0', '~> 2.0.0', '~> 2.1.0', '~> 2.2.0' ]
|
37
37
|
steps:
|
38
38
|
- uses: actions/checkout@v2
|
39
39
|
- name: Set up Ruby
|
@@ -60,8 +60,8 @@ jobs:
|
|
60
60
|
runs-on: ubuntu-latest
|
61
61
|
strategy:
|
62
62
|
matrix:
|
63
|
-
ghc: [ '8.
|
64
|
-
cabal: [ '
|
63
|
+
ghc: [ '8.6', '8.8', '8.10', '9.0' ]
|
64
|
+
cabal: [ '3.0', '3.2', '3.4' ]
|
65
65
|
steps:
|
66
66
|
- uses: actions/checkout@v2
|
67
67
|
- name: Set up Ruby
|
@@ -89,7 +89,7 @@ jobs:
|
|
89
89
|
runs-on: ubuntu-latest
|
90
90
|
strategy:
|
91
91
|
matrix:
|
92
|
-
php: [ '7.
|
92
|
+
php: [ '7.4', '8.0' ]
|
93
93
|
steps:
|
94
94
|
- uses: actions/checkout@v2
|
95
95
|
- name: Setup php
|
@@ -116,7 +116,7 @@ jobs:
|
|
116
116
|
runs-on: ubuntu-latest
|
117
117
|
strategy:
|
118
118
|
matrix:
|
119
|
-
ruby: [ 2.
|
119
|
+
ruby: [ 2.6, 2.7, 3.0 ]
|
120
120
|
steps:
|
121
121
|
- uses: actions/checkout@v2
|
122
122
|
- name: Set up Ruby
|
@@ -165,7 +165,7 @@ jobs:
|
|
165
165
|
runs-on: ubuntu-latest
|
166
166
|
strategy:
|
167
167
|
matrix:
|
168
|
-
go: [ '1.
|
168
|
+
go: [ '1.12.x', '1.13.x', '1.14.x', '1.15.x', '1.16.x' ]
|
169
169
|
steps:
|
170
170
|
- uses: actions/checkout@v2
|
171
171
|
- name: Setup go
|
@@ -187,9 +187,18 @@ jobs:
|
|
187
187
|
run: script/source-setup/go
|
188
188
|
- name: Run tests
|
189
189
|
run: script/test go
|
190
|
+
env:
|
191
|
+
GO111MODULE: "on"
|
190
192
|
|
191
193
|
gradle:
|
192
194
|
runs-on: ubuntu-latest
|
195
|
+
strategy:
|
196
|
+
matrix:
|
197
|
+
# TODO: the reporting plugin used to gather data is not yet fully compatible with
|
198
|
+
# gradle 7, which is needed for compatibility with Java 16. after compatibility issues
|
199
|
+
# are resolved, update this matrix list with '16'.
|
200
|
+
# possibly fixed by https://github.com/jk1/Gradle-License-Report/pull/166
|
201
|
+
java: [ '11' ]
|
193
202
|
steps:
|
194
203
|
- uses: actions/checkout@v2
|
195
204
|
- name: Set up Ruby
|
@@ -197,6 +206,11 @@ jobs:
|
|
197
206
|
with:
|
198
207
|
ruby-version: 2.6
|
199
208
|
- run: bundle lock
|
209
|
+
- name: Set up Java
|
210
|
+
uses: actions/setup-java@v2
|
211
|
+
with:
|
212
|
+
java-version: ${{ matrix.java }}
|
213
|
+
distribution: adopt
|
200
214
|
- uses: actions/cache@v1
|
201
215
|
with:
|
202
216
|
path: vendor/gems
|
@@ -230,8 +244,8 @@ jobs:
|
|
230
244
|
runs-on: ubuntu-latest
|
231
245
|
strategy:
|
232
246
|
matrix:
|
233
|
-
otp: [
|
234
|
-
elixir: [ 1.
|
247
|
+
otp: [22.x, 23.x, 24.x]
|
248
|
+
elixir: [ 1.11.x, 1.12.x ]
|
235
249
|
steps:
|
236
250
|
- uses: actions/checkout@v2
|
237
251
|
- uses: erlef/setup-elixir@v1.6.0
|
@@ -258,7 +272,7 @@ jobs:
|
|
258
272
|
runs-on: ubuntu-latest
|
259
273
|
strategy:
|
260
274
|
matrix:
|
261
|
-
node_version: [
|
275
|
+
node_version: [ 12, 14, 16 ]
|
262
276
|
steps:
|
263
277
|
- uses: actions/checkout@v2
|
264
278
|
- name: Setup node
|
@@ -283,12 +297,15 @@ jobs:
|
|
283
297
|
|
284
298
|
nuget:
|
285
299
|
runs-on: ubuntu-latest
|
300
|
+
strategy:
|
301
|
+
matrix:
|
302
|
+
dotnet: [ '3.1.x', '5.x' ]
|
286
303
|
steps:
|
287
304
|
- uses: actions/checkout@v2
|
288
305
|
- name: Setup dotnet
|
289
306
|
uses: actions/setup-dotnet@v1
|
290
307
|
with:
|
291
|
-
dotnet-version:
|
308
|
+
dotnet-version: ${{ matrix.dotnet }}
|
292
309
|
- name: Set up Ruby
|
293
310
|
uses: ruby/setup-ruby@v1
|
294
311
|
with:
|
@@ -309,7 +326,7 @@ jobs:
|
|
309
326
|
runs-on: ubuntu-latest
|
310
327
|
strategy:
|
311
328
|
matrix:
|
312
|
-
python: [ '
|
329
|
+
python: [ '3.6', '3.7', '3.8', '3.9' ]
|
313
330
|
steps:
|
314
331
|
- uses: actions/checkout@v2
|
315
332
|
- name: Setup python
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## 3.2.0
|
10
|
+
|
11
|
+
2021-08-19
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Application names can be dynamically generated based on the path to the application source (https://github.com/github/licensed/pull/375)
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Updated command documentation (https://github.com/github/licensed/pull/378, https://github.com/github/licensed/pull/380/files)
|
20
|
+
- Updated configuration documentation (https://github.com/github/licensed/pull/375)
|
21
|
+
- Cache and status commands give additional diagnostic output when using JSON and YAML formatters (https://github.com/github/licensed/pull/378)
|
22
|
+
- Status command will give users a link to documentation when compliance checks fail (https://github.com/github/licensed/pull/381)
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- The bundler source correctly checks that the path bundler specifies a gem is loaded from is a file (https://github.com/github/licensed/pull/379)
|
27
|
+
|
9
28
|
## 3.1.0
|
10
29
|
|
11
30
|
2021-06-16
|
data/README.md
CHANGED
@@ -37,13 +37,13 @@ See the [v2 migration documentation](./docs/migrations/v2.md) for more info on m
|
|
37
37
|
|
38
38
|
Licensed uses the `libgit2` bindings for Ruby provided by `rugged`. `rugged` requires `cmake` and `pkg-config` which you may need to install before you can install Licensed.
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
> OS X
|
40
|
+
```bash
|
41
|
+
# Ubuntu
|
42
|
+
sudo apt-get install cmake pkg-config
|
45
43
|
|
46
|
-
|
44
|
+
# macOS
|
45
|
+
brew install cmake pkg-config
|
46
|
+
```
|
47
47
|
|
48
48
|
### With a Gemfile
|
49
49
|
|
@@ -56,7 +56,7 @@ gem 'licensed', :group => 'development'
|
|
56
56
|
And then execute:
|
57
57
|
|
58
58
|
```bash
|
59
|
-
|
59
|
+
$> bundle
|
60
60
|
```
|
61
61
|
|
62
62
|
### As an executable
|
@@ -64,24 +64,27 @@ $ bundle
|
|
64
64
|
Download a package from GitHub and extract the executable. Executable packages are available for each release starting with version 1.2.0.
|
65
65
|
|
66
66
|
```bash
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
$> curl -sSL https://github.com/github/licensed/releases/download/<version>/licensed-<version>-<os>-x64.tar.gz > licensed.tar.gz
|
68
|
+
$> tar -xzf licensed.tar.gz
|
69
|
+
$> rm -f licensed.tar.gz
|
70
|
+
$> ./licensed list
|
71
71
|
```
|
72
72
|
|
73
73
|
For system wide usage, install licensed to a location on `$PATH`, e.g. `/usr/local/bin`.
|
74
74
|
|
75
75
|
## Usage
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
- `licensed notices`: Write a `NOTICE` file for each application configuration.
|
81
|
-
- `licensed version`: Show current installed version of Licensed. Aliases: `-v|--version`
|
82
|
-
- `licensed env`: Output environment information from the licensed configuration.
|
77
|
+
### Available commands
|
78
|
+
|
79
|
+
See the [commands documentation](./docs/commands) for documentation on available commands, or run `licensed -h` to see all of the current available commands.
|
83
80
|
|
84
|
-
|
81
|
+
### Configuration options
|
82
|
+
|
83
|
+
A configuration file is required for most commands. See the [configuration file documentation](./docs/configuration.md) for more details on the configuration format and available configuration options.
|
84
|
+
|
85
|
+
### Available dependency sources
|
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/sources.md).
|
85
88
|
|
86
89
|
### Automation
|
87
90
|
|
@@ -95,80 +98,22 @@ The [licensed-ci](https://github.com/marketplace/actions/licensed-ci) GitHub Act
|
|
95
98
|
|
96
99
|
The [setup-licensed](https://github.com/marketplace/actions/setup-github-licensed) GitHub Action installs `licensed` to the workflow environment. See the linked actions for usage and details.
|
97
100
|
|
98
|
-
### Configuration
|
99
|
-
|
100
|
-
All commands, except `version`, accept a `-c|--config` option to specify a path to a configuration file or directory.
|
101
|
-
|
102
|
-
If a directory is specified, `licensed` will look in that directory for a file named (in order of preference):
|
103
|
-
1. `.licensed.yml`
|
104
|
-
2. `.licensed.yaml`
|
105
|
-
3. `.licensed.json`
|
106
|
-
|
107
|
-
If the option is not specified, the value will be set to the current directory.
|
108
|
-
|
109
|
-
See the [configuration file documentation](./docs/configuration.md) for more details on the configuration format.
|
110
|
-
|
111
|
-
### Sources
|
112
|
-
|
113
|
-
Dependencies will be automatically detected for all of the following sources by default.
|
114
|
-
1. [Bower](./docs/sources/bower.md)
|
115
|
-
1. [Bundler](./docs/sources/bundler.md)
|
116
|
-
1. [Cabal](./docs/sources/cabal.md)
|
117
|
-
1. [Composer](./docs/sources/composer.md)
|
118
|
-
1. [Git Submodules (git_submodule)](./docs/sources/git_submodule.md)
|
119
|
-
1. [Go](./docs/sources/go.md)
|
120
|
-
1. [Go Dep (dep)](./docs/sources/dep.md)
|
121
|
-
1. [Gradle](./docs/sources/gradle.md)
|
122
|
-
1. [Manifest lists (manifests)](./docs/sources/manifests.md)
|
123
|
-
1. [Mix](./docs/sources/mix.md)
|
124
|
-
1. [npm](./docs/sources/npm.md)
|
125
|
-
1. [NuGet](./docs/sources/nuget.md)
|
126
|
-
1. [Pip](./docs/sources/pip.md)
|
127
|
-
1. [Pipenv](./docs/sources/pipenv.md)
|
128
|
-
1. [Swift](./docs/sources/swift.md)
|
129
|
-
1. [Yarn](./docs/sources/yarn.md)
|
130
|
-
|
131
|
-
You can disable any of them in the configuration file:
|
132
|
-
|
133
|
-
```yml
|
134
|
-
sources:
|
135
|
-
bundler: false
|
136
|
-
npm: false
|
137
|
-
bower: false
|
138
|
-
cabal: false
|
139
|
-
```
|
140
|
-
|
141
101
|
## Development
|
142
102
|
|
143
103
|
To get started after checking out the repo, run
|
104
|
+
|
144
105
|
1. `script/bootstrap` to install dependencies
|
145
106
|
2. `script/setup` to setup test fixtures.
|
146
107
|
- `script/setup -f` will force a clean test fixture environment
|
147
|
-
3. `script/cibuild` to run the tests
|
108
|
+
3. `script/cibuild` to run the tests
|
148
109
|
|
149
110
|
You can also run `script/console` for an interactive prompt that will allow you to experiment.
|
150
111
|
|
151
112
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
152
113
|
|
153
|
-
|
154
|
-
|
155
|
-
When adding new dependency sources, ensure that `script/bootstrap` scripting and tests are only run if the required tooling is available on the development machine.
|
156
|
-
|
157
|
-
* See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
|
158
|
-
* Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
|
159
|
-
```ruby
|
160
|
-
if Licensed::Shell.tool_available?('bundle')
|
161
|
-
describe Licensed::Source::Bundler do
|
162
|
-
...
|
163
|
-
end
|
164
|
-
end
|
165
|
-
```
|
166
|
-
|
167
|
-
See the [documentation on adding new sources](./docs/adding_a_new_source.md) for more information.
|
168
|
-
|
169
|
-
#### Adding Commands
|
114
|
+
### Adding a new source
|
170
115
|
|
171
|
-
See the [documentation on
|
116
|
+
See the [documentation on adding new sources](./docs/adding_a_new_source.md) for detailed information on what's required to add a new dependency source enumerator.
|
172
117
|
|
173
118
|
## Contributing
|
174
119
|
|
data/docs/adding_a_new_source.md
CHANGED
@@ -4,13 +4,15 @@
|
|
4
4
|
|
5
5
|
Dependency enumerators inherit and override the [`Licensed::Sources::Source`](../lib/licensed/sources/source.rb) class.
|
6
6
|
|
7
|
-
|
7
|
+
### Required method overrides
|
8
|
+
|
8
9
|
1. `Licensed::Sources::Source#enabled?`
|
9
10
|
- Returns whether dependencies can be enumerated in the current environment.
|
10
11
|
2. `Licensed::Sources::Source#enumerate_dependencies`
|
11
12
|
- Returns an enumeration of `Licensed::Dependency` objects found which map to the dependencies of the current project.
|
12
13
|
|
13
|
-
|
14
|
+
### Optional method overrides
|
15
|
+
|
14
16
|
1. `Licensed::Sources::Source.type`
|
15
17
|
- Returns the name of the current dependency enumerator as it is found in a licensed configuration file.
|
16
18
|
|
@@ -22,12 +24,13 @@ whether `Licensed::Source::Sources#enumerate_dependencies` should be called on t
|
|
22
24
|
Determining whether dependencies should be enumerated depends on whether all the tools or files needed to find dependencies are present.
|
23
25
|
For example, to enumerate `npm` dependencies the `npm` CLI tool must be found with `Licensed::Shell.tool_available?` and a `package.json` file needs to exist in the licensed app's configured [`source_path`](./configuration.md#configuration-paths).
|
24
26
|
|
25
|
-
|
27
|
+
### Gating functionality when required tools are not available.
|
26
28
|
|
27
29
|
When adding new dependency sources, ensure that `script/bootstrap` scripting and tests are only run if the required tooling is available on the development machine.
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
+
- See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
|
32
|
+
- Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
|
33
|
+
|
31
34
|
```ruby
|
32
35
|
if Licensed::Shell.tool_available?('bundle')
|
33
36
|
describe Licensed::Source::Bundler do
|
@@ -47,11 +50,11 @@ Relying on external tools always has a risk that the tool could change. It's ge
|
|
47
50
|
or other implementation details as these could change over time. CLI tools that provides the necessary information are generally preferred
|
48
51
|
as they will more likely have requirements for backwards compatibility.
|
49
52
|
|
50
|
-
|
53
|
+
### Creating dependency objects
|
51
54
|
|
52
55
|
Creating a new `Licensed::Dependency` object requires name, version, and path arguments. Dependency objects optionally accept a path to use as search root when finding licenses along with any other metadata that is useful to identify the dependency.
|
53
56
|
|
54
|
-
|
57
|
+
#### `Licensed::Dependency` arguments
|
55
58
|
|
56
59
|
1. name (required)
|
57
60
|
- The name of the dependency. Together with the version, this should uniquely identify the dependency.
|
@@ -71,7 +74,7 @@ Creating a new `Licensed::Dependency` object requires name, version, and path ar
|
|
71
74
|
6. errors (optional)
|
72
75
|
- Any errors found when loading dependency information.
|
73
76
|
|
74
|
-
|
77
|
+
#### Creating specialized Dependency objects
|
75
78
|
|
76
79
|
`Licensed::Dependency` objects inherit from `Licensee::Projects::FsProject` and can override or extend the default `Licensee` behavior to find files for a dependency.
|
77
80
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Commands
|
2
|
+
|
3
|
+
Run `licensed -h` to see help content for running licensed commands.
|
4
|
+
|
5
|
+
- [cache](cache.md)
|
6
|
+
- [env](env.md)
|
7
|
+
- [list](list.md)
|
8
|
+
- [migrate](migrate.md)
|
9
|
+
- [notices](notices.md)
|
10
|
+
- [status](status.md)
|
11
|
+
- [version](verison.md)
|
12
|
+
|
13
|
+
Most commands accept a `-c`/`--config` option to specify a path to a configuration file or directory. If a directory is specified, `licensed` will look in that directory for a file named (in order of preference):
|
14
|
+
|
15
|
+
1. `.licensed.yml`
|
16
|
+
2. `.licensed.yaml`
|
17
|
+
3. `.licensed.json`
|
18
|
+
|
19
|
+
If the option is not specified, the value will be set to the current directory.
|
20
|
+
|
21
|
+
## Adding a new command
|
22
|
+
|
23
|
+
### Implement new `Command` class
|
24
|
+
|
25
|
+
Licensed commands inherit and override the [`Licensed::Sources::Command`](../lib/licensed/commands/command.rb) class.
|
26
|
+
|
27
|
+
### Required method overrides
|
28
|
+
|
29
|
+
1. `Licensed::Commands::Command#evaluate_dependency`
|
30
|
+
- Runs a command execution on an application dependency.
|
31
|
+
|
32
|
+
The `evaluate_dependency` method should contain the specific command logic. This method has access to the application configuration, dependency source enumerator and dependency currently being evaluated as well as a reporting hash to contain information about the command execution.
|
33
|
+
|
34
|
+
### Optional method overrides
|
35
|
+
|
36
|
+
The following methods break apart the different levels of command execution. Each method wraps lower levels of command execution in a corresponding reporter method.
|
37
|
+
|
38
|
+
1. `Licensed::Commands::Command#run`
|
39
|
+
- Runs `run_app` for each application configuration found. Wraps the execution of all applications in `Reporter#report_run`.
|
40
|
+
2. `Licensed::Commands::Command#run_app`
|
41
|
+
- Runs `run_source` for each dependency source enumerator enabled for the application configuration. Wraps the execution of all sources in `Reporter#report_app`.
|
42
|
+
3. `Licensed::Commands::Command#run_source`
|
43
|
+
- Runs `run_dependency` for each dependency found in the source. Wraps the execution of all dependencies in `Reporter#report_source`.
|
44
|
+
4. `Licensed::Commands::Command#run_dependency`
|
45
|
+
- Runs `evaluate_dependency` for the dependency. Wraps the execution of all dependencies in `Reporter#report_dependency`.
|
46
|
+
|
47
|
+
As an example, `Licensed::Commands::Command#run_app` calls `Reporter#report_app` to wrap every call to `Licensed::Commands::Command#run_source`.
|
48
|
+
|
49
|
+
### Specifying additional report data
|
50
|
+
|
51
|
+
The `run` methods can be overridden and pass a block to `super` to provide additional reporting data or functionality.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
def run_app(app)
|
55
|
+
super do |report|
|
56
|
+
report["my_app_data"] = true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
```
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# `licensed cache`
|
2
|
+
|
3
|
+
The cache command finds all dependencies and ensures that each dependency has an up-to-date cached record.
|
4
|
+
|
5
|
+
Dependency records will be saved if:
|
6
|
+
|
7
|
+
1. The `force` option is set
|
8
|
+
2. No cached record is found
|
9
|
+
3. The cached record's version is different than the current dependency's version
|
10
|
+
- If the cached record's license text contents matches the current dependency's license text then the `license` metadata from the cached record is retained for the new saved record.
|
11
|
+
|
12
|
+
After the cache command is run, any cached records that don't match up to a current application dependency will be deleted.
|
13
|
+
|
14
|
+
## Options
|
15
|
+
|
16
|
+
- `--config`/`-c`: the path to the licensed configuration file
|
17
|
+
- default value: `./.licensed.yml`
|
18
|
+
- `--sources`/`-s`: runtime filter on which dependency sources are run. Sources must also be enabled in the licensed configuration file.
|
19
|
+
- default value: not set, all configured sources
|
20
|
+
- `--format`/`-f`: the output format
|
21
|
+
- default value: `yaml`
|
22
|
+
- `--force`: if set, forces all dependency metadata files to be recached
|
23
|
+
- default value: not set
|
24
|
+
|
25
|
+
## Reported Data
|
26
|
+
|
27
|
+
The following data is reported for each dependency when the YAML or JSON report formats are used
|
28
|
+
|
29
|
+
- name: the licensed recognized name for the dependency including the app and source name
|
30
|
+
- e.g. the full name for the `thor` bundler dependency used by this tool is `licensed.bundler.thor`
|
31
|
+
- cached: true when the dependency's cached metadata file was updated, false otherwise
|
32
|
+
- version: the version of the enumerated dependency
|
33
|
+
- license: the dependency's SPDX license identifier
|
34
|
+
- filename: the full path on disk to the dependency's cached metadata file, if available
|
35
|
+
- warnings: any warning messages encountered while enumerating and caching dependency metadata, if available
|