licensed 3.2.0 → 3.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46db33bf2c824a144fbe5a85acfef469c35faeec69c3afd15a6df0c363025174
4
- data.tar.gz: 73e300eaeebd28afed3ded55f60fc24b0fae9d20795ac150322c1b1975052215
3
+ metadata.gz: 157405d5c26fe8026b4c8d521a5753be821bb2727d9713f7732e2601699660e7
4
+ data.tar.gz: 1f02c3bf319500352632331f72dfc40cbfaf6a0d00350570223d3b37b2496ca7
5
5
  SHA512:
6
- metadata.gz: 7d487c920e977198ac91f7eeac4fbea8c4c49a326c6d449532a06e206e9472d75276879a6e3247fee7f6e64d87f595300b3c7ee995e8d1d595fb53401888ccec
7
- data.tar.gz: 77ac80e1833b1c02cbb67aac8a79422e2af24958f89a577f07a0885fb7c3cbbc71dc61e0d5fb1bd453b58a1e6d8d0c5b47bf65fdf669edec4347012af83363b9
6
+ metadata.gz: fa9b3832cfda8a30f99c7718a6e4c9433145e37cb51070c5e1a59009ff5b29269353ddeb68480196bd1f1680bd8c01c4ddd3538bea2f7401fcddcdb542f62ada
7
+ data.tar.gz: ee5718fb34a1d23738849101b121db785fdc83d587d0f7750c2cc1e613f0c8a6ece707e427bb18473f04ef67569499db28e75ce80f14f0dde2cd09e18ed14053
@@ -0,0 +1,19 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: github-actions
9
+ directory: /
10
+ schedule:
11
+ interval: daily
12
+ - package-ecosystem: bundler
13
+ directory: /
14
+ schedule:
15
+ interval: weekly
16
+ - package-ecosystem: docker
17
+ directory: docker
18
+ schedule:
19
+ interval: weekly
@@ -23,7 +23,7 @@ jobs:
23
23
  steps:
24
24
  - id: get_version
25
25
  name: Get package version
26
- uses: actions/github-script@v3
26
+ uses: actions/github-script@v4.1
27
27
  with:
28
28
  github-token: ${{ secrets.GITHUB_TOKEN }}
29
29
  result-encoding: string
@@ -41,7 +41,7 @@ jobs:
41
41
 
42
42
  - id: get_url
43
43
  name: Get release upload url
44
- uses: actions/github-script@v3
44
+ uses: actions/github-script@v4.1
45
45
  with:
46
46
  github-token: ${{ secrets.GITHUB_TOKEN }}
47
47
  result-encoding: string
@@ -65,7 +65,7 @@ jobs:
65
65
 
66
66
  - id: get_ref
67
67
  name: Get checkout ref for custom build scripts
68
- uses: actions/github-script@v3
68
+ uses: actions/github-script@v4.1
69
69
  with:
70
70
  github-token: ${{ secrets.GITHUB_TOKEN }}
71
71
  result-encoding: string
@@ -210,4 +210,4 @@ jobs:
210
210
  gem push $GEM
211
211
  env:
212
212
  RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
213
- GEM: licensed-${{needs.vars.outputs.version}}.gem
213
+ GEM: licensed-${{needs.vars.outputs.version}}.gem
@@ -18,10 +18,13 @@ jobs:
18
18
  with:
19
19
  ruby-version: 2.6
20
20
  - run: bundle lock
21
- - uses: actions/cache@v1
21
+ - uses: actions/cache@v2
22
+ name: cache gem dependencies
22
23
  with:
23
24
  path: vendor/gems
24
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
25
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
26
+ restore-keys: |
27
+ ${{ runner.os }}-gem-2.6-
25
28
  - name: Bootstrap
26
29
  run: script/bootstrap
27
30
  - name: Set up fixtures
@@ -45,10 +48,13 @@ jobs:
45
48
  yes | gem uninstall bundler --all
46
49
  gem install bundler -v "${{ matrix.bundler }}"
47
50
  - run: bundle lock
48
- - uses: actions/cache@v1
51
+ - uses: actions/cache@v2
52
+ name: cache gem dependencies
49
53
  with:
50
54
  path: vendor/gems
