licensed 2.6.2 → 2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01feaa48f4c38ee8a812dd909a05e46e0355c4a7e30add873c1410dca715df8f
4
- data.tar.gz: ec09f82ba5ae08100b9c7e15631be48f6f14a302c26809172d0eb87a820b885a
3
+ metadata.gz: 4b2b964bfef1d9dd5d12c96a4586a4e1815d530a744c09484b548e1505a01a22
4
+ data.tar.gz: a14d76ad21ab8fb742f698eb0ca90702fb154184b5e887313f8f7a7f894a6437
5
5
  SHA512:
6
- metadata.gz: '03822f158d7aa6027eb6eb86856b271452bf0cd3f2bf202754a1391b65eee84c4c752fc857c40d5f4bac88dfd1490415cc0813a5003db3b127598e661a4360b2'
7
- data.tar.gz: c7393d9cbd363f0dfc1dd5a919b990c31545bf9c6c6f7322174736bdba3dfad1fa30f579f63a6fe8374c5a931fe96c2b264277f717ceccc9dc5d9ebb0afdc600
6
+ metadata.gz: 46689f9c144234c03de03c3adc9ee8cf11042d51047bcd83321eac9e1fd9d03a974f0f1757777da831e105e784153d06a4f48ea57b4cbda8079c0221074212f5
7
+ data.tar.gz: 5e1fe805637db57b6d16b0cc0f6ff8dfe3d56fd5aa1d70ffc19c06cc41764afe98b20917697de45ca338a22fe3aa1fcfa2491e9c9f90db393b4b35d38de34dc4
@@ -81,10 +81,6 @@ jobs:
81
81
  with:
82
82
  path: vendor/gems
83
83
  key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
84
- - uses: actions/cache@preview
85
- with:
86
- path: test/fixtures/cabal/dist-newstyle
87
- key: ${{ runner.os }}-fixtures-cabal-${{ matrix.ghc }}-${{ matrix.cabal }}-${{ hashFiles(format('{0}{1}', github.workspace, '/test/fixtures/cabal/app.cabal')) }}
88
84
  - name: Bootstrap
89
85
  run: script/bootstrap
90
86
  - name: Set up fixtures
@@ -92,6 +88,33 @@ jobs:
92
88
  - name: Run tests
93
89
  run: script/test cabal
94
90
 
91
+ composer:
92
+ runs-on: ubuntu-latest
93
+ strategy:
94
+ matrix:
95
+ php: [ '5.6', '7.1', '7.2', '7.3' ]
96
+ steps:
97
+ - uses: actions/checkout@master
98
+ - name: Setup php
99
+ uses: nanasess/setup-php@v1.0.2
100
+ with:
101
+ php-version: ${{ matrix.php }}
102
+ - name: Set up Ruby
103
+ uses: actions/setup-ruby@v1
104
+ with:
105
+ ruby-version: 2.6.x
106
+ - run: bundle lock
107
+ - uses: actions/cache@preview
108
+ with:
109
+ path: vendor/gems
110
+ key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
111
+ - name: Bootstrap
112
+ run: script/bootstrap
113
+ - name: Set up fixtures
114
+ run: script/source-setup/composer
115
+ - name: Run tests
116
+ run: script/test composer
117
+
95
118
  core:
96
119
  runs-on: ubuntu-latest
97
120
  strategy:
@@ -168,33 +191,6 @@ jobs:
168
191
  - name: Run tests
169
192
  run: script/test go
170
193
 
171
- npm:
172
- runs-on: ubuntu-latest
173
- strategy:
174
- matrix:
175
- node_version: [ 8, 10, 12 ]
176
- steps:
177
- - uses: actions/checkout@master
178
- - name: Setup node
179
- uses: actions/setup-node@v1
180
- with:
181
- node-version: ${{ matrix.node_version }}
182
- - name: Set up Ruby
183
- uses: actions/setup-ruby@v1
184
- with:
185
- ruby-version: 2.6.x
186
- - run: bundle lock
187
- - uses: actions/cache@preview
188
- with:
189
- path: vendor/gems
190
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
191
- - name: Bootstrap
192
- run: script/bootstrap
193
- - name: Set up fixtures
194
- run: script/source-setup/npm
195
- - name: Run tests
196
- run: script/test npm
197
-
198
194
  gradle:
