license_finder-rubyzip3 7.2.1.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.
Files changed (196) hide show
  1. checksums.yaml +7 -0
  2. data/.force-build +0 -0
  3. data/.github/dependabot.yml +16 -0
  4. data/.gitignore +13 -0
  5. data/.pre-commit-hooks.yaml +10 -0
  6. data/.rspec +1 -0
  7. data/.rubocop.yml +84 -0
  8. data/CHANGELOG.md +1066 -0
  9. data/CONTRIBUTING.md +122 -0
  10. data/Dockerfile +275 -0
  11. data/Gemfile +2 -0
  12. data/LICENSE +22 -0
  13. data/README.md +597 -0
  14. data/Rakefile +77 -0
  15. data/TODO.md +12 -0
  16. data/VERSION +1 -0
  17. data/appveyor.yml +21 -0
  18. data/bin/license_finder +6 -0
  19. data/bin/license_finder_pip.py +43 -0
  20. data/ci/pipelines/pull-request.yml.erb +138 -0
  21. data/ci/pipelines/release.yml.erb +176 -0
  22. data/ci/scripts/containerize-tests.sh +14 -0
  23. data/ci/scripts/pushscript.sh +31 -0
  24. data/ci/scripts/run-rubocop.sh +15 -0
  25. data/ci/scripts/run-tests.sh +41 -0
  26. data/ci/scripts/test.ps1 +81 -0
  27. data/ci/scripts/updateChangelog.sh +84 -0
  28. data/ci/tasks/build-and-push-gem.yml +10 -0
  29. data/ci/tasks/build-windows.yml +6 -0
  30. data/ci/tasks/build.yml +16 -0
  31. data/ci/tasks/rubocop.yml +15 -0
  32. data/ci/tasks/run-tests.yml +10 -0
  33. data/ci/tasks/update-changelog.yml +18 -0
  34. data/dlf +21 -0
  35. data/examples/Gemfile +4 -0
  36. data/examples/custom_erb_template.rb +24 -0
  37. data/examples/extract_license_data.rb +63 -0
  38. data/examples/sample_template.erb +7 -0
  39. data/lib/license_finder/cli/approvals.rb +28 -0
  40. data/lib/license_finder/cli/base.rb +113 -0
  41. data/lib/license_finder/cli/dependencies.rb +44 -0
  42. data/lib/license_finder/cli/ignored_dependencies.rb +32 -0
  43. data/lib/license_finder/cli/ignored_groups.rb +32 -0
  44. data/lib/license_finder/cli/inherited_decisions.rb +50 -0
  45. data/lib/license_finder/cli/licenses.rb +31 -0
  46. data/lib/license_finder/cli/main.rb +229 -0
  47. data/lib/license_finder/cli/makes_decisions.rb +38 -0
  48. data/lib/license_finder/cli/patched_thor.rb +33 -0
  49. data/lib/license_finder/cli/permitted_licenses.rb +32 -0
  50. data/lib/license_finder/cli/project_name.rb +32 -0
  51. data/lib/license_finder/cli/restricted_licenses.rb +32 -0
  52. data/lib/license_finder/cli.rb +20 -0
  53. data/lib/license_finder/configuration.rb +197 -0
  54. data/lib/license_finder/core.rb +121 -0
  55. data/lib/license_finder/decision_applier.rb +70 -0
  56. data/lib/license_finder/decisions.rb +334 -0
  57. data/lib/license_finder/decisions_factory.rb +13 -0
  58. data/lib/license_finder/diff.rb +51 -0
  59. data/lib/license_finder/license/any_matcher.rb +15 -0
  60. data/lib/license_finder/license/definitions.rb +498 -0
  61. data/lib/license_finder/license/header_matcher.rb +17 -0
  62. data/lib/license_finder/license/matcher.rb +24 -0
  63. data/lib/license_finder/license/none_matcher.rb +11 -0
  64. data/lib/license_finder/license/template.rb +19 -0
  65. data/lib/license_finder/license/templates/0BSD.txt +10 -0
  66. data/lib/license_finder/license/templates/AGPL3.txt +661 -0
  67. data/lib/license_finder/license/templates/Apache1_1.txt +16 -0
  68. data/lib/license_finder/license/templates/Apache2.txt +170 -0
  69. data/lib/license_finder/license/templates/Artistic.txt +128 -0
  70. data/lib/license_finder/license/templates/BSD.txt +24 -0
  71. data/lib/license_finder/license/templates/CC01.txt +30 -0
  72. data/lib/license_finder/license/templates/CC01_alt.txt +31 -0
  73. data/lib/license_finder/license/templates/CDDL1.txt +131 -0
  74. data/lib/license_finder/license/templates/CDDL1_1.txt +123 -0
  75. data/lib/license_finder/license/templates/CPL1.txt +217 -0
  76. data/lib/license_finder/license/templates/EPL1.txt +86 -0
  77. data/lib/license_finder/license/templates/EPL2.txt +80 -0
  78. data/lib/license_finder/license/templates/GPLv2.txt +339 -0
  79. data/lib/license_finder/license/templates/GPLv3.txt +674 -0
  80. data/lib/license_finder/license/templates/ISC.txt +2 -0
  81. data/lib/license_finder/license/templates/LGPL.txt +165 -0
  82. data/lib/license_finder/license/templates/LGPL2_1.txt +169 -0
  83. data/lib/license_finder/license/templates/MIT.txt +9 -0
  84. data/lib/license_finder/license/templates/MPL1_1.txt +469 -0
  85. data/lib/license_finder/license/templates/MPL2.txt +373 -0
  86. data/lib/license_finder/license/templates/NewBSD.txt +21 -0
  87. data/lib/license_finder/license/templates/OFL.txt +91 -0
  88. data/lib/license_finder/license/templates/Python.txt +47 -0
  89. data/lib/license_finder/license/templates/Ruby.txt +52 -0
  90. data/lib/license_finder/license/templates/SimplifiedBSD.txt +19 -0
  91. data/lib/license_finder/license/templates/Unlicense.txt +24 -0
  92. data/lib/license_finder/license/templates/WTFPL.txt +14 -0
  93. data/lib/license_finder/license/templates/Zlib.txt +17 -0
  94. data/lib/license_finder/license/text.rb +49 -0
  95. data/lib/license_finder/license.rb +123 -0
  96. data/lib/license_finder/license_aggregator.rb +59 -0
  97. data/lib/license_finder/logger.rb +69 -0
  98. data/lib/license_finder/manual_licenses.rb +79 -0
  99. data/lib/license_finder/package.rb +195 -0
  100. data/lib/license_finder/package_delta.rb +61 -0
  101. data/lib/license_finder/package_manager.rb +183 -0
  102. data/lib/license_finder/package_managers/bower.rb +37 -0
  103. data/lib/license_finder/package_managers/bundler.rb +110 -0
  104. data/lib/license_finder/package_managers/cargo.rb +38 -0
  105. data/lib/license_finder/package_managers/carthage.rb +68 -0
  106. data/lib/license_finder/package_managers/cocoa_pods.rb +66 -0
  107. data/lib/license_finder/package_managers/composer.rb +63 -0
  108. data/lib/license_finder/package_managers/conan.rb +70 -0
  109. data/lib/license_finder/package_managers/conda.rb +131 -0
  110. data/lib/license_finder/package_managers/dep.rb +45 -0
  111. data/lib/license_finder/package_managers/dotnet.rb +86 -0
  112. data/lib/license_finder/package_managers/erlangmk.rb +50 -0
  113. data/lib/license_finder/package_managers/glide.rb +42 -0
  114. data/lib/license_finder/package_managers/go_15vendorexperiment.rb +87 -0
  115. data/lib/license_finder/package_managers/go_dep.rb +80 -0
  116. data/lib/license_finder/package_managers/go_modules.rb +93 -0
  117. data/lib/license_finder/package_managers/go_workspace.rb +117 -0
  118. data/lib/license_finder/package_managers/govendor.rb +73 -0
  119. data/lib/license_finder/package_managers/gradle.rb +99 -0
  120. data/lib/license_finder/package_managers/gvt.rb +69 -0
  121. data/lib/license_finder/package_managers/maven.rb +69 -0
  122. data/lib/license_finder/package_managers/mix.rb +131 -0
  123. data/lib/license_finder/package_managers/npm.rb +70 -0
  124. data/lib/license_finder/package_managers/nuget.rb +159 -0
  125. data/lib/license_finder/package_managers/pip.rb +70 -0
  126. data/lib/license_finder/package_managers/pipenv.rb +63 -0
  127. data/lib/license_finder/package_managers/pnpm.rb +126 -0
  128. data/lib/license_finder/package_managers/pub.rb +86 -0
  129. data/lib/license_finder/package_managers/rebar.rb +65 -0
  130. data/lib/license_finder/package_managers/sbt.rb +46 -0
  131. data/lib/license_finder/package_managers/spm.rb +93 -0
  132. data/lib/license_finder/package_managers/trash.rb +43 -0
  133. data/lib/license_finder/package_managers/yarn.rb +195 -0
  134. data/lib/license_finder/package_utils/activation.rb +40 -0
  135. data/lib/license_finder/package_utils/conan_info_parser.rb +77 -0
  136. data/lib/license_finder/package_utils/conan_info_parser_v2.rb +82 -0
  137. data/lib/license_finder/package_utils/gradle_dependency_finder.rb +15 -0
  138. data/lib/license_finder/package_utils/license_files.rb +51 -0
  139. data/lib/license_finder/package_utils/licensing.rb +40 -0
  140. data/lib/license_finder/package_utils/maven_dependency_finder.rb +57 -0
  141. data/lib/license_finder/package_utils/notice_files.rb +51 -0
  142. data/lib/license_finder/package_utils/possible_license_file.rb +33 -0
  143. data/lib/license_finder/package_utils/pypi.rb +43 -0
  144. data/lib/license_finder/package_utils/sbt_dependency_finder.rb +15 -0
  145. data/lib/license_finder/packages/bower_package.rb +45 -0
  146. data/lib/license_finder/packages/bundler_package.rb +33 -0
  147. data/lib/license_finder/packages/cargo_package.rb +28 -0
  148. data/lib/license_finder/packages/carthage_package.rb +18 -0
  149. data/lib/license_finder/packages/cocoa_pods_package.rb +22 -0
  150. data/lib/license_finder/packages/composer_package.rb +13 -0
  151. data/lib/license_finder/packages/conan_package.rb +23 -0
  152. data/lib/license_finder/packages/conda_package.rb +74 -0
  153. data/lib/license_finder/packages/erlangmk_package.rb +112 -0
  154. data/lib/license_finder/packages/go_package.rb +30 -0
  155. data/lib/license_finder/packages/gradle_package.rb +30 -0
  156. data/lib/license_finder/packages/manual_package.rb +27 -0
  157. data/lib/license_finder/packages/maven_package.rb +39 -0
  158. data/lib/license_finder/packages/merged_package.rb +44 -0
  159. data/lib/license_finder/packages/mix_package.rb +13 -0
  160. data/lib/license_finder/packages/npm_package.rb +219 -0
  161. data/lib/license_finder/packages/nuget_package.rb +13 -0
  162. data/lib/license_finder/packages/pip_package.rb +50 -0
  163. data/lib/license_finder/packages/pnpm_package.rb +13 -0
  164. data/lib/license_finder/packages/pubspec_package.rb +18 -0
  165. data/lib/license_finder/packages/rebar_package.rb +13 -0
  166. data/lib/license_finder/packages/sbt_package.rb +22 -0
  167. data/lib/license_finder/packages/spm_package.rb +18 -0
  168. data/lib/license_finder/packages/yarn_package.rb +13 -0
  169. data/lib/license_finder/platform.rb +15 -0
  170. data/lib/license_finder/printer.rb +39 -0
  171. data/lib/license_finder/project_finder.rb +62 -0
  172. data/lib/license_finder/report.rb +34 -0
  173. data/lib/license_finder/reports/csv_report.rb +108 -0
  174. data/lib/license_finder/reports/diff_report.rb +29 -0
  175. data/lib/license_finder/reports/erb_report.rb +62 -0
  176. data/lib/license_finder/reports/html_report.rb +13 -0
  177. data/lib/license_finder/reports/json_report.rb +31 -0
  178. data/lib/license_finder/reports/junit_report.rb +23 -0
  179. data/lib/license_finder/reports/markdown_report.rb +9 -0
  180. data/lib/license_finder/reports/merged_report.rb +16 -0
  181. data/lib/license_finder/reports/templates/bootstrap.css +9 -0
  182. data/lib/license_finder/reports/templates/html_report.erb +113 -0
  183. data/lib/license_finder/reports/templates/junit_report.erb +41 -0
  184. data/lib/license_finder/reports/templates/markdown_report.erb +49 -0
  185. data/lib/license_finder/reports/templates/xml_report.erb +19 -0
  186. data/lib/license_finder/reports/text_report.rb +12 -0
  187. data/lib/license_finder/reports/xml_report.rb +23 -0
  188. data/lib/license_finder/scanner.rb +83 -0
  189. data/lib/license_finder/shared_helpers/cmd.rb +13 -0
  190. data/lib/license_finder/shared_helpers/common_path.rb +29 -0
  191. data/lib/license_finder/version.rb +6 -0
  192. data/lib/license_finder.rb +14 -0
  193. data/license_finder.gemspec +79 -0
  194. data/release/instructions.md +8 -0
  195. data/swift-all-keys.asc +240 -0
  196. metadata +604 -0