51
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
55
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
56
+ restore-keys: |
57
+ ${{ runner.os }}-gem-2.6-
52
58
  - name: Bootstrap
53
59
  run: script/bootstrap
54
60
  - name: Set up fixtures
@@ -74,10 +80,22 @@ jobs:
74
80
  ghc-version: ${{ matrix.ghc }}
75
81
  cabal-version: ${{ matrix.cabal }}
76
82
  - run: bundle lock
77
- - uses: actions/cache@v1
83
+ - name: cache cabal dependencies
84
+ uses: actions/cache@v2
85
+ with:
86
+ path: |
87
+ ~/.cabal/packages
88
+ ~/.cabal/store
89
+ key: ${{ runner.os }}-cabal-${{ matrix.ghc }}-${{ hashFiles('**/app.cabal') }}
90
+ restore-keys: |
91
+ ${{ runner.os }}-cabal-
92
+ - uses: actions/cache@v2
93
+ name: cache gem dependencies
78
94
  with:
79
95
  path: vendor/gems
80
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
96
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
97
+ restore-keys: |
98
+ ${{ runner.os }}-gem-2.6-
81
99
  - name: Bootstrap
82
100
  run: script/bootstrap
83
101
  - name: Set up fixtures
@@ -93,7 +111,7 @@ jobs:
93
111
  steps:
94
112
  - uses: actions/checkout@v2
95
113
  - name: Setup php
96
- uses: nanasess/setup-php@v3.0.6
114
+ uses: nanasess/setup-php@v3.0.8
97
115
  with:
98
116
  php-version: ${{ matrix.php }}
99
117
  - name: Set up Ruby
@@ -101,10 +119,13 @@ jobs:
101
119
  with:
102
120
  ruby-version: 2.6
103
121
  - run: bundle lock
104
- - uses: actions/cache@v1
122
+ - uses: actions/cache@v2
123
+ name: cache gem dependencies
105
124
  with:
106
125
  path: vendor/gems
107
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
126
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
127
+ restore-keys: |
128
+ ${{ runner.os }}-gem-2.6-
108
129
  - name: Bootstrap
109
130
  run: script/bootstrap
110
131
  - name: Set up fixtures
@@ -126,10 +147,13 @@ jobs:
126
147
  - name: Set up Bundler
127
148
  run: gem install bundler
128
149
  - run: bundle lock
129
- - uses: actions/cache@v1
150
+ - uses: actions/cache@v2
151
+ name: cache gem dependencies
130
152
  with:
131
153
  path: vendor/gems
132
154
  key: ${{ runner.os }}-gem-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
155
+ restore-keys: |
156
+ ${{ runner.os }}-gem-${{ matrix.ruby }}-
133
157
  - name: Bootstrap
134
158
  run: script/bootstrap
135
159
  - name: Build and lint
@@ -142,7 +166,7 @@ jobs:
142
166
  steps:
143
167
  - uses: actions/checkout@v2
144
168
  - name: Setup go
145
- uses: actions/setup-go@v1
169
+ uses: actions/setup-go@v2
146
170
  with:
147
171
  go-version: 1.10.x
148
172
  - name: Set up Ruby
@@ -150,10 +174,13 @@ jobs:
150
174
  with:
151
175
  ruby-version: 2.6
152
176
  - run: bundle lock
153
- - uses: actions/cache@v1
177
+ - uses: actions/cache@v2
178
+ name: cache gem dependencies
154
179
  with:
155
180
  path: vendor/gems
156
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
181
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
182
+ restore-keys: |
183
+ ${{ runner.os }}-gem-2.6-
157
184
  - name: Bootstrap
158
185
  run: script/bootstrap
159
186
  - name: Set up fixtures
@@ -169,7 +196,7 @@ jobs:
169
196
  steps:
170
197
  - uses: actions/checkout@v2
171
198
  - name: Setup go
172
- uses: actions/setup-go@v1
199
+ uses: actions/setup-go@v2
173
200
  with:
174
201
  go-version: ${{ matrix.go }}
175
202
  - name: Set up Ruby
@@ -177,10 +204,22 @@ jobs:
177
204
  with:
178
205
  ruby-version: 2.6
179
206
  - run: bundle lock