199
195
  runs-on: ubuntu-latest
200
196
  steps:
@@ -215,18 +211,10 @@ jobs:
215
211
  - name: Run tests
216
212
  run: script/test gradle
217
213
 
218
- pip:
214
+ manifest:
219
215
  runs-on: ubuntu-latest
220
- strategy:
221
- matrix:
222
- python: [ '2.x', '3.x' ]
223
216
  steps:
224
217
  - uses: actions/checkout@master
225
- - name: Setup python
226
- uses: actions/setup-python@v1
227
- with:
228
- python-version: ${{ matrix.python }}
229
- architecture: x64
230
218
  - name: Set up Ruby
231
219
  uses: actions/setup-ruby@v1
232
220
  with:
@@ -238,22 +226,21 @@ jobs:
238
226
  key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
239
227
  - name: Bootstrap
240
228
  run: script/bootstrap
241
- - name: Install virtualenv
242
- run: pip install virtualenv
243
- - name: Set up fixtures
244
- run: script/source-setup/pip
245
229
  - name: Run tests
246
- run: script/test pip
230
+ run: script/test manifest
247
231
 
248
- pipenv:
232
+ mix:
249
233
  runs-on: ubuntu-latest
234
+ strategy:
235
+ matrix:
236
+ otp: [21.x, 22.x]
237
+ elixir: [1.8.x, 1.9.x]
250
238
  steps:
251
239
  - uses: actions/checkout@master
252
- - name: Setup python
253
- uses: actions/setup-python@v1
240
+ - uses: actions/setup-elixir@v1.0.0
254
241
  with:
255
- python-version: '3.x'
256
- architecture: x64
242
+ otp-version: ${{matrix.otp}}
243
+ elixir-version: ${{matrix.elixir}}
257
244
  - name: Set up Ruby
258
245
  uses: actions/setup-ruby@v1
259
246
  with:
@@ -265,24 +252,22 @@ jobs:
265
252
  key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
266
253
  - name: Bootstrap
267
254
  run: script/bootstrap
268
- - name: Install pipenv
269
- run: pip install pipenv
270
255
  - name: Set up fixtures
271
- run: script/source-setup/pipenv
256
+ run: script/source-setup/mix
272
257
  - name: Run tests
273
- run: script/test pipenv
258
+ run: script/test mix
274
259
 
275
- composer:
260
+ npm:
276
261
  runs-on: ubuntu-latest
277
262
  strategy:
278
263
  matrix:
279
- php: [ '5.6', '7.1', '7.2', '7.3' ]
264
+ node_version: [ 8, 10, 12 ]
280
265
  steps:
281
266
  - uses: actions/checkout@master
282
- - name: Setup php
283
- uses: nanasess/setup-php@v1.0.2
267
+ - name: Setup node
268
+ uses: actions/setup-node@v1
284
269
  with:
285
- php-version: ${{ matrix.php }}
270
+ node-version: ${{ matrix.node_version }}
286
271
  - name: Set up Ruby
287
272
  uses: actions/setup-ruby@v1
288
273
  with:
@@ -295,22 +280,22 @@ jobs:
295
280
  - name: Bootstrap
296
281
  run: script/bootstrap
297
282
  - name: Set up fixtures
298
- run: script/source-setup/composer
283
+ run: script/source-setup/npm
299
284
  - name: Run tests
300
- run: script/test composer
285
+ run: script/test npm
301
286
 
302
- mix:
287
+ pip:
303
288
  runs-on: ubuntu-latest
304
289
  strategy:
305
290
  matrix:
