licensed 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -1
  3. data/README.md +1 -1
  4. data/docs/commands/status.md +1 -0
  5. data/docs/sources/cargo.md +19 -0
  6. data/lib/licensed/commands/cache.rb +4 -2
  7. data/lib/licensed/commands/command.rb +5 -2
  8. data/lib/licensed/reporters/status_reporter.rb +1 -1
  9. data/lib/licensed/sources/bundler/definition.rb +36 -0
  10. data/lib/licensed/sources/bundler/missing_specification.rb +10 -7
  11. data/lib/licensed/sources/bundler.rb +33 -69
  12. data/lib/licensed/sources/cargo.rb +70 -0
  13. data/lib/licensed/sources/dep.rb +2 -2
  14. data/lib/licensed/sources/go.rb +3 -3
  15. data/lib/licensed/sources/helpers/content_versioning.rb +2 -1
  16. data/lib/licensed/sources/nuget.rb +1 -2
  17. data/lib/licensed/sources.rb +1 -0
  18. data/lib/licensed/version.rb +1 -1
  19. data/licensed.gemspec +5 -5
  20. metadata +27 -41
  21. data/.github/workflows/release.yml +0 -213
  22. data/.github/workflows/test.yml +0 -439
  23. data/.gitignore +0 -57
  24. data/.licensed.yml +0 -7
  25. data/.rubocop.yml +0 -8
  26. data/.ruby-version +0 -1
  27. data/docker/Dockerfile.build-linux +0 -15
  28. data/script/bootstrap +0 -6
  29. data/script/cibuild +0 -7
  30. data/script/console +0 -15
  31. data/script/package +0 -20
  32. data/script/packages/build +0 -95
  33. data/script/packages/linux +0 -57
  34. data/script/packages/mac +0 -41
  35. data/script/setup +0 -5
  36. data/script/source-setup/bower +0 -17
  37. data/script/source-setup/bundler +0 -20
  38. data/script/source-setup/cabal +0 -19
  39. data/script/source-setup/composer +0 -38
  40. data/script/source-setup/git_submodule +0 -39
  41. data/script/source-setup/go +0 -31
  42. data/script/source-setup/mix +0 -19
  43. data/script/source-setup/npm +0 -34
  44. data/script/source-setup/nuget +0 -17
  45. data/script/source-setup/pip +0 -29
  46. data/script/source-setup/pipenv +0 -21
  47. data/script/source-setup/swift +0 -22
  48. data/script/source-setup/yarn +0 -17
  49. data/script/test +0 -16