180
- - uses: actions/cache@v1
207
+ - uses: actions/cache@v2
208
+ name: cache go dependencies
209
+ with:
210
+ path: |
211
+ ~/.cache/go-build
212
+ ~/go/pkg/mod
213
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
214
+ restore-keys: |
215
+ ${{ runner.os }}-go-
216
+ - uses: actions/cache@v2
217
+ name: cache gem dependencies
181
218
  with:
182
219
  path: vendor/gems
183
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
220
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
221
+ restore-keys: |
222
+ ${{ runner.os }}-gem-2.6-
184
223
  - name: Bootstrap
185
224
  run: script/bootstrap
186
225
  - name: Set up fixtures
@@ -211,10 +250,22 @@ jobs:
211
250
  with:
212
251
  java-version: ${{ matrix.java }}
213
252
  distribution: adopt
214
- - uses: actions/cache@v1
253
+ - uses: actions/cache@v2
254
+ name: cache gradle dependencies
255
+ with:
256
+ path: |
257
+ ~/.gradle/caches
258
+ ~/.gradle/wrapper
259
+ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
260
+ restore-keys: |
261
+ ${{ runner.os }}-gradle-
262
+ - uses: actions/cache@v2
263
+ name: cache gem dependencies
215
264
  with:
216
265
  path: vendor/gems
217
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
266
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
267
+ restore-keys: |
268
+ ${{ runner.os }}-gem-2.6-
218
269
  - name: Bootstrap
219
270
  run: script/bootstrap
220
271
  - name: Gradle version
@@ -231,10 +282,13 @@ jobs:
231
282
  with:
232
283
  ruby-version: 2.6
233
284
  - run: bundle lock
234
- - uses: actions/cache@v1
285
+ - uses: actions/cache@v2
286
+ name: cache gem dependencies
235
287
  with:
236
288
  path: vendor/gems
237
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
289
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
290
+ restore-keys: |
291
+ ${{ runner.os }}-gem-2.6-
238
292
  - name: Bootstrap
239
293
  run: script/bootstrap
240
294
  - name: Run tests
@@ -248,7 +302,7 @@ jobs:
248
302
  elixir: [ 1.11.x, 1.12.x ]
249
303
  steps:
250
304
  - uses: actions/checkout@v2
251
- - uses: erlef/setup-elixir@v1.6.0
305
+ - uses: erlef/setup-elixir@v1.9
252
306
  with:
253
307
  otp-version: ${{matrix.otp}}
254
308
  elixir-version: ${{matrix.elixir}}
@@ -257,10 +311,13 @@ jobs:
257
311
  with:
258
312
  ruby-version: 2.6
259
313
  - run: bundle lock
260
- - uses: actions/cache@v1
314
+ - uses: actions/cache@v2
315
+ name: cache gem dependencies
261
316
  with:
262
317
  path: vendor/gems
263
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
318
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
319
+ restore-keys: |
320
+ ${{ runner.os }}-gem-2.6-
264
321
  - name: Bootstrap
265
322
  run: script/bootstrap
266
323
  - name: Set up fixtures
@@ -284,10 +341,13 @@ jobs:
284
341
  with:
285
342
  ruby-version: 2.6
286
343
  - run: bundle lock
287
- - uses: actions/cache@v1
344
+ - uses: actions/cache@v2
345
+ name: cache gem dependencies
288
346
  with:
289
347
  path: vendor/gems
290
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
348
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
349
+ restore-keys: |
350
+ ${{ runner.os }}-gem-2.6-
291
351
  - name: Bootstrap
292
352
  run: script/bootstrap
293
353
  - name: Set up fixtures
@@ -311,10 +371,13 @@ jobs:
311
371
  with:
312
372
  ruby-version: 2.6
313
373
  - run: bundle lock
314
- - uses: actions/cache@v1
374
+ - uses: actions/cache@v2
375
+ name: cache gem dependencies
315
376
  with:
316
377
  path: vendor/gems
317
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
378
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
379
+ restore-keys: |
380
+ ${{ runner.os }}-gem-2.6-
318
381
  - name: Bootstrap
319
382
  run: script/bootstrap
320
383
  - name: Set up fixtures
@@ -330,7 +393,7 @@ jobs:
330
393
  steps:
331
394
  - uses: actions/checkout@v2
332
395
  - name: Setup python