306
- otp: [21.x, 22.x]
307
- elixir: [1.8.x, 1.9.x]
291
+ python: [ '2.x', '3.x' ]
308
292
  steps:
309
293
  - uses: actions/checkout@master
310
- - uses: actions/setup-elixir@v1.0.0
294
+ - name: Setup python
295
+ uses: actions/setup-python@v1
311
296
  with:
312
- otp-version: ${{matrix.otp}}
313
- elixir-version: ${{matrix.elixir}}
297
+ python-version: ${{ matrix.python }}
298
+ architecture: x64
314
299
  - name: Set up Ruby
315
300
  uses: actions/setup-ruby@v1
316
301
  with:
@@ -322,15 +307,22 @@ jobs:
322
307
  key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
323
308
  - name: Bootstrap
324
309
  run: script/bootstrap
310
+ - name: Install virtualenv
311
+ run: pip install virtualenv
325
312
  - name: Set up fixtures
326
- run: script/source-setup/mix
313
+ run: script/source-setup/pip
327
314
  - name: Run tests
328
- run: script/test mix
315
+ run: script/test pip
329
316
 
330
- manifest:
317
+ pipenv:
331
318
  runs-on: ubuntu-latest
332
319
  steps:
333
320
  - uses: actions/checkout@master
321
+ - name: Setup python
322
+ uses: actions/setup-python@v1
323
+ with:
324
+ python-version: '3.x'
325
+ architecture: x64
334
326
  - name: Set up Ruby
335
327
  uses: actions/setup-ruby@v1
336
328
  with:
@@ -342,5 +334,9 @@ jobs:
342
334
  key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles(format('{0}{1}', github.workspace, '/Gemfile.lock')) }}
343
335
  - name: Bootstrap
344
336
  run: script/bootstrap
337
+ - name: Install pipenv
338
+ run: pip install pipenv
339
+ - name: Set up fixtures
340
+ run: script/source-setup/pipenv
345
341
  - name: Run tests
346
- run: script/test manifest
342
+ run: script/test pipenv
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 2.7.0
10
+ 2019-11-10
11
+
12
+ ### Added
13
+ - License text is automatically generated for known licenses when not otherwise available (https://github.com/github/licensed/pull/223)
14
+
15
+ ### Changed
16
+ - Ignoring dependencies uses glob pattern matching (https://github.com/github/licensed/pull/225)
17
+
9
18
  ## 2.6.2
10
19
  2019-11-03
11
20
 
@@ -246,4 +255,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
246
255
 
247
256
  Initial release :tada:
248
257
 
249
- [Unreleased]: https://github.com/github/licensed/compare/2.6.2...HEAD
258
+ [Unreleased]: https://github.com/github/licensed/compare/2.7.0...HEAD
data/README.md CHANGED
@@ -21,6 +21,18 @@ See the [migration documentation](./docs/migrating_to_newer_versions.md) for mor
21
21
 
22
22
  ## Installation
23
23
 
24
+ ### Dependencies
25
+
26
+ 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
+
28
+ > Ubuntu
29
+
30
+ sudo apt-get install cmake pkg-config
31
+
32
+ > OS X
33
+
34
+ brew install cmake pkg-config
35
+
24
36
  ### With a Gemfile
25
37
 
26
38
  Add this line to your application's Gemfile:
@@ -48,12 +60,6 @@ $ ./licensed list
48
60
 
49
61
  For system wide usage, install licensed to a location on `$PATH`, e.g. `/usr/local/bin`.
50
62
 
51
- #### Dependencies
52
-
53
- Licensed uses the `libgit2` bindings for Ruby provided by `rugged`. `rugged` has its own dependencies - `cmake` and `pkg-config` - which you may need to install before you can install Licensed.
54
-
55
- For example, on macOS with Homebrew: `brew install cmake pkg-config` and on Ubuntu: `apt-get install cmake pkg-config`.
56
-
57
63
  ## Usage
58
64
 
59
65
  - `licensed list`: Output enumerated dependencies only.
@@ -95,6 +95,12 @@ ignored:
95
95
  bower:
96
96
  - some-internal-package
97
97
 
98
+ go:
99
+ # ignore all go packages from import paths starting with github.com/internal-package
100
+ # see the `File.fnmatch?` documentation for details on how patterns are matched.
101
+ # comparisons use the FNM_CASEFOLD and FNM_PATHNAME flags
102
+ - github.com/internal-package/**/*
103
+
98
104
  # These dependencies have been reviewed.
99
105
  # They need to be cached and checked, but do not have a license found that matches the allowed configured licenses.
100
106
  reviewed:
@@ -75,7 +75,9 @@ module Licensed
75
75
 
76
76
  # Is the given dependency ignored?
77
77
  def ignored?(dependency)
78
- Array(self["ignored"][dependency["type"]]).include?(dependency["name"])
78
+ Array(self["ignored"][dependency["type"]]).any? do |pattern|
79
+ File.fnmatch?(pattern, dependency["name"], File::FNM_PATHNAME | File::FNM_CASEFOLD)
80
+ end
79
81
  end
80
82
 
81
83
  # Is the license of the dependency allowed?
@@ -72,9 +72,12 @@ module Licensed
72
72
  # Returns the license text content from all matched sources
73
73
  # except the package file, which doesn't contain license text.
74
74
  def license_contents
75
- matched_files.reject { |f| f == package_file }
76
- .group_by(&:content)
77
- .map { |content, files| { "sources" => license_content_sources(files), "text" => content } }
75
+ files = matched_files.reject { |f| f == package_file }
76
+ .group_by(&:content)
77
+ .map { |content, files| { "sources" => license_content_sources(files), "text" => content } }
78
+
79
+ files << generated_license_contents if files.empty?
80
+ files.compact
78
81
  end
79
82
 
80
83
  # Returns legal notices found at the dependency path
@@ -133,5 +136,25 @@ module Licensed
133
136
  "license" => license_key
134
137
  })