@@ -1,439 +0,0 @@
1
- name: Test
2
-
3
- on: pull_request
4
-
5
- jobs:
6
- bower:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- - name: Setup node
11
- uses: actions/setup-node@v2
12
- with:
13
- node-version: 8
14
- - name: Install Bower
15
- run: npm install -g bower
16
- - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: 2.6
20
- - run: bundle lock
21
- - uses: actions/cache@v1
22
- with:
23
- path: vendor/gems
24
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
25
- - name: Bootstrap
26
- run: script/bootstrap
27
- - name: Set up fixtures
28
- run: script/source-setup/bower
29
- - name: Run tests
30
- run: script/test bower
31
-
32
- bundler:
33
- runs-on: ubuntu-latest
34
- strategy:
35
- matrix:
36
- bundler: [ '~> 1.17.0', '~> 2.0.0', '~> 2.1.0', '~> 2.2.0' ]
37
- steps:
38
- - uses: actions/checkout@v2
39
- - name: Set up Ruby
40
- uses: ruby/setup-ruby@v1
41
- with:
42
- ruby-version: 2.6
43
- - name: Set up Bundler
44
- run: |
45
- yes | gem uninstall bundler --all
46
- gem install bundler -v "${{ matrix.bundler }}"
47
- - run: bundle lock
48
- - uses: actions/cache@v1
49
- with:
50
- path: vendor/gems
51
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
52
- - name: Bootstrap
53
- run: script/bootstrap
54
- - name: Set up fixtures
55
- run: script/source-setup/bundler
56
- - name: Run tests
57
- run: script/test bundler
58
-
59
- cabal:
60
- runs-on: ubuntu-latest
61
- strategy:
62
- matrix:
63
- ghc: [ '8.6', '8.8', '8.10', '9.0' ]
64
- cabal: [ '3.0', '3.2', '3.4' ]
65
- steps:
66
- - uses: actions/checkout@v2
67
- - name: Set up Ruby
68
- uses: ruby/setup-ruby@v1
69
- with:
70
- ruby-version: 2.6
71
- - name: Setup Haskell
72
- uses: haskell/actions/setup@v1
73
- with:
74
- ghc-version: ${{ matrix.ghc }}
75
- cabal-version: ${{ matrix.cabal }}
76
- - run: bundle lock
77
- - uses: actions/cache@v1
78
- with:
79
- path: vendor/gems
80
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
81
- - name: Bootstrap
82
- run: script/bootstrap
83
- - name: Set up fixtures
84
- run: script/source-setup/cabal
85
- - name: Run tests
86
- run: script/test cabal
87
-
88
- composer:
89
- runs-on: ubuntu-latest
90
- strategy:
91
- matrix:
92
- php: [ '7.4', '8.0' ]
93
- steps:
94
- - uses: actions/checkout@v2
95
- - name: Setup php
96
- uses: nanasess/setup-php@v3.0.6
97
- with:
98
- php-version: ${{ matrix.php }}
99
- - name: Set up Ruby
100
- uses: ruby/setup-ruby@v1
101
- with:
102
- ruby-version: 2.6
103
- - run: bundle lock
104
- - uses: actions/cache@v1
105
- with:
106
- path: vendor/gems
107
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
108
- - name: Bootstrap
109
- run: script/bootstrap
110
- - name: Set up fixtures
111
- run: script/source-setup/composer
112
- - name: Run tests
113
- run: script/test composer
114
-
115
- core:
116
- runs-on: ubuntu-latest
117
- strategy:
118
- matrix:
119
- ruby: [ 2.6, 2.7, 3.0 ]
120
- steps:
121
- - uses: actions/checkout@v2
122
- - name: Set up Ruby
123
- uses: ruby/setup-ruby@v1
124
- with:
125
- ruby-version: ${{matrix.ruby}}
126
- - name: Set up Bundler
127
- run: gem install bundler
128
- - run: bundle lock
129
- - uses: actions/cache@v1
130
- with:
131
- path: vendor/gems
132
- key: ${{ runner.os }}-gem-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
133
- - name: Bootstrap
134
- run: script/bootstrap
135
- - name: Build and lint
136
- run: bundle exec rake rubocop build
137
- - name: Core functionality tests
138
- run: script/test core
139
-
140
- dep:
141
- runs-on: ubuntu-latest
142
- steps:
143
- - uses: actions/checkout@v2
144
- - name: Setup go
145
- uses: actions/setup-go@v1
146
- with:
147
- go-version: 1.10.x
148
- - name: Set up Ruby
149
- uses: ruby/setup-ruby@v1
150
- with:
151
- ruby-version: 2.6
152
- - run: bundle lock
153
- - uses: actions/cache@v1
154
- with:
155
- path: vendor/gems
156
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
157
- - name: Bootstrap
158
- run: script/bootstrap
159
- - name: Set up fixtures
160
- run: script/source-setup/go
161
- - name: Run tests
162
- run: script/test dep
163
-
164
- go:
165
- runs-on: ubuntu-latest
166
- strategy:
167
- matrix:
168
- go: [ '1.12.x', '1.13.x', '1.14.x', '1.15.x', '1.16.x' ]
169
- steps:
170
- - uses: actions/checkout@v2
171
- - name: Setup go
172
- uses: actions/setup-go@v1
173
- with:
174
- go-version: ${{ matrix.go }}
175
- - name: Set up Ruby
176
- uses: ruby/setup-ruby@v1
177
- with:
178
- ruby-version: 2.6
179
- - run: bundle lock
180
- - uses: actions/cache@v1
181
- with:
182
- path: vendor/gems
183
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
184
- - name: Bootstrap
185
- run: script/bootstrap
186
- - name: Set up fixtures
187
- run: script/source-setup/go
188
- - name: Run tests
189
- run: script/test go
190
- env:
191
- GO111MODULE: "on"
192
-
193
- gradle:
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' ]
202
- steps:
203
- - uses: actions/checkout@v2
204
- - name: Set up Ruby
205
- uses: ruby/setup-ruby@v1
206
- with:
207
- ruby-version: 2.6
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
214
- - uses: actions/cache@v1
215
- with:
216
- path: vendor/gems
217
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
218
- - name: Bootstrap
219
- run: script/bootstrap
220
- - name: Gradle version
221
- run: test/fixtures/gradle/gradlew --quiet --version
222
- - name: Run tests
223
- run: script/test gradle
224
-
225
- manifest:
226
- runs-on: ubuntu-latest
227
- steps:
228
- - uses: actions/checkout@v2
229
- - name: Set up Ruby
230
- uses: ruby/setup-ruby@v1
231
- with:
232
- ruby-version: 2.6
233
- - run: bundle lock
234
- - uses: actions/cache@v1
235
- with:
236
- path: vendor/gems
237
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
238
- - name: Bootstrap
239
- run: script/bootstrap
240
- - name: Run tests
241
- run: script/test manifest
242
-
243
- mix:
244
- runs-on: ubuntu-latest
245
- strategy:
246
- matrix:
247
- otp: [22.x, 23.x, 24.x]
248
- elixir: [ 1.11.x, 1.12.x ]
249
- steps:
250
- - uses: actions/checkout@v2
251
- - uses: erlef/setup-elixir@v1.6.0
252
- with:
253
- otp-version: ${{matrix.otp}}
254
- elixir-version: ${{matrix.elixir}}
255
- - name: Set up Ruby
256
- uses: ruby/setup-ruby@v1
257
- with:
258
- ruby-version: 2.6
259
- - run: bundle lock
260
- - uses: actions/cache@v1
261
- with:
262
- path: vendor/gems
263
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
264
- - name: Bootstrap
265
- run: script/bootstrap
266
- - name: Set up fixtures
267
- run: script/source-setup/mix
268
- - name: Run tests
269
- run: script/test mix
270
-
271
- npm:
272
- runs-on: ubuntu-latest
273
- strategy:
274
- matrix:
275
- node_version: [ 12, 14, 16 ]
276
- steps:
277
- - uses: actions/checkout@v2
278
- - name: Setup node
279
- uses: actions/setup-node@v2
280
- with:
281
- node-version: ${{ matrix.node_version }}
282
- - name: Set up Ruby
283
- uses: ruby/setup-ruby@v1
284
- with:
285
- ruby-version: 2.6
286
- - run: bundle lock
287
- - uses: actions/cache@v1
288
- with:
289
- path: vendor/gems
290
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
291
- - name: Bootstrap
292
- run: script/bootstrap
293
- - name: Set up fixtures
294
- run: script/source-setup/npm
295
- - name: Run tests
296
- run: script/test npm
297
-
298
- nuget:
299
- runs-on: ubuntu-latest
300
- strategy:
301
- matrix:
302
- dotnet: [ '3.1.x', '5.x' ]
303
- steps:
304
- - uses: actions/checkout@v2
305
- - name: Setup dotnet
306
- uses: actions/setup-dotnet@v1
307
- with:
308
- dotnet-version: ${{ matrix.dotnet }}
309
- - name: Set up Ruby
310
- uses: ruby/setup-ruby@v1
311
- with:
312
- ruby-version: 2.6
313
- - run: bundle lock
314
- - uses: actions/cache@v1
315
- with:
316
- path: vendor/gems
317
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
318
- - name: Bootstrap
319
- run: script/bootstrap
320
- - name: Set up fixtures
321
- run: script/source-setup/nuget
322
- - name: Run tests
323
- run: script/test nuget
324
-
325
- pip:
326
- runs-on: ubuntu-latest
327
- strategy:
328
- matrix:
329
- python: [ '3.6', '3.7', '3.8', '3.9' ]
330
- steps:
331
- - uses: actions/checkout@v2
332
- - name: Setup python
333
- uses: actions/setup-python@v1
334
- with:
335
- python-version: ${{ matrix.python }}
336
- architecture: x64
337
- - name: Set up Ruby
338
- uses: ruby/setup-ruby@v1
339
- with:
340
- ruby-version: 2.6
341
- - run: bundle lock
342
- - uses: actions/cache@v1
343
- with:
344
- path: vendor/gems
345
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
346
- - name: Bootstrap
347
- run: script/bootstrap
348
- - name: Install virtualenv
349
- run: pip install virtualenv
350
- - name: Set up fixtures
351
- run: script/source-setup/pip
352
- - name: Run tests
353
- run: script/test pip
354
-
355
- pipenv:
356
- runs-on: ubuntu-latest
357
- steps:
358
- - uses: actions/checkout@v2
359
- - name: Setup python
360
- uses: actions/setup-python@v1
361
- with:
362
- python-version: '3.x'
363
- architecture: x64
364
- - name: Set up Ruby
365
- uses: ruby/setup-ruby@v1
366
- with:
367
- ruby-version: 2.6
368
- - run: bundle lock
369
- - uses: actions/cache@v1
370
- with:
371
- path: vendor/gems
372
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
373
- - name: Bootstrap
374
- run: script/bootstrap
375
- - name: Install pipenv
376
- run: pip install pipenv
377
- - name: Set up fixtures
378
- run: script/source-setup/pipenv
379
- - name: Run tests
380
- run: script/test pipenv
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
-
409
- yarn:
410
- runs-on: ubuntu-latest
411
- strategy:
412
- matrix:
413
- # not using 1.0.0 because it doesn't support `yarn list --production`
414
- yarn_version: [ 1.4.0, latest ]
415
- steps:
416
- - uses: actions/checkout@v2
417
- - name: Setup node
418
- uses: actions/setup-node@v2
419
- with:
420
- node-version: 12
421
- - name: Install Yarn
422
- run: npm install -g yarn@${YARN_VERSION}
423
- env:
424
- YARN_VERSION: ${{ matrix.yarn_version }}
425
- - name: Set up Ruby
426
- uses: ruby/setup-ruby@v1
427
- with:
428
- ruby-version: 2.6
429
- - run: bundle lock
430
- - uses: actions/cache@v1
431
- with:
432
- path: vendor/gems
433
- key: ${{ runner.os }}-gem-2.6.x-${{ hashFiles('**/Gemfile.lock') }}
434
- - name: Bootstrap
435
- run: script/bootstrap
436
- - name: Set up fixtures
437
- run: script/source-setup/yarn
438
- - name: Run tests
439
- run: script/test yarn
data/.gitignore DELETED
@@ -1,57 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # test fixtures
12
- test/fixtures/bundler/.bundle/
13
- test/fixtures/bundler/vendor/
14
- test/fixtures/bundler/Gemfile.lock
15
-
16
- test/fixtures/bower/bower_components
17
-
18
- test/fixtures/npm/node_modules
19
- test/fixtures/npm/package-lock.json
20
- test/fixtures/npm/package.json
21
-
22
- test/fixtures/go/src/*
23
- test/fixtures/go/pkg
24
- !test/fixtures/go/src/test
25
- !test/fixtures/go/src/modules_test
26
-
27
- test/fixtures/cabal/*
28
- !test/fixtures/cabal/app*
29
-
30
- test/fixtures/git_submodule/*
31
- !test/fixtures/git_submodule/README
32
-
33
- test/fixtures/pip/venv
34
-
35
- test/fixtures/pipenv/Pipfile.lock
36
-
37
- !test/fixtures/migrations/**/*
38
-
39
- test/fixtures/composer/**/*
40
- !test/fixtures/composer/composer.json
41
-
42
- test/fixtures/mix/_build
43
- test/fixtures/mix/deps
44
- test/fixtures/mix/mix.lock
45
-
46
- test/fixtures/yarn/*
47
- !test/fixtures/yarn/package.json
48
-
49
- test/fixtures/nuget/obj/*
50
-
51
- vendor/licenses
52
- .licenses
53
- *.gem
54
- vendor/gems
55
- .byebug_history
56
-
57
- bin/
data/.licensed.yml DELETED
@@ -1,7 +0,0 @@
1
- allowed:
2
- - mit
3
- - apache-2.0
4
-
5
- reviewed:
6
- bundler:
7
- - pathname-common_prefix
data/.rubocop.yml DELETED
@@ -1,8 +0,0 @@
1
- inherit_gem:
2
- rubocop-github:
3
- - config/default.yml
4
-
5
- AllCops:
6
- Exclude:
7
- - test/fixtures/**/*
8
- - vendor/gems/**/*
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.4.0
@@ -1,15 +0,0 @@
1
- FROM ruby:2.4-slim-stretch
2
-
3
- RUN apt-get update \
4
- && apt-get install -y --no-install-recommends cmake make gcc pkg-config squashfs-tools git curl bison rsync \
5
- && rm -rf /var/lib/apt/lists/*
6
-
7
- RUN curl -L https://github.com/kontena/ruby-packer/releases/download/2.6.0-0.6.0/rubyc-2.6.0-0.6.0-linux-amd64.gz | gunzip > /usr/local/bin/rubyc \
8
- && chmod +x /usr/local/bin/rubyc
9
-
10
- RUN gem update --system && gem update bundler
11
-
12
- ENV CPPFLAGS="-P"
13
- ENV RUBYC="/usr/local/bin/rubyc"
14
- ENV LANG=C.UTF-8
15
- ENV SSL_CERT_DIR="/etc/ssl/certs"
data/script/bootstrap DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle config set path 'vendor/gems'
6
- bundle install
data/script/cibuild DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- bundle exec rake test
6
- bundle exec rubocop -S -D
7
- gem build licensed.gemspec
data/script/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "licensed"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start
data/script/package DELETED
@@ -1,20 +0,0 @@
1
- #!/bin/bash
2
- #/ Usage: script/package [PLATFORM] [VERSION]
3
- #/
4
- #/ Builds distributable packages for licensed.
5
- #/ Packages are of the form licensed-$VERSION-$PLATFORM-x64.tar.gz and contain a `./licensed` executable
6
- #/ Built packages are placed in the <root>/pkg directory.
7
- #/
8
- #/ OPTIONS:
9
- #/ [PLATFORM] (optional, default to all platforms) platform to build exe for
10
- #/ [VERSION] (optional, default to current git branch or SHA1) version of licensed to build exe at
11
- #/
12
-
13
- set -e
14
-
15
- PLATFORM=""
16
- if [ -n "$1" ]; then
17
- PLATFORM=":$1"
18
- fi
19
-
20
- bundle exec rake "package$PLATFORM"
@@ -1,95 +0,0 @@
1
- #!/bin/bash
2
- #/ Usage: script/packages/build <RUBYC> [VERSION]
3
- #/
4
- #/ WARNING: Do not call this directly. Please create packages using
5
- #/ `script/package [platform]` or `bundle exec rake package[platform]`
6
- #/
7
- #/ Builds a distributable package for licensed for a given RUBYC compiler and licensed VERSION.
8
- #/ Packages are of the form licensed-$VERSION-$PLATFORM-x64.tar.gz and contain a `./licensed` executable
9
- #/ Built Packages are placed in the <root>/pkg/$VERSION directory.
10
- #/
11
- #/ OPTIONS:
12
- #/ <RUBYC> The path to a rubyc compiler that should be used to compile the target executable
13
- #/ [VERSION] (optional, default to current git branch or SHA1) version of licensed to build exe at
14
- #/
15
- #/ EXAMPLES:
16
- #/
17
- #/ Builds a package for version 1.1.0 using a local rubyc compiler
18
- #/ $ script/packages/build RUBYC="./rubyc-darwin" VERSION="1.1.0"
19
- #/
20
-
21
- set -euo pipefail
22
-
23
- BASE_DIR="$(cd "$(dirname $0)/../.." && pwd)"
24
- RUBYC=${RUBYC:=""}
25
- if [ ! -f "$RUBYC" ]; then
26
- echo "Specify a rubyc compiler using the RUBYC environment variable" >&2
27
- exit 127
28
- fi
29
-
30
- # if a version is not provided, get an identifier from the current HEAD
31
- VERSION=${VERSION:="$(git rev-parse --abbrev-ref HEAD)"}
32
-
33
- BUILD_DIR="$(mktemp -d)"
34
- COPY_DIR="$(mktemp -d)"
35
- trap "rm -rf $BUILD_DIR; rm -rf $COPY_DIR" EXIT
36
-
37
- # copy the repo to a separate directory. determining license metadata
38
- # will require a clean environment with no Gemfile.lock. using a work location
39
- # is preferred to messing with a development repository
40
- rsync -r --exclude="test/" --exclude=".licenses/" --exclude="vendor/" --exclude="Gemfile.lock" --exclude="pkg/" $BASE_DIR/ $COPY_DIR
41
- cd $COPY_DIR
42
-
43
- # ensure repo is at $VERSION and build executable, restoring the repo to previous
44
- # state after build.
45
- (
46
- # run in a subshell for ease of returning to the current branch after building
47
- # the executable
48
- CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
49
- if [[ "$VERSION" != "$CURRENT_BRANCH" ]]; then
50
- git checkout "$VERSION"
51
- trap "git checkout $CURRENT_BRANCH" EXIT
52
- fi
53
-
54
- # get the openssl dir to use when building based on ruby's default ssl cert dir
55
- OPENSSL_DIR="$(cd "$(ruby -e 'require "net/https"; puts OpenSSL::X509::DEFAULT_CERT_DIR')/.." && pwd)"
56
-
57
- # build the licensed rubyc executable
58
- "$RUBYC" --openssl-dir "$OPENSSL_DIR" --clean-tmpdir -o "$BUILD_DIR/licensed" "$COPY_DIR/exe/licensed"
59
- chmod +x $BUILD_DIR/licensed
60
- )
61
-
62
- # non-executable content will be stored in a `meta` directory
63
- mkdir -p "$BUILD_DIR/meta"
64
-
65
- # include dependency license data in package; run bundle update in temp work dir
66
- # and then run licensed on itself in that directory to grab license data
67
- # NOTE: this does not produce accurate license information if any licensed
68
- # depends on any platform-specific gems.
69
- (
70
- # run in a subshell so that `unset BUNDLER_VERSION` is contained. the ENV var
71
- # is required to successfully build a distributable executable on
72
- # dockerized linux
73
- unset BUNDLER_VERSION
74
-
75
- # determining dependency license data needs to be done from a clean environment
76
- # without previous dependencies or a Gemfile.lock so as to pull in the latest
77
- # bundler version, which is what the distributed executable uses
78
- script/bootstrap
79
- bundle exec exe/licensed cache
80
- cp -R "$COPY_DIR/.licenses" "$BUILD_DIR/meta"
81
- )
82
-
83
- # copy static metadata to build directory
84
- mkdir -p "$BUILD_DIR/meta/ruby"
85
- curl -o "$BUILD_DIR/meta/ruby/license.txt" "https://www.ruby-lang.org/en/about/license.txt"
86
- cp "$BASE_DIR/LICENSE" "$BUILD_DIR/meta"
87
- cp "$BASE_DIR/README.md" "$BUILD_DIR/meta"
88
-
89
- # create release archive
90
- PLATFORM="$(uname -s | tr '[:upper:]' '[:lower:]')"
91
- TARGET="$BASE_DIR/pkg/$VERSION/licensed-$VERSION-$PLATFORM-x64.tar.gz"
92
- mkdir -p "$(dirname $TARGET)"
93
- tar -C "$BUILD_DIR" -czf "$TARGET" .
94
-
95
- echo "licensed package built to $TARGET"