333
- uses: actions/setup-python@v1
396
+ uses: actions/setup-python@v2
334
397
  with:
335
398
  python-version: ${{ matrix.python }}
336
399
  architecture: x64
@@ -339,10 +402,20 @@ jobs:
339
402
  with:
340
403
  ruby-version: 2.6
341
404
  - run: bundle lock
342
- - uses: actions/cache@v1
405
+ - uses: actions/cache@v2
406
+ name: cache pip dependencies
407
+ with:
408
+ path: ~/.cache/pip
409
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
410
+ restore-keys: |
411
+ ${{ runner.os }}-pip-
412
+ - uses: actions/cache@v2
413
+ name: cache gem dependencies
343
414
  with:
344
415
  path: vendor/gems
345
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
416
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
417
+ restore-keys: |
418
+ ${{ runner.os }}-gem-2.6-
346
419
  - name: Bootstrap
347
420
  run: script/bootstrap
348
421
  - name: Install virtualenv
@@ -357,7 +430,7 @@ jobs:
357
430
  steps:
358
431
  - uses: actions/checkout@v2
359
432
  - name: Setup python
360
- uses: actions/setup-python@v1
433
+ uses: actions/setup-python@v2
361
434
  with:
362
435
  python-version: '3.x'
363
436
  architecture: x64
@@ -366,10 +439,13 @@ jobs:
366
439
  with:
367
440
  ruby-version: 2.6
368
441
  - run: bundle lock
369
- - uses: actions/cache@v1
442
+ - uses: actions/cache@v2
443
+ name: cache gem dependencies
370
444
  with:
371
445
  path: vendor/gems
372
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
446
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
447
+ restore-keys: |
448
+ ${{ runner.os }}-gem-2.6-
373
449
  - name: Bootstrap
374
450
  run: script/bootstrap
375
451
  - name: Install pipenv
@@ -395,10 +471,20 @@ jobs:
395
471
  with:
396
472
  ruby-version: 2.6
397
473
  - run: bundle lock
398
- - uses: actions/cache@v1
474
+ - uses: actions/cache@v2
475
+ name: cache spm dependencies
476
+ with:
477
+ path: .build
478
+ key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
479
+ restore-keys: |
480
+ ${{ runner.os }}-spm-
481
+ - uses: actions/cache@v2
482
+ name: cache gem dependencies
399
483
  with:
400
484
  path: vendor/gems
401
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
485
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
486
+ restore-keys: |
487
+ ${{ runner.os }}-gem-2.6-
402
488
  - name: Bootstrap
403
489
  run: script/bootstrap
404
490
  - name: Set up fixtures
@@ -427,13 +513,16 @@ jobs:
427
513
  with:
428
514
  ruby-version: 2.6
429
515
  - run: bundle lock
430
- - uses: actions/cache@v1
516
+ - uses: actions/cache@v2
517
+ name: cache gem dependencies
431
518
  with:
432
519
  path: vendor/gems
433
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
520
+ key: ${{ runner.os }}-gem-2.6-${{ hashFiles('**/Gemfile.lock') }}
521
+ restore-keys: |
522
+ ${{ runner.os }}-gem-2.6-
434
523
  - name: Bootstrap
435
524
  run: script/bootstrap
436
525
  - name: Set up fixtures
437
526
  run: script/source-setup/yarn
438
527
  - name: Run tests
