licensed 2.15.2 → 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 +55 -11
- data/CHANGELOG.md +56 -1
- data/README.md +38 -81
- 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 -161
- 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/docs/{migrating_to_newer_versions.md → migrations/v2.md} +1 -1
- data/docs/migrations/v3.md +109 -0
- data/docs/sources/bundler.md +1 -11
- data/docs/sources/swift.md +4 -0
- data/lib/licensed.rb +1 -0
- data/lib/licensed/cli.rb +6 -3
- 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 +105 -12
- 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.rb +1 -0
- data/lib/licensed/sources/bundler.rb +36 -217
- data/lib/licensed/sources/bundler/missing_specification.rb +54 -0
- data/lib/licensed/sources/go.rb +1 -1
- data/lib/licensed/sources/gradle.rb +2 -2
- data/lib/licensed/sources/npm.rb +4 -3
- data/lib/licensed/sources/nuget.rb +57 -27
- data/lib/licensed/sources/swift.rb +69 -0
- data/lib/licensed/version.rb +1 -1
- data/script/source-setup/go +1 -1
- data/script/source-setup/swift +22 -0
- metadata +27 -4
- 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
|
@@ -362,6 +379,33 @@ jobs:
|
|
362
379
|
- name: Run tests
|
363
380
|
run: script/test pipenv
|
364
381
|
|
382
|
+
swift:
|
383
|
+
runs-on: ubuntu-latest
|
384
|
+
strategy:
|
385
|
+
matrix:
|
386
|
+
swift: [ "5.4", "5.3" ]
|
387
|
+
steps:
|
388
|
+
- uses: actions/checkout@v2
|
389
|
+
- name: Setup Swift
|
390
|
+
uses: fwal/setup-swift@v1
|
391
|
+
with:
|
392
|
+
swift-version: ${{ matrix.swift }}
|
393
|
+
- name: Set up Ruby
|
394
|
+
uses: ruby/setup-ruby@v1
|
395
|
+
with:
|
396
|
+
ruby-version: 2.6
|
397
|
+
- run: bundle lock
|
398
|
+
- uses: actions/cache@v1
|
399
|
+
with:
|
400
|
+
path: vendor/gems
|
401
|
+
key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
|
402
|
+
- name: Bootstrap
|
403
|
+
run: script/bootstrap
|
404
|
+
- name: Set up fixtures
|
405
|
+
run: script/source-setup/swift
|
406
|
+
- name: Run tests
|
407
|
+
run: script/test swift
|
408
|
+
|
365
409
|
yarn:
|
366
410
|
runs-on: ubuntu-latest
|
367
411
|
strategy:
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,61 @@ 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
|
+
|
28
|
+
## 3.1.0
|
29
|
+
|
30
|
+
2021-06-16
|
31
|
+
|
32
|
+
### Added
|
33
|
+
|
34
|
+
- Licensed supports Swift/Swift package manager as a dependency source (:tada: @mattt https://github.com/github/licensed/pull/363)'
|
35
|
+
|
36
|
+
### Changed
|
37
|
+
|
38
|
+
- The `source_path` configuration property accepts arrays of inclusion and exclusion glob patterns (https://github.com/github/licensed/pull/368)
|
39
|
+
- The Nuget source now uses configured fallback folders to find dependencies that are not in found in the project folder (https://github.com/github/licensed/pull/366)
|
40
|
+
- The Nuget source supports a configurable property for the path from the project source path to the project's `obj` folder (https://github.com/github/licensed/pull/365)
|
41
|
+
|
42
|
+
### Fixed
|
43
|
+
- The Go source's checks for local packages will correctly find paths in case-insensitive file systems (https://github.com/github/licensed/pull/370)
|
44
|
+
- The Bundler source will no longer unnecessarily reset the local Bundler environment configuration (https://github.com/github/licensed/pull/372)
|
45
|
+
|
46
|
+
## 3.0.1
|
47
|
+
|
48
|
+
2021-05-17
|
49
|
+
|
50
|
+
### Fixed
|
51
|
+
|
52
|
+
- The bundler source will correctly enumerate dependencies pulled with a `git:` directive (https://github.com/github/licensed/pull/360)
|
53
|
+
|
54
|
+
## 3.0.0
|
55
|
+
|
56
|
+
2021-04-27
|
57
|
+
|
58
|
+
**This is a major release and includes potentially breaking changes to bundler dependency enumeration.**
|
59
|
+
|
60
|
+
### Changed
|
61
|
+
|
62
|
+
- The bundler source will return an error when run from an executable. Please install licensed as a gem to continue using the bundler source. Please see the [v3 migration document](./docs/migrations/v3.md) for full details and migration strategies.
|
63
|
+
|
9
64
|
## 2.15.2
|
10
65
|
|
11
66
|
2021-04-06
|
@@ -411,4 +466,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
411
466
|
|
412
467
|
Initial release :tada:
|
413
468
|
|
414
|
-
[Unreleased]: https://github.com/github/licensed/compare/
|
469
|
+
[Unreleased]: https://github.com/github/licensed/compare/3.1.0...HEAD
|
data/README.md
CHANGED
@@ -12,12 +12,24 @@ Licensed is **not** a complete open source license compliance solution. Please u
|
|
12
12
|
|
13
13
|
Licensed is in active development and currently used at GitHub. See the [open issues](https://github.com/github/licensed/issues) for a list of potential work.
|
14
14
|
|
15
|
+
## Licensed v3
|
16
|
+
|
17
|
+
Licensed v3 includes a breaking change if both of the following are true:
|
18
|
+
|
19
|
+
1. a project uses bundler to manage ruby dependencies
|
20
|
+
2. a project uses the self-contained executable build of licensed
|
21
|
+
|
22
|
+
All other usages of licensed should not encounter any major changes migrating from the latest 2.x build to 3.0.
|
23
|
+
|
24
|
+
See [CHANGELOG.md](./CHANGELOG.md) for more details on what's changed.
|
25
|
+
See the [v3 migration documentation](./docs/migrations/v3.md) for more info on migrating to v3.
|
26
|
+
|
15
27
|
## Licensed v2
|
16
28
|
|
17
29
|
Licensed v2 includes many internal changes intended to make licensed more extensible and easier to update in the future. While not too much has changed externally, v2 is incompatible with configuration files and cached records from previous versions. Fortunately, migrating is easy using the `licensed migrate` command.
|
18
30
|
|
19
31
|
See [CHANGELOG.md](./CHANGELOG.md) for more details on what's changed.
|
20
|
-
See the [migration documentation](./docs/
|
32
|
+
See the [v2 migration documentation](./docs/migrations/v2.md) for more info on migrating to v2, or run `licensed help migrate`.
|
21
33
|
|
22
34
|
## Installation
|
23
35
|
|
@@ -25,13 +37,13 @@ See the [migration documentation](./docs/migrating_to_newer_versions.md) for mor
|
|
25
37
|
|
26
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.
|
27
39
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
> OS X
|
40
|
+
```bash
|
41
|
+
# Ubuntu
|
42
|
+
sudo apt-get install cmake pkg-config
|
33
43
|
|
34
|
-
|
44
|
+
# macOS
|
45
|
+
brew install cmake pkg-config
|
46
|
+
```
|
35
47
|
|
36
48
|
### With a Gemfile
|
37
49
|
|
@@ -44,7 +56,7 @@ gem 'licensed', :group => 'development'
|
|
44
56
|
And then execute:
|
45
57
|
|
46
58
|
```bash
|
47
|
-
|
59
|
+
$> bundle
|
48
60
|
```
|
49
61
|
|
50
62
|
### As an executable
|
@@ -52,24 +64,27 @@ $ bundle
|
|
52
64
|
Download a package from GitHub and extract the executable. Executable packages are available for each release starting with version 1.2.0.
|
53
65
|
|
54
66
|
```bash
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
59
71
|
```
|
60
72
|
|
61
73
|
For system wide usage, install licensed to a location on `$PATH`, e.g. `/usr/local/bin`.
|
62
74
|
|
63
75
|
## Usage
|
64
76
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
- `licensed notices`: Write a `NOTICE` file for each application configuration.
|
69
|
-
- `licensed version`: Show current installed version of Licensed. Aliases: `-v|--version`
|
70
|
-
- `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.
|
71
80
|
|
72
|
-
|
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).
|
73
88
|
|
74
89
|
### Automation
|
75
90
|
|
@@ -82,81 +97,23 @@ The [bundler-licensed plugin](https://github.com/sergey-alekseev/bundler-license
|
|
82
97
|
The [licensed-ci](https://github.com/marketplace/actions/licensed-ci) GitHub Action runs `licensed` as part of an opinionated CI workflow and can be configured to run on any GitHub Action event. See the linked actions for usage and details.
|
83
98
|
|
84
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.
|
85
|
-
- This action is intended for projects that don't have a ruby installation setup. If your workflow has ruby setup please install `licensed` via `Gemfile` + `bundle install` or with `gem install`.
|
86
|
-
|
87
|
-
### Configuration
|
88
|
-
|
89
|
-
All commands, except `version`, accept a `-c|--config` option to specify a path to a configuration file or directory.
|
90
|
-
|
91
|
-
If a directory is specified, `licensed` will look in that directory for a file named (in order of preference):
|
92
|
-
1. `.licensed.yml`
|
93
|
-
2. `.licensed.yaml`
|
94
|
-
3. `.licensed.json`
|
95
|
-
|
96
|
-
If the option is not specified, the value will be set to the current directory.
|
97
|
-
|
98
|
-
See the [configuration file documentation](./docs/configuration.md) for more details on the configuration format.
|
99
|
-
|
100
|
-
### Sources
|
101
|
-
|
102
|
-
Dependencies will be automatically detected for all of the following sources by default.
|
103
|
-
1. [Bower](./docs/sources/bower.md)
|
104
|
-
1. [Bundler](./docs/sources/bundler.md)
|
105
|
-
1. [Cabal](./docs/sources/cabal.md)
|
106
|
-
1. [Composer](./docs/sources/composer.md)
|
107
|
-
1. [Git Submodules (git_submodule)](./docs/sources/git_submodule.md)
|
108
|
-
1. [Go](./docs/sources/go.md)
|
109
|
-
1. [Go Dep (dep)](./docs/sources/dep.md)
|
110
|
-
1. [Gradle](./docs/sources/gradle.md)
|
111
|
-
1. [Manifest lists (manifests)](./docs/sources/manifests.md)
|
112
|
-
1. [Mix](./docs/sources/mix.md)
|
113
|
-
1. [npm](./docs/sources/npm.md)
|
114
|
-
1. [NuGet](./docs/sources/nuget.md)
|
115
|
-
1. [Pip](./docs/sources/pip.md)
|
116
|
-
1. [Pipenv](./docs/sources/pipenv.md)
|
117
|
-
1. [Yarn](./docs/sources/yarn.md)
|
118
|
-
|
119
|
-
You can disable any of them in the configuration file:
|
120
|
-
|
121
|
-
```yml
|
122
|
-
sources:
|
123
|
-
bundler: false
|
124
|
-
npm: false
|
125
|
-
bower: false
|
126
|
-
cabal: false
|
127
|
-
```
|
128
100
|
|
129
101
|
## Development
|
130
102
|
|
131
103
|
To get started after checking out the repo, run
|
104
|
+
|
132
105
|
1. `script/bootstrap` to install dependencies
|
133
106
|
2. `script/setup` to setup test fixtures.
|
134
107
|
- `script/setup -f` will force a clean test fixture environment
|
135
|
-
3. `script/cibuild` to run the tests
|
108
|
+
3. `script/cibuild` to run the tests
|
136
109
|
|
137
110
|
You can also run `script/console` for an interactive prompt that will allow you to experiment.
|
138
111
|
|
139
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).
|
140
113
|
|
141
|
-
|
142
|
-
|
143
|
-
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.
|
144
|
-
|
145
|
-
* See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
|
146
|
-
* Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
|
147
|
-
```ruby
|
148
|
-
if Licensed::Shell.tool_available?('bundle')
|
149
|
-
describe Licensed::Source::Bundler do
|
150
|
-
...
|
151
|
-
end
|
152
|
-
end
|
153
|
-
```
|
154
|
-
|
155
|
-
See the [documentation on adding new sources](./docs/adding_a_new_source.md) for more information.
|
156
|
-
|
157
|
-
#### Adding Commands
|
114
|
+
### Adding a new source
|
158
115
|
|
159
|
-
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.
|
160
117
|
|
161
118
|
## Contributing
|
162
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
|
|