data/README.md ADDED
@@ -0,0 +1,597 @@
1
+ # License Finder
2
+
3
+ [![Code Climate](https://codeclimate.com/github/pivotal/LicenseFinder.png)](https://codeclimate.com/github/pivotal/LicenseFinder)
4
+
5
+ Build status
6
+ * Ruby 2.7.8 [![Ruby 2.7.8 build status](https://norsk.cf-app.com/api/v1/teams/main/pipelines/LicenseFinder/jobs/ruby-2.7.8/badge)](https://norsk.cf-app.com/teams/main/pipelines/LicenseFinder)
7
+ * Ruby 3.1.4 [![Ruby 3.1.4 build status](https://norsk.cf-app.com/api/v1/teams/main/pipelines/LicenseFinder/jobs/ruby-3.1.4/badge)](https://norsk.cf-app.com/teams/main/pipelines/LicenseFinder)
8
+ * Ruby 3.2.3 [![Ruby 3.2.3 build status](https://norsk.cf-app.com/api/v1/teams/main/pipelines/LicenseFinder/jobs/ruby-3.2.3/badge)](https://norsk.cf-app.com/teams/main/pipelines/LicenseFinder)
9
+ * Ruby 3.3.0 [![Ruby 3.3.0 build status](https://norsk.cf-app.com/api/v1/teams/main/pipelines/LicenseFinder/jobs/ruby-3.3.0/badge)](https://norsk.cf-app.com/teams/main/pipelines/LicenseFinder)
10
+
11
+
12
+ LicenseFinder works with your package managers to find dependencies,
13
+ detect the licenses of the packages in them, compare those licenses
14
+ against a user-defined list of permitted licenses,
15
+ and give you an actionable exception report.
16
+
17
+ * code: https://github.com/pivotal/LicenseFinder
18
+ * ci: https://norsk.cf-app.com/teams/main/pipelines/LicenseFinder
19
+ * docker: [licensefinder/license_finder](https://hub.docker.com/r/licensefinder/license_finder/)
20
+ * the docker image contains all the package managers needed to run `license_finder`
21
+ * support:
22
+ * The primary form of communication for support is through github issues. The google groups are not actively
23
+ monitored
24
+ * license-finder@googlegroups.com
25
+ * https://groups.google.com/forum/#!forum/license-finder
26
+
27
+ ### Supported project types
28
+
29
+ | Project Type | Package Manager | Tested on Version |
30
+ | ------------ |-----------------|------------------:|
31
+ | Ruby Gems | bundler | 2.3.7 |
32
+ | Python 2.7 Eggs | pip2 | 19.0.2 |
33
+ | Python 3.5 Eggs | pip3 | 20.0.2 |
34
+ | Node.js | npm | 6.4.1 |
35
+ | Bower | bower | 1.8.4 |
36
+ | Nuget (without license discovery) | nuget | 4.7.1.5393 |
37
+ | Godep | Godep | 80 |
38
+ | Go workspace | Go lang | 1.11.5 |
39
+ | Go modules | Go lang | 1.14.3 |
40
+ | Java | maven | 3.6.0 |
41
+ | Java | gradle | 5.6.4 |
42
+
43
+ ### Experimental project types
44
+
45
+ * Erlang (via `rebar` and `Erlang.mk`)
46
+ * Objective-C, Swift (via Carthage, CocoaPods \[0.39 and below. See [CocoaPods Specs Repo Sharding](http://blog.cocoapods.org/Sharding/)\]) and Swift Package Manager(SPM)
47
+ * Elixir (via `mix`)
48
+ * Golang (via `gvt`, `glide`,`dep`, `trash` and `govendor`)
49
+ * JavaScript (via `yarn`)
50
+ * C++/C (via `conan`)
51
+ * Scala (via `sbt`)
52
+ * Rust (via `cargo`)
53
+ * PHP (via `composer`)
54
+ * Python (via `Conda`, `pipenv`)
55
+ * Flutter (via `flutter pub`)
56
+
57
+ ## Installation
58
+
59
+ License Finder may be run as a [pre-commit](https://pre-commit.com) hook by
60
+ adding the following to your `.pre-commit-config.yaml`:
61
+
62
+ ```yaml
63
+ repos:
64
+ - repo: https://github.com/pivotal/LicenseFinder
65
+ rev: v7.1.0 # You probably want the latest tag.
66
+ hooks:
67
+ - id: license-finder
68
+ ```
69
+
70
+ Running License Finder directly requires Ruby 2.6.0 or greater. If you have an
71
+ older version of Ruby installed, you can update via Homebrew:
72
+
73
+ ```sh
74
+ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
75
+ ```
76
+
77
+ then:
78
+
79
+ ```sh
80
+ $ brew install ruby
81
+ ```
82
+
83
+ The easiest way to use `license_finder` directly is to install it as a command
84
+ line tool, like brew, awk, gem or bundler:
85
+
86
+ ```sh
87
+ $ gem install license_finder
88
+ ```
89
+
90
+ Though it's less preferable, if you are using bundler in a Ruby
91
+ project, you can add `license_finder` to your Gemfile:
92
+
93
+ ```ruby
94
+ gem 'license_finder', :group => :development
95
+ ```
96
+
97
+ This approach helps you remember to install `license_finder`, but can
98
+ pull in unwanted dependencies, including `bundler`. To mitigate this
99
+ problem, see [Excluding Dependencies](#excluding-dependencies).
100
+
101
+
102
+ ## Usage
103
+
104
+ Make sure your dependencies are installed (with your package manager's install command: `bundle install`, `npm install`, etc.)
105
+
106
+ The first time you run `license_finder` it will list all your project's packages.
107
+
108
+ ```sh
109
+ $ license_finder
110
+ ```
111
+
112
+ Or, if you installed with bundler:
113
+
114
+ ```sh
115
+ $ bundle exec license_finder
116
+ ```
117
+
118
+ The output will report that none of your packages have been
119
+ approved. Over time you will tell `license_finder` which packages
120
+ are approved, so when you run this command in the future, it will
121
+ report current action items; i.e., packages that are new or have
122
+ never been approved.
123
+
124
+ If you don't wish to see progressive output "dots", use the `--quiet`
125
+ option.
126
+
127
+ If you'd like to see debugging output, use the `--debug`
128
+ option. `license_finder` will then output info about packages, their
129
+ dependencies, and where and how each license was discovered. This can
130
+ be useful when you need to track down an unexpected package or
131
+ license.
132
+
133
+ If you do not want to manually run an individual package manager's prepare
134
+ command (ex: `bundle install`, `npm install`, etc) to ensure your project
135
+ is fully prepared to be scanned, use the `--prepare` or `-p` option which will run
136
+ each active package manager's prepare command for you. If you would like to continue
137
+ running `license_finder` even if there is an issue with a prepare step, use the
138
+ `--prepare-no-fail` option which prepares but carries on despite any potential failures.
139
+
140
+ Run `license_finder help` to see other available commands, and
141
+ `license_finder help [COMMAND]` for detailed help on a specific
142
+ command.
143
+
144
+ ### Docker
145
+
146
+ If you have docker installed, try using the included `dlf` script (potentially
147
+ symlinked to be in your path via `ln -s LicenseFinder/dlf /usr/local/bin` or
148
+ whatever method you prefer). This will run any commands passed to it inside a
149
+ pre-provisioned Docker container to maintain consistent versions of all the
150
+ package managers. For example,
151
+
152
+ ```
153
+ $ dlf npm --version
154
+ 5.3.0
155
+
156
+ $ dlf license_finder --help
157
+
158
+ Dependencies that need approval:
159
+ ...
160
+ license_finder, 3.0.3, MIT
161
+
162
+ $ dlf "bundle install && license_finder"
163
+ ```
164
+
165
+ You can better understand the way this script works by looking at its source, but for
166
+ reference it will mount your current directory at the path `/scan` and run any commands
167
+ passed to it from that directory. If your command has `&&`, ensure you quote the command.
168
+ If it does not, ensure the command is not quoted.
169
+
170
+ Note that the docker image will run the gem which is installed within it.
171
+ So the docker image tagged `7.0.0` will run *License Finder Version 7.0.0*
172
+
173
+ See the [contributing guide](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md) for information on development.
174
+
175
+ ### Activation
176
+
177
+ `license_finder` will find and include packages for all supported
178
+ languages, as long as that language has a package definition in the project directory:
179
+
180
+ * `Gemfile` (for `bundler`)
181
+ * `requirements.txt` (for `pip`)
182
+ * `Pipfile.lock` (for `pipenv`)
183
+ * `package.json` (for `npm`)
184
+ * `pom.xml` (for `maven`)
185
+ * `build.gradle` or `build.gradle.kts` (for `gradle`)
186
+ * `settings.gradle` that specifies `rootProject.buildFileName` (for `gradle`)
187
+ * `bower.json` (for `bower`)
188
+ * `Podfile` (for `pod`) (set `ACKNOWLEDGEMENTS_PATH` variable if you want to target a particular `Pods-acknowledgements-<TARGET>.plist`. Can be useful in multi-target pods projects.)
189
+ * `Cartfile` (for `carthage`)
190
+ * `workspace-state.json` under build directory (provided as enviroment variable `SPM_DERIVED_DATA` for Xcode, or default `.build` for non-Xcode projects), (for `spm`)
191
+ * `rebar.config` (for `rebar`)
192
+ * `Erlang.mk` or `erlang.mk` file (for `Erlang.mk`)
193
+ * `mix.exs` (for `mix`)
194
+ * `packages/` directory (for `nuget`)
195
+ * `*.csproj` (for `dotnet`)
196
+ * `vendor/manifest` or `*/vendor/manifest` file (for `gvt`)
197
+ * `glide.lock` file (for `glide`)
198
+ * `vendor/vendor.json` file (for `govendor`)
199
+ * `Gopkg.lock` file (for `dep`)
200
+ * `Godeps/Godeps.json` (for `godep`)
201
+ * `*.envrc` file (for `go`)
202
+ * `go.mod` file (for `go mod`)
203
+ * `vendor.conf` file (for `trash`)
204
+ * `yarn.lock` file (for `yarn`)
205
+ * `conanfile.txt` file (for `conan`)
206
+ * `build.sbt` file (for `sbt`)
207
+ * `Cargo.lock` file (for `cargo`)
208
+ * `composer.lock` file (for `composer`)
209
+ * `environment.yml` file (for `conda`)
210
+ * `pubspec.yaml & .pub cache locaton through ENV variable` (for `flutter`)
211
+
212
+ ### Continuous Integration
213
+
214
+ `license_finder` will return a non-zero exit status if there are unapproved
215
+ dependencies. This can be useful for inclusion in a CI environment to alert you
216
+ if someone adds an unapproved dependency to the project.
217
+
218
+
219
+ ## Approving Dependencies
220
+
221
+ `license_finder` will inform you whenever you have an unapproved dependency.
222
+ If your business decides this is an acceptable risk, the easiest way to approve
223
+ the dependency is by running `license_finder approvals add`.
224
+
225
+ For example, let's assume you've added the `awesome_gpl_gem`
226
+ to your Gemfile, which `license_finder` reports is unapproved:
227
+
228
+ ```sh
229
+ $ license_finder
230
+ Dependencies that need approval:
231
+ awesome_gpl_gem, 1.0.0, GPL
232
+ ```
233
+
234
+ Your business tells you that in this case, it's acceptable to use this
235
+ gem. You now run:
236
+
237
+ ```sh
238
+ $ license_finder approvals add awesome_gpl_gem
239
+ ```
240
+
241
+ If you rerun `license_finder`, you should no longer see
242
+ `awesome_gpl_gem` in the output.
243
+
244
+ To approve specific version
245
+
246
+ ```sh
247
+ $ license_finder approvals add awesome_gpl_gem --version=1.0.0
248
+ ```
249
+
250
+ To record who approved the dependency and why:
251
+
252
+ ```sh
253
+ $ license_finder approvals add awesome_gpl_gem --who CTO --why "Go ahead"
254
+ ```
255
+
256
+ ### Permitting Licenses
257
+
258
+ Approving packages one-by-one can be tedious. Usually your business has
259
+ blanket policies about which packages are approved. To tell `license_finder`
260
+ that any package with the MIT license should be approved, run:
261
+
262
+ ``` sh
263
+ $ license_finder permitted_licenses add MIT
264
+ ```
265
+
266
+ Any current or future packages with the MIT license will be excluded from the
267
+ output of `license_finder`.
268
+
269
+ You can also record `--who` and `--why` when changing permitted licenses,
270
+ or making any other decision about your project.
271
+
272
+
273
+ ## Output and Artifacts
274
+
275
+ ### Decisions file
276
+
277
+ Any decisions you make about approvals will be recorded in a YAML file named
278
+ `doc/dependency_decisions.yml`.
279
+
280
+ This file must be committed to version control. Rarely, you will have to
281
+ manually resolve conflicts in it. In this situation, keep in mind that each
282
+ decision has an associated timestamp, and the decisions are processed
283
+ top-to-bottom, with later decisions overwriting or appending to earlier
284
+ decisions.
285
+
286
+ ### Output from `action_items`
287
+
288
+ You could expect `license_finder`, which is an alias for `license_finder
289
+ action_items` to output something like the following on a Rails project where
290
+ MIT had been permitted:
291
+
292
+ ```
293
+ Dependencies that need approval:
294
+
295
+ highline, 1.6.14, ruby
296
+ json, 1.7.5, ruby
297
+ mime-types, 1.19, ruby
298
+ rails, 3.2.8, unknown
299
+ rdoc, 3.12, unknown
300
+ rubyzip, 0.9.9, ruby
301
+ xml-simple, 1.1.1, unknown
302
+ ```
303
+
304
+ You can customize the format of the output in the same way that you customize
305
+ [output from `report`](#output-from-report).
306
+
307
+ ### Output from `project_roots`
308
+
309
+ The `license_finder project_roots` command will output the current working directory as a string in an array.
310
+
311
+ Using the `--recursive` option means the array will include subdirectories that contain a known package manager. With the exception that Gradle and Maven subprojects will not be included.
312
+
313
+
314
+ ### Output from `report`
315
+
316
+ The `license_finder report` command will output human-readable reports that you
317
+ could send to your non-technical business partners, lawyers, etc. You can
318
+ choose the format of the report (text, csv, html or markdown); see
319
+ `license_finder --help report` for details. The output is sent to STDOUT, so
320
+ you can save the reports wherever you want them. You can commit them to
321
+ version control if you like.
322
+
323
+ The HTML report generated by `license_finder report --format html` summarizes
324
+ all of your project's dependencies and includes information about which need to
325
+ be approved. The project name at the top of the report can be set with
326
+ `license_finder project_name add`.
327
+
328
+ ### Note:
329
+ When using the yarn package manager, when a node_module's package.json doesn't
330
+ explicitly declare a license, yarn indicates that it has inferred the license based
331
+ on some keywords in other files by appending an asterisk to the license name. If you
332
+ see a * at the end of the license name, this is intended.
333
+
334
+ See [CONTRIBUTING.md](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md#adding-reports)
335
+ for advice about adding and customizing reports.
336
+
337
+
338
+ ## Manual Intervention
339
+
340
+ ### Setting Licenses
341
+
342
+ When `license_finder` reports that a dependency's license is 'unknown',
343
+ you should manually research what the actual license is. When you
344
+ have established the real license, you can record it with:
345
+
346
+ ```sh
347
+ $ license_finder licenses add my_unknown_dependency MIT
348
+ ```
349
+
350
+ This command would assign the MIT license to all versions of the dependency
351
+ `my_unknown_dependency`. If you prefer, you could instead assign the license
352
+ to only a specific version of the dependency:
353
+
354
+ ```sh
355
+ $ license_finder licenses add my_unknown_dependency MIT --version=1.0.0
356
+ ```
357
+
358
+ Please note that adding a license to a specific version of a dependency will
359
+ cause any licenses previously added to all versions of that dependency to be
360
+ forgotten. Similarly, adding a license to all versions of a dependency will
361
+ override any licenses previously added to specific versions of that dependency.
362
+
363
+ There are several ways in which you can remove licenses that were previously
364
+ added through the `licenses add` command:
365
+
366
+ ```sh
367
+ # Removes all licenses from any version of the dependency
368
+ $ license_finder licenses remove my_unknown_dependency
369
+
370
+ # Removes just the MIT license from any version of the dependency
371
+ $ license_finder licenses remove my_unknown_dependency MIT
372
+
373
+ # Removes all licenses from only version 1.0.0 of the dependency
374
+ # This has no effect if you had last added a license to all versions of the dependency
375
+ $ license_finder licenses remove my_unknown_dependency --version=1.0.0
376
+
377
+ # Removes just the MIT license from only version 1.0.0 of the dependency
378
+ # This has no effect if you had last added a license to all versions of the dependency
379
+ $ license_finder licenses remove my_unknown_dependency MIT --version=1.0.0
380
+ ```
381
+
382
+ ### Adding Hidden Dependencies
383
+
384
+ `license_finder` can track dependencies that your package managers
385
+ don't know about (JS libraries that don't appear in your
386
+ Gemfile/requirements.txt/package.json, etc.)
387
+
388
+ ```sh
389
+ $ license_finder dependencies add my_js_dep MIT 0.1.2
390
+ ```
391
+
392
+ Run `license_finder dependencies help` for
393
+ additional documentation about managing these dependencies.
394
+
395
+ `license_finder` cannot automatically detect when one of these
396
+ dependencies has been removed from your project, so you can use:
397
+
398
+ ```sh
399
+ $ license_finder dependencies remove my_js_dep
400
+ ```
401
+
402
+ ### Excluding Dependencies
403
+
404
+ Sometimes a project will have development or test dependencies which
405
+ you don't want to track. You can exclude theses dependencies by running
406
+ `license_finder ignored_groups`. (Currently this only works for packages
407
+ managed by Bundler, NPM, Yarn, Maven, Pip2, Pip3, and Nuget.)
408
+
409
+ On rare occasions a package manager will report an individual dependency
410
+ that you want to exclude from all reports, even though it is approved.
411
+ You can exclude an individual dependency by running
412
+ `license_finder ignored_dependencies`. Think carefully before adding
413
+ dependencies to this list. A likely item to exclude is `bundler`,
414
+ since it is a common dependency whose version changes from machine to
415
+ machine. Adding it to the `ignored_dependencies` would prevent it
416
+ (and its oscillating versions) from appearing in reports.
417
+
418
+ ### Restricting Licenses
419
+
420
+ Some projects will have a list of licenses that cannot be used. You can
421
+ restrict these licenses with `license_finder restricted_licenses add`. Any dependency
422
+ that has exclusively restricted licenses will always appear in the action
423
+ items, even if someone attempts to manually approve or permit it. However,
424
+ if a dependency has even one license that is not restricted, it can still be
425
+ manually approved or permitted.
426
+
427
+ ## Decision inheritance
428
+
429
+ Add or remove decision files you want to inherit from - see `license_finder inherited_decisions help` for more information.
430
+
431
+ This allows you to have a centralized decision file for approved/restricted licenses. If you have multiple projects it's way easier to have one single place where you approved or restricted licenses defined.
432
+
433
+ Add one or more decision files to the inherited decisions
434
+ ```bash
435
+ license_finder inherited_decisions add DECISION_FILE
436
+ ```
437
+
438
+ Remove one or more decision files from the inherited decisions
439
+ ```bash
440
+ license_finder inherited_decisions remove DECISION_FILE
441
+ ```
442
+
443
+ List all the inherited decision files
444
+ ```bash
445
+ license_finder inherited_decisions list
446
+ ```
447
+
448
+ ## Configuration
449
+
450
+ Be default, `license_finder` expects the decisions file to be stored at
451
+ `doc/dependency_decisions.yml`. All commands can be passed `--decisions_file`
452
+ to override this location.
453
+
454
+ ### Package Manager Configuration
455
+
456
+ If you have a gradle project, you can invoke gradle with a custom script by
457
+ passing (for example) `--gradle_command gradlew` to `license_finder` or
458
+ `license_finder report`.
459
+
460
+ Similarly you can invoke a custom rebar script with `--rebar_command rebar`.
461
+ If you store rebar dependencies in a custom directory (by setting `deps_dir` in
462
+ `rebar.config`), set `--rebar_deps_dir`.
463
+
464
+ You can also invoke a custom Mix script `remix` with `--mix_command remix` and
465
+ set `--mix_deps_dir` to fetch Mix dependencies from a custom directory.
466
+
467
+ ### Narrow down Package Manager
468
+
469
+ By default, license_finder will check for all supported package managers,
470
+ but you can narrow it down to use only those you pass to `--enabled-package-managers`.
471
+ For example,
472
+
473
+ ```
474
+ $ license_finder --enabled-package-managers bundler npm
475
+ ```
476
+
477
+ ### Saving Configuration
478
+
479
+ It may be difficult to remember to pass command line options to every command.
480
+ In some of these cases you can store default values in a YAML formatted config
481
+ file. `license_finder` looks for this file in `config/license_finder.yml`.
482
+
483
+ As an example, the file might look like this:
484
+
485
+ ```yaml
486
+ ---
487
+ decisions_file: './some_path/decisions.yml'
488
+ gradle_command: './gradlew'
489
+ rebar_command: './rebarw'
490
+ rebar_deps_dir: './rebar_deps'
491
+ mix_command: './mixw'
492
+ mix_deps_dir: './mix_deps'
493
+ enabled_package_managers:
494
+ - bundler
495
+ - gradle
496
+ - rebar
497
+ - mix
498
+ ```
499
+
500
+ ### Gradle Projects
501
+
502
+ `license_finder` supports both Gradle 1.x and Gradle 2.x. You need to have installed
503
+ the license-gradle-plugin in your project:
504
+ [https://github.com/hierynomus/license-gradle-plugin](https://github.com/hierynomus/license-gradle-plugin)
505
+
506
+ By default, `license_finder` will report on Gradle's "runtime" dependencies. If
507
+ you want to generate a report for some other dependency configuration (e.g.
508
+ Android projects will sometimes specify their meaningful dependencies in the
509
+ "compile" group), you can specify it in your project's `build.gradle`:
510
+
511
+ ```
512
+ // Must come *after* applying the appropriate plugin from [https://github.com/hierynomus/license-gradle-plugin](https://github.com/hierynomus/license-gradle-plugin)
513
+
514
+ downloadLicenses {
515
+ dependencyConfiguration "compile"
516
+ }
517
+ ```
518
+
519
+ ### Conan Projects
520
+
521
+ `license_finder` supports Conan. You need to have the following lines in your conanfile.txt for `license_finder` to retrieve dependencies' licenses.
522
+ Ensure that `conan install` does not generate an error.
523
+
524
+ ```
525
+ [imports]
526
+ ., license* -> ./licenses @ folder=True, ignore_case=True
527
+ ```
528
+
529
+ ### SBT Projects
530
+
531
+ `license_finder` supports SBT. You need to have installed the sbt-license-report in your project:
532
+ [https://github.com/sbt/sbt-license-report](https://github.com/sbt/sbt-license-report)
533
+
534
+ By default, `license_finder` will report on SBT's "compile" and "test" dependencies. If
535
+ you want to generate a report for some other dependency configuration, you can specify
536
+ it in your projects's `build.sbt`
537
+
538
+ ```
539
+ licenseConfigurations := Set("compile", "provided")
540
+ ```
541
+
542
+ ## Requirements
543
+
544
+ `license_finder` requires ruby >= 2.6.0.
545
+
546
+
547
+ ## Upgrading
548
+
549
+ To upgrade to `license_finder` version >= 6.0, you have to replace the terminology `whitelist` with `permit` and `blacklist` with `restrict` in your `dependency_decisions.yml`. See [Changelog](https://github.com/pivotal/LicenseFinder/blob/master/CHANGELOG.md#600--2020-01-22) for more details.
550
+
551
+ To upgrade from `license_finder` version 1.2 to 2.0, see
552
+ [`license_finder_upgrade`](https://github.com/mainej/license_finder_upgrade).
553
+ To upgrade to 2.0 from a version lower than 1.2, first upgrade to 1.2, and run
554
+ `license_finder` at least once. This will ensure that the `license_finder`
555
+ database is in a state which `license_finder_upgrade` understands.
556
+
557
+
558
+ ## A Plea to Package Authors and Maintainers
559
+
560
+ Please add a license to your package specs! Most packaging systems
561
+ allow for the specification of one or more licenses.
562
+
563
+ For example, Ruby Gems can specify a license by name:
564
+
565
+ ```ruby
566
+ Gem::Specification.new do |s|
567
+ s.name = "my_great_gem"
568
+ s.license = "MIT"
569
+ end
570
+ ```
571
+
572
+ And save a `LICENSE` file which contains your license text in your repo.
573
+
574
+ ## Known issues with specific package managers
575
+
576
+ * Bundler
577
+ * When using `--project-path`, Bundler cannot find the Gemfile.
578
+
579
+ * Yarn
580
+ * A module that is incompatible with the platform on which
581
+ license_finder is run will always be reported to have a license type
582
+ of "unknown". ([#456](https://github.com/pivotal/LicenseFinder/issues/456))
583
+
584
+ ## Support
585
+
586
+ * Send an email to the list: [license-finder@googlegroups.com](license-finder@googlegroups.com)
587
+ * View the project backlog at Pivotal Tracker: [https://www.pivotaltracker.com/n/projects/234851](https://www.pivotaltracker.com/n/projects/234851)
588
+
589
+
590
+ ## Contributing
591
+
592
+ See [CONTRIBUTING.md](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md).
593
+
594
+
595
+ ## License
596
+
597
+ LicenseFinder is released under the MIT License. http://www.opensource.org/licenses/mit-license
data/Rakefile ADDED
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require './lib/license_finder/platform'
7
+ require 'rspec/core/rake_task'
8
+
9
+ desc 'Run all specs in spec/'
10
+ RSpec::Core::RakeTask.new(:spec) do |t|
11
+ t.fail_on_error = true
12
+ t.pattern = './spec/**/*_spec.rb'
13
+ t.rspec_opts = %w[--color]
14
+ end
15
+
16
+ namespace :features do
17
+ desc 'Run test tagged \'focus\''
18
+ RSpec::Core::RakeTask.new(:focus) do |t|
19
+ t.fail_on_error = true
20
+ t.pattern = './features/**/*_spec.rb'
21
+ opts = %w[--color --format d --tag focus]
22
+ opts += LicenseFinder::Platform.darwin? ? [] : %w[--tag ~ios]
23
+ t.rspec_opts = opts
24
+ end
25
+ end
26
+
27
+ desc 'Run all specs in features/'
28
+ RSpec::Core::RakeTask.new(:features) do |t|
29
+ t.fail_on_error = true
30
+ t.pattern = './features/**/*_spec.rb'
31
+ opts = %w[--color --format d]
32
+ opts += LicenseFinder::Platform.darwin? ? [] : %w[--tag ~ios]
33
+ t.rspec_opts = opts
34
+ end
35
+
36
+ desc 'Check for non-Ruby development dependencies.'
37
+ task :check_dependencies do
38
+ require './lib/license_finder'
39
+ satisfied = true
40
+ LicenseFinder::Scanner::PACKAGE_MANAGERS.each do |package_manager|
41
+ satisfied = false unless package_manager.new(project_path: Pathname.new('')).installed?(LicenseFinder::Logger.new(LicenseFinder::Logger::MODE_INFO))
42
+ end
43
+ $stdout.flush
44
+ exit 1 unless satisfied
45
+ end
46
+
47
+ desc 'Configure LF and LF PR pipeline'
48
+ task :update_pipeline, [:slack_url, :slack_channel] do |_, args|
49
+ slack_url = args[:slack_url]
50
+ slack_channel = args[:slack_channel]
51
+
52
+ unless slack_url || slack_channel
53
+ puts 'Warning: skipping slack notifications setup'
54
+ puts 'Warning: You should provide slack channel and url to receive slack notifications on build failures'
55
+ end
56
+
57
+ ruby_versions = %w[3.3.0 3.2.3 3.1.4 2.7.8]
58
+
59
+ params = []
60
+ params << "ruby_versions=#{ruby_versions.join(',')}"
61
+ params << "slack_url=#{slack_url}" if slack_url
62
+ params << "slack_channel=#{slack_channel}" if slack_channel
63
+
64
+ vars = params.join(' ')
65
+
66
+ cmd = "bash -c \"fly -t osl set-pipeline -n -p LicenseFinder --config <(erb #{vars} ci/pipelines/release.yml.erb)\""
67
+ system(cmd)
68
+
69
+ cmd = "bash -c \"fly -t osl set-pipeline -n -p LicenseFinder-pr --config <(erb #{vars} ci/pipelines/pull-request.yml.erb)\""
70
+ system(cmd)
71
+ end
72
+
73
+ task default: %i[spec features]
74
+ task spec: :check_dependencies
75
+ task features: :check_dependencies
76
+ task 'spec:focus': :check_dependencies
77
+ task 'features:focus': :check_dependencies
data/TODO.md ADDED
@@ -0,0 +1,12 @@
1
+ # immediate
2
+
3
+ # architecture
4
+
5
+ # renamings, etc.
6
+
7
+ - classes under `package_managers` should be in a PackageManagers module
8
+ - `license_names_from_standard_spec` should be the default instance method
9
+
10
+ # docs
11
+
12
+ - specify gradle version >= 1.8
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 7.2.1.1