439
- run: script/test yarn
528
+ run: script/test yarn
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.7.4
data/CHANGELOG.md CHANGED
@@ -6,6 +6,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 3.2.1
10
+
11
+ 2021-09-06
12
+
13
+ ### Changed
14
+
15
+ - Updated multiple dependency versions (:tada: @mmorel-35 https://github.com/github/licensed/pull/385, https://github.com/github/licensed/pull/389)
16
+ - Go homepage links use pkg.go.dev instead of godoc.org (:tada: @mmorel-35 https://github.com/github/licensed/commit/73cfbbe954a3e8c8cbaf8b68253053b157e01b79)
17
+ - Local development ruby version changed to 2.7.4 (https://github.com/github/licensed/pull/393)
18
+
19
+ ### Fixed
20
+
21
+ - Bundler source correctly finds platform specific dependencies (https://github.com/github/licensed/pull/392)
22
+
9
23
  ## 3.2.0
10
24
 
11
25
  2021-08-19
@@ -466,4 +480,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
466
480
 
467
481
  Initial release :tada:
468
482
 
469
- [Unreleased]: https://github.com/github/licensed/compare/3.1.0...HEAD
483
+ [Unreleased]: https://github.com/github/licensed/compare/3.2.1...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/sources.md).
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
 
@@ -1,4 +1,4 @@
1
- FROM ruby:2.4-slim-stretch
1
+ FROM ruby:2.6.8-slim-stretch
2
2
 
3
3
  RUN apt-get update \
4
4
  && apt-get install -y --no-install-recommends cmake make gcc pkg-config squashfs-tools git curl bison rsync \
@@ -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
 
@@ -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.select { |r| r.target.is_a?(Licensed::Dependency) }.size
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
@@ -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
- defined?(::Bundler) && lockfile_path && lockfile_path.exist?
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
- with_local_configuration do
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 ||= ::Bundler::Definition.build(gemfile_path, lockfile_path, nil)
96
- end
97
-
98
- # Returns the bundle definition groups, removing "without" groups,
99
- # and including "with" groups
100
- def groups
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,29 @@ module Licensed
121
98
  end
122
99
  end
123
100
 
124
- # Returns the path to the Bundler Gemfile
125
- def gemfile_path
126
- @gemfile_path ||= GEMFILES.keys
127
- .map { |g| config.pwd.join g }
128
- .find { |f| f.exist? }
129
- end
130
-
131
- # Returns the path to the Bundler Gemfile.lock
132
- def lockfile_path
133
- return unless gemfile_path
134
- @lockfile_path ||= gemfile_path.dirname.join(GEMFILES[gemfile_path.basename.to_s])
135
- end
136
-
137
101
  # helper to clear all bundler environment around a yielded block
138
- def with_local_configuration
139
- # silence any bundler warnings while running licensed
140
- bundler_ui, ::Bundler.ui = ::Bundler.ui, ::Bundler::UI::Silent.new
102
+ def with_application_environment
103
+ backup = nil
141
104
 
142
- original_bundle_gemfile = nil
143
- if gemfile_path.to_s != ENV["BUNDLE_GEMFILE"]
144
- # force bundler to use the local gem file
145
- original_bundle_gemfile, ENV["BUNDLE_GEMFILE"] = ENV["BUNDLE_GEMFILE"], gemfile_path.to_s
105
+ ::Bundler.ui.silence do
106
+ if ::Bundler.root != config.source_path
107
+ backup = ENV.to_hash
108
+ ENV.replace(::Bundler.original_env)
146
109
 
147
- # reset all bundler configuration
148
- ::Bundler.reset!
149
- # and re-configure with settings for current directory
150
- ::Bundler.configure
151
- end
110
+ # reset bundler to load from the current app's source path
111
+ ::Bundler.reset!
112
+ ::Bundler.load
113
+ end
152
114
 
153
- yield
115
+ yield
116
+ end
154
117
  ensure
155
- if original_bundle_gemfile
156
- ENV["BUNDLE_GEMFILE"] = original_bundle_gemfile
157
-
118
+ if backup
158
119
  # restore bundler configuration
120
+ ENV.replace(backup)
159
121
  ::Bundler.reset!
160
- ::Bundler.configure
122
+ ::Bundler.load
161
123
  end
162
-
163
- ::Bundler.ui = bundler_ui
164
124
  end
165
125
 
166
126
  # Returns whether the current licensed execution is running ruby-packer
@@ -40,10 +40,10 @@ module Licensed
40
40
  end
41
41
  end
42
42
 
43
- # Returns the godoc.org page for a package.
43
+ # Returns the pkg.go.dev page for a package.
44
44
  def homepage(import_path)
45
45
  return unless import_path
46
- "https://godoc.org/#{import_path}"
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
@@ -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.to_s}*", package["Dir"], File::FNM_CASEFOLD)
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 godoc.org page for a package.
135
+ # Returns the pkg.go.dev page for a package.
136
136
  def homepage(import_path)
137
137
  return unless import_path
138
- "https://godoc.org/#{import_path}"
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
@@ -234,8 +234,7 @@ module Licensed
234
234
  ].compact
235
235
 
236
236
  nuget_package_dirs.map { |dir| File.join(dir, dependency_path) }
237
- .select { |path| File.directory?(path) }
238
- .first
237
+ .find { |path| File.directory?(path) }
239
238
  end
240
239
  end
241
240
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "3.2.0".freeze
3
+ VERSION = "3.2.1".freeze
4
4
 
5
5
  def self.previous_major_versions
6
6
  major_version = Gem::Version.new(Licensed::VERSION).segments.first
data/licensed.gemspec CHANGED
@@ -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", "~> 1.2"
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", "~> 1.0"
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", "< 0.67"
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", "~> 10.0.0"
40
+ spec.add_development_dependency "byebug", "~> 11.0.1"
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensed
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-19 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee
@@ -62,16 +62,22 @@ dependencies:
62
62
  name: tomlrb
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.2'
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '3.0'
68
71
  type: :runtime
69
72
  prerelease: false
70
73
  version_requirements: !ruby/object:Gem::Requirement
71
74
  requirements:
72
- - - "~>"
75
+ - - ">="
73
76
  - !ruby/object:Gem::Version
74
77
  version: '1.2'
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.0'
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: bundler
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -118,16 +124,22 @@ dependencies:
118
124
  name: reverse_markdown
119
125
  requirement: !ruby/object:Gem::Requirement
120
126
  requirements:
121
- - - "~>"
127
+ - - ">="
122
128
  - !ruby/object:Gem::Version
123
- version: '1.0'
129
+ version: '1'
130
+ - - "<"
131
+ - !ruby/object:Gem::Version
132
+ version: '3'
124
133
  type: :runtime
125
134
  prerelease: false
126
135
  version_requirements: !ruby/object:Gem::Requirement
127
136
  requirements:
128
- - - "~>"
137
+ - - ">="
129
138
  - !ruby/object:Gem::Version
130
- version: '1.0'
139
+ version: '1'
140
+ - - "<"
141
+ - !ruby/object:Gem::Version
142
+ version: '3'
131
143
  - !ruby/object:Gem::Dependency
132
144
  name: rake
133
145
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +191,7 @@ dependencies:
179
191
  version: '0.49'
180
192
  - - "<"
181
193
  - !ruby/object:Gem::Version
182
- version: '0.67'
194
+ version: '1.20'
183
195
  type: :development
184
196
  prerelease: false
185
197
  version_requirements: !ruby/object:Gem::Requirement
@@ -189,7 +201,7 @@ dependencies:
189
201
  version: '0.49'
190
202
  - - "<"
191
203
  - !ruby/object:Gem::Version
192
- version: '0.67'
204
+ version: '1.20'
193
205
  - !ruby/object:Gem::Dependency
194
206
  name: rubocop-github
195
207
  requirement: !ruby/object:Gem::Requirement
@@ -210,14 +222,14 @@ dependencies:
210
222
  requirements:
211
223
  - - "~>"
212
224
  - !ruby/object:Gem::Version
213
- version: 10.0.0
225
+ version: 11.0.1
214
226
  type: :development
215
227
  prerelease: false
216
228
  version_requirements: !ruby/object:Gem::Requirement
217
229
  requirements:
218
230
  - - "~>"
219
231
  - !ruby/object:Gem::Version
220
- version: 10.0.0
232
+ version: 11.0.1
221
233
  description: Licensed automates extracting and validating the licenses of dependencies.
222
234
  email:
223
235
  - opensource+licensed@github.com
@@ -226,6 +238,7 @@ executables:
226
238
  extensions: []
227
239
  extra_rdoc_files: []
228
240
  files:
241
+ - ".github/dependabot.yml"
229
242
  - ".github/workflows/release.yml"
230
243
  - ".github/workflows/test.yml"
231
244
  - ".gitignore"
@@ -310,6 +323,7 @@ files:
310
323
  - lib/licensed/sources.rb
311
324
  - lib/licensed/sources/bower.rb
312
325
  - lib/licensed/sources/bundler.rb
326
+ - lib/licensed/sources/bundler/definition.rb
313
327
  - lib/licensed/sources/bundler/missing_specification.rb
314
328
  - lib/licensed/sources/cabal.rb
315
329
  - lib/licensed/sources/composer.rb