135
138
  end
139
+
140
+ # Returns a generated license content source and text for the dependency's
141
+ # license if it exists and is not "other"
142
+ def generated_license_contents
143
+ return unless license
144
+ return if license.key == "other"
145
+
146
+ # strip copyright clauses and any extra newlines
147
+ # many package managers don't provide enough information to
148
+ # autogenerate a copyright clause
149
+ text = license.text.lines
150
+ .reject { |l| l =~ Licensee::Matchers::Copyright::REGEX }
151
+ .join
152
+ .gsub(/\n\n\n/, "\n\n")
153
+
154
+ {
155
+ "sources" => "Auto-generated #{license.spdx_id} license text",
156
+ "text" => text
157
+ }
158
+ end
136
159
  end
137
160
  end
@@ -85,11 +85,16 @@ module Licensed
85
85
 
86
86
  # true if go standard packages includes the import path as given
87
87
  return true if go_std_packages.include?(import_path)
88
+ return true if go_std_packages.include?("vendor/#{import_path}")
88
89
 
89
90
  # additional checks are only for vendored dependencies - return false
90
91
  # if package isn't vendored
91
92
  return false unless vendored_path?(import_path)
92
93
 
94
+ # return true if any of the go standard packages matches against
95
+ # the non-vendored import path
96
+ return true if go_std_packages.include?(non_vendored_import_path(import_path))
97
+
93
98
  # modify the import path to look like the import path `go list` returns for vendored std packages
94
99
  vendor_path = import_path.sub("#{root_package["ImportPath"]}/", "")
95
100
  go_std_packages.include?(vendor_path) || go_std_packages.include?(vendor_path.sub("golang.org", "golang_org"))
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "2.6.2".freeze
3
+ VERSION = "2.7.0".freeze
4
4
 
5
5
  def self.previous_major_versions
6
6
  major_version = Gem::Version.new(Licensed::VERSION).segments.first
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: 2.6.2
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-03 00:00:00.000000000 Z
11
+ date: 2019-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee