license_finder 2.0.4 → 2.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -4
  3. data/.travis/install_godep.sh +6 -0
  4. data/.travis/install_gradle.sh +1 -1
  5. data/.travis/install_rebar.sh +7 -5
  6. data/CHANGELOG.rdoc +13 -0
  7. data/CONTRIBUTING.md +16 -2
  8. data/README.md +41 -4
  9. data/Rakefile +8 -2
  10. data/features/features/{cli_spec.rb → cli/cli_spec.rb} +24 -18
  11. data/features/features/configure/add_dependencies_spec.rb +18 -1
  12. data/features/features/configure/approve_dependencies_spec.rb +31 -1
  13. data/features/features/configure/assign_licenses_spec.rb +18 -3
  14. data/features/features/configure/blacklist_licenses_spec.rb +30 -0
  15. data/features/features/configure/ignore_dependencies_spec.rb +1 -1
  16. data/features/features/configure/ignore_groups_spec.rb +16 -1
  17. data/features/features/configure/name_project_spec.rb +1 -1
  18. data/features/features/configure/set_project_path_spec.rb +1 -1
  19. data/features/features/configure/whitelist_licenses_spec.rb +1 -3
  20. data/features/features/package_managers/bower_spec.rb +1 -1
  21. data/features/features/package_managers/cocoapods_spec.rb +1 -1
  22. data/features/features/package_managers/godep_spec.rb +17 -0
  23. data/features/features/package_managers/gradle_spec.rb +18 -4
  24. data/features/features/package_managers/maven_spec.rb +1 -1
  25. data/features/features/package_managers/npm_spec.rb +1 -1
  26. data/features/features/package_managers/nuget_spec.rb +14 -0
  27. data/features/features/package_managers/pip_spec.rb +1 -1
  28. data/features/features/package_managers/rebar_spec.rb +1 -1
  29. data/features/features/report/composite_spec.rb +15 -0
  30. data/features/features/report/csv_spec.rb +1 -1
  31. data/features/features/report/diff_spec.rb +190 -0
  32. data/features/features/report/html_spec.rb +1 -1
  33. data/features/features/report/subproject_spec.rb +52 -0
  34. data/features/fixtures/file-based-libs-gradle/build.gradle +18 -0
  35. data/features/fixtures/file-based-libs-gradle/libs/data.json-0.2.3.jar +0 -0
  36. data/features/fixtures/gopath/src/github.com/pivotal/foo/Godeps/Godeps.json +16 -0
  37. data/features/fixtures/gopath/src/github.com/pivotal/foo/Godeps/Readme +5 -0
  38. data/features/fixtures/gopath/src/github.com/pivotal/foo/foo.go +6 -0
  39. data/features/fixtures/multi-module-gradle/build.gradle +18 -0
  40. data/features/fixtures/multi-module-gradle/module1/build.gradle +3 -0
  41. data/features/fixtures/multi-module-gradle/module2/build.gradle +3 -0
  42. data/features/fixtures/multi-module-gradle/settings.gradle +1 -0
  43. data/features/fixtures/nuget/Fun.Test/packages.config +4 -0
  44. data/features/fixtures/nuget/Fun/packages.config +5 -0
  45. data/features/fixtures/nuget/packages/Microsoft.AspNet.Mvc.4.0.30506.0/.keep +0 -0
  46. data/features/fixtures/nuget/packages/NUnit.2.6.4/.keep +0 -0
  47. data/features/fixtures/nuget/packages/Ninject.MVC4.3.2.1.0/.keep +0 -0
  48. data/features/fixtures/nuget/packages/repositories.config +6 -0
  49. data/features/fixtures/{build.gradle → single-module-gradle/build.gradle} +0 -0
  50. data/{spec → features/support}/feature_helper.rb +5 -1
  51. data/features/support/testing_dsl.rb +297 -212
  52. data/lib/license_finder/cli.rb +1 -0
  53. data/lib/license_finder/cli/base.rb +16 -3
  54. data/lib/license_finder/cli/blacklist.rb +30 -0
  55. data/lib/license_finder/cli/main.rb +62 -4
  56. data/lib/license_finder/configuration.rb +39 -8
  57. data/lib/license_finder/core.rb +13 -10
  58. data/lib/license_finder/decision_applier.rb +14 -9
  59. data/lib/license_finder/decisions.rb +24 -6
  60. data/lib/license_finder/diff.rb +47 -0
  61. data/lib/license_finder/license_aggregator.rb +25 -0
  62. data/lib/license_finder/package.rb +39 -6
  63. data/lib/license_finder/package_delta.rb +65 -0
  64. data/lib/license_finder/package_manager.rb +10 -3
  65. data/lib/license_finder/package_managers/bower.rb +3 -1
  66. data/lib/license_finder/package_managers/bundler.rb +18 -9
  67. data/lib/license_finder/package_managers/bundler_package.rb +6 -2
  68. data/lib/license_finder/package_managers/go_dep.rb +25 -0
  69. data/lib/license_finder/package_managers/go_package.rb +19 -0
  70. data/lib/license_finder/package_managers/go_workspace.rb +35 -0
  71. data/lib/license_finder/package_managers/gradle.rb +16 -17
  72. data/lib/license_finder/package_managers/gradle_dependency_finder.rb +13 -0
  73. data/lib/license_finder/package_managers/gradle_package.rb +6 -1
  74. data/lib/license_finder/package_managers/maven.rb +3 -1
  75. data/lib/license_finder/package_managers/merged_package.rb +43 -0
  76. data/lib/license_finder/package_managers/npm.rb +42 -24
  77. data/lib/license_finder/package_managers/nuget.rb +50 -0
  78. data/lib/license_finder/package_managers/nuget_package.rb +4 -0
  79. data/lib/license_finder/package_managers/pip_package.rb +1 -0
  80. data/lib/license_finder/package_managers/rebar.rb +2 -6
  81. data/lib/license_finder/platform.rb +4 -1
  82. data/lib/license_finder/project_finder.rb +56 -0
  83. data/lib/license_finder/report.rb +3 -2
  84. data/lib/license_finder/reports/csv_report.rb +6 -2
  85. data/lib/license_finder/reports/diff_report.rb +33 -0
  86. data/lib/license_finder/reports/merged_report.rb +13 -0
  87. data/lib/license_finder/version.rb +1 -1
  88. data/license_finder.gemspec +6 -2
  89. data/spec/dummy_app/Gemfile +6 -0
  90. data/spec/fixtures/all_pms/.envrc +0 -0
  91. data/spec/fixtures/all_pms/Godeps/Godeps.json +0 -0
  92. data/spec/fixtures/all_pms/packages/.keep +0 -0
  93. data/spec/fixtures/composite/Gemfile +0 -0
  94. data/spec/fixtures/composite/nested_project/.envrc +8 -0
  95. data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Godeps.json +16 -0
  96. data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/Godeps/Readme +5 -0
  97. data/spec/fixtures/composite/nested_project/src/github.com/pivotal/foo/foo.go +6 -0
  98. data/spec/fixtures/composite/not_a_project/DONTREADME.md +0 -0
  99. data/spec/fixtures/composite/project1/Gemfile +0 -0
  100. data/spec/fixtures/composite/project2/package.json +0 -0
  101. data/spec/lib/license_finder/cli/approvals_spec.rb +1 -1
  102. data/spec/lib/license_finder/cli/blacklist_spec.rb +58 -0
  103. data/spec/lib/license_finder/cli/dependencies_spec.rb +1 -1
  104. data/spec/lib/license_finder/cli/ignored_dependencies_spec.rb +1 -1
  105. data/spec/lib/license_finder/cli/ignored_groups_spec.rb +1 -1
  106. data/spec/lib/license_finder/cli/licenses_spec.rb +1 -1
  107. data/spec/lib/license_finder/cli/main_spec.rb +113 -7
  108. data/spec/lib/license_finder/cli/project_name_spec.rb +1 -1
  109. data/spec/lib/license_finder/cli/whitelist_spec.rb +1 -1
  110. data/spec/lib/license_finder/configuration_spec.rb +63 -4
  111. data/spec/lib/license_finder/core_spec.rb +49 -0
  112. data/spec/lib/license_finder/decision_applier_spec.rb +101 -1
  113. data/spec/lib/license_finder/decisions_spec.rb +62 -0
  114. data/spec/lib/license_finder/diff_spec.rb +106 -0
  115. data/spec/lib/license_finder/license_aggregator_spec.rb +61 -0
  116. data/spec/lib/license_finder/package_delta_spec.rb +18 -0
  117. data/spec/lib/license_finder/package_managers/bower_spec.rb +8 -6
  118. data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +4 -2
  119. data/spec/lib/license_finder/package_managers/go_dep_spec.rb +72 -0
  120. data/spec/lib/license_finder/package_managers/go_workspace_spec.rb +69 -0
  121. data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +9 -0
  122. data/spec/lib/license_finder/package_managers/gradle_spec.rb +94 -44
  123. data/spec/lib/license_finder/package_managers/maven_spec.rb +8 -6
  124. data/spec/lib/license_finder/package_managers/merged_package_spec.rb +52 -0
  125. data/spec/lib/license_finder/package_managers/npm_spec.rb +59 -20
  126. data/spec/lib/license_finder/package_managers/nuget_spec.rb +82 -0
  127. data/spec/lib/license_finder/package_managers/pip_package_spec.rb +1 -0
  128. data/spec/lib/license_finder/package_managers/rebar_spec.rb +12 -12
  129. data/spec/lib/license_finder/package_spec.rb +59 -2
  130. data/spec/lib/license_finder/project_finder_spec.rb +33 -0
  131. data/spec/lib/license_finder/reports/csv_report_spec.rb +9 -3
  132. data/spec/lib/license_finder/reports/diff_report_spec.rb +56 -0
  133. data/spec/lib/license_finder/reports/merged_report_spec.rb +21 -0
  134. metadata +82 -9
  135. data/.travis/install_virtualenv.sh +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3b754e74ea1f89d22e72c1f145618bafbda14aa
4
- data.tar.gz: f6a5e9c7f1717e5901a746fc6dcac108e565a78c
3
+ metadata.gz: eb78a2e040163c6df7ba630164564c8ec297c339
4
+ data.tar.gz: 3e4cbd76361f6e51dc2295b45fd39a167d87ef5e
5
5
  SHA512:
6
- metadata.gz: 0eb69ee77b1c8734e3d4b1baef6c1dacca50bf267273926c548f5982e69f1080c50b0cb327fe3c655fa5b4cb9ca1de91fb14b06f64acf63d9e70aa1a42ee035f
7
- data.tar.gz: 8a67ab3a162f55da1802a3b551a8a6398f0d2946cc977473052a991331ab3b9f727ee9411c9feec4b8955d09e101df5422eedbd855606886950b53ef1bc9a453
6
+ metadata.gz: cfb282d10162683776abc72912cbf5a14c782037427e89ebe41965257c4e5bd54a336391b3d1dc401db9db8b9a9050951ee1b5313c5bb329879ba321ded91add
7
+ data.tar.gz: c246e54f60cfe30cc2c043b5a744e2980a7329dae589a845ca63f2d20d5be4e29b184cbaf5306cf7cf076975be158b2039c84abe673b1b9356883c6dbc6a4cf7
@@ -12,7 +12,7 @@ matrix:
12
12
  - rvm: jruby-head
13
13
 
14
14
  env:
15
- - PATH=$PATH:$HOME/gradle/bin:$HOME/rebar
15
+ - PATH=$PATH:$HOME/gradle/bin:$HOME/rebar:$HOME/go/bin GOPATH=$HOME/go
16
16
 
17
17
  notifications:
18
18
  email:
@@ -26,7 +26,9 @@ before_install:
26
26
  - .travis/install_gradle.sh
27
27
  - .travis/install_rebar.sh
28
28
  - .travis/install_bower.sh
29
- - .travis/install_virtualenv.sh
29
+ - .travis/install_godep.sh
30
30
 
31
- before_script:
32
- - source ~/Virtualenvs/lf/bin/activate
31
+ script:
32
+ - rake install
33
+ - rake spec
34
+ - rake features
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+ set -e
3
+ set -x
4
+
5
+ mkdir -p ~/go
6
+ go get github.com/tools/godep
@@ -4,7 +4,7 @@ set -x
4
4
 
5
5
  pushd /tmp
6
6
 
7
- wget http://services.gradle.org/distributions/gradle-1.11-all.zip
7
+ wget http://services.gradle.org/distributions/gradle-2.4-all.zip
8
8
  unzip -q gradle*
9
9
  rm gradle*.zip
10
10
  mv gradle* ~/gradle
@@ -2,11 +2,13 @@
2
2
  set -e
3
3
  set -x
4
4
 
5
- pushd /tmp
5
+ pushd ~
6
6
 
7
- wget https://raw.github.com/wiki/rebar/rebar/rebar
8
- mkdir ~/rebar
9
- mv rebar ~/rebar/
10
- chmod u+x ~/rebar/rebar
7
+ git clone --depth 1 git://github.com/rebar/rebar.git
8
+ cd rebar
9
+ ./bootstrap
10
+
11
+ erl -version
12
+ PATH=$HOME/rebar:$PATH rebar --version
11
13
 
12
14
  popd
@@ -1,3 +1,16 @@
1
+ === 2.1.0.rc1 / 2015-11-03
2
+
3
+ * Features
4
+ * Licenses can be blacklisted. Dependencies which only have licenses in the
5
+ blacklist will not be approved, even if someone tries.
6
+ * Initial support for the Nuget package manager for .NET projects
7
+ * Experimental support for `godep` projects
8
+ * Experimental support for "golang workspace" projects (with .envrc)
9
+ * Improved support for multi-module `gradle` projects
10
+ * Gradle 2.x support (experimental)
11
+ * Experimental support for "composite" projects (multiple git submodules)
12
+ * Experimental support for "license diffs" between directories
13
+
1
14
  === 2.0.4 / 2015-04-16
2
15
 
3
16
  * Features
@@ -25,8 +25,22 @@ can be detected in many different ways.
25
25
 
26
26
  ## Adding Reports
27
27
 
28
- If you need `license_finder` to output additional data, consider adding new
29
- columns to `lib/license_finder/reports/csv_report.rb`.
28
+ If you need `license_finder` to output additional package data, consider
29
+ submitting a pull request which adds new columns to
30
+ `lib/license_finder/reports/csv_report.rb`.
31
+
32
+ It is also possible to generate a custom report from an ERB template. Use this
33
+ [example](https://gist.github.com/mainej/b190d2f138c2b9e2e20a) as a starting
34
+ point. These reports will have access to the helpers in
35
+ [`LicenseFinder::ErbReport`](https://github.com/pivotal/LicenseFinder/blob/master/lib/license_finder/reports/erb_report.rb).
36
+
37
+ If you need a report with more detailed data or in a different format, we
38
+ recommend writing a custom ruby script. This
39
+ [example](https://gist.github.com/mainej/48ac616844505d50f510) will get you
40
+ started.
41
+
42
+ If you come up with something useful, consider posting it to the Google Group
43
+ [license-finder@googlegroups.com](license-finder@googlegroups.com).
30
44
 
31
45
 
32
46
  ## Development Dependencies
data/README.md CHANGED
@@ -27,10 +27,26 @@ report.
27
27
  * Java (via `gradle`)
28
28
  * Erlang (via `rebar`)
29
29
  * Objective-C (+ CocoaPods)
30
+ * Nuget (without license discovery)
31
+ * Godep
32
+ * Go workspace (via a `.envrc` file)
30
33
 
31
34
 
32
35
  ## Installation
33
36
 
37
+ License Finder requires Ruby 1.9.3 or greater to run. If you have an older
38
+ version of Ruby installed, you can update via Homebrew:
39
+
40
+ ```sh
41
+ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
42
+ ```
43
+
44
+ then:
45
+
46
+ ```sh
47
+ $ brew install ruby
48
+ ```
49
+
34
50
  The easiest way to use `license_finder` is to install it as a command
35
51
  line tool, like brew, awk, gem or bundler:
36
52
 
@@ -52,7 +68,9 @@ problem, see [Excluding Dependencies](#excluding-dependencies).
52
68
 
53
69
  ## Usage
54
70
 
55
- The first time you run `license_finder` it will output a report of all your project's packages.
71
+ Make sure your dependencies are installed (with your package manager's install command: `bundle install`, `npm install`, etc.)
72
+
73
+ The first time you run `license_finder` it will list all your project's packages.
56
74
 
57
75
  ```sh
58
76
  $ license_finder
@@ -97,6 +115,7 @@ languages, as long as that language has a package definition in the project dire
97
115
  * `bower.json` (for `bower`)
98
116
  * `Podfile` (for CocoaPods)
99
117
  * `rebar.config` (for `rebar`)
118
+ * `packages/` directory (for `Nuget`)
100
119
 
101
120
 
102
121
  ### Continuous Integration
@@ -202,6 +221,9 @@ all of your project's dependencies and includes information about which need to
202
221
  be approved. The project name at the top of the report can be set with
203
222
  `license_finder project_name add`.
204
223
 
224
+ See [CONTRIBUTING.md](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md#adding-reports)
225
+ for advice about adding and customizing reports.
226
+
205
227
 
206
228
  ## Manual Intervention
207
229
 
@@ -244,7 +266,7 @@ $ license_finder dependencies remove my_js_dep
244
266
  Sometimes a project will have development or test dependencies which
245
267
  you don't want to track. You can exclude theses dependencies by running
246
268
  `license_finder ignored_groups`. (Currently this only works for packages
247
- managed by Bundler.)
269
+ managed by Bundler, NPM, and Nuget.)
248
270
 
249
271
  On rare occasions a package manager will report an individual dependency
250
272
  that you want to exclude from all reports, even though it is approved.
@@ -255,6 +277,15 @@ since it is a common dependency whose version changes from machine to
255
277
  machine. Adding it to the `ignored_dependencies` would prevent it
256
278
  (and its oscillating versions) from appearing in reports.
257
279
 
280
+ ### Blacklisting Licenses
281
+
282
+ Some projects will have a list of licenses that cannot be used. You can add
283
+ these licenses to the blacklist `license_finder blacklist add`. Any dependency
284
+ that has exclusively blacklisted licenses will always appear in the action
285
+ items, even if someone attempts to manually approve or whitelist it. However,
286
+ if a dependency has even one license outside of the blacklist, it can still be
287
+ manually approved or whitelisted.
288
+
258
289
 
259
290
  ## Configuration
260
291
 
@@ -291,10 +322,11 @@ rebar_deps_dir: './rebar_deps'
291
322
 
292
323
  ### Gradle Projects
293
324
 
294
- You need to install the license gradle plugin:
325
+ `license_finder` supports both Gradle 1.x and Gradle 2.x. You need to have installed
326
+ the license-gradle-plugin in your project:
295
327
  [https://github.com/hierynomus/license-gradle-plugin](https://github.com/hierynomus/license-gradle-plugin)
296
328
 
297
- By default, `license_finder` will report on gradle's "runtime" dependencies. If
329
+ By default, `license_finder` will report on Gradle's "runtime" dependencies. If
298
330
  you want to generate a report for some other dependency configuration (e.g.
299
331
  Android projects will sometimes specify their meaningful dependencies in the
300
332
  "compile" group), you can specify it in your project's `build.gradle`:
@@ -308,6 +340,11 @@ downloadLicenses {
308
340
  ```
309
341
 
310
342
 
343
+ ### Maven Projects
344
+
345
+ `license_finder` supports Maven.
346
+
347
+
311
348
  ## Requirements
312
349
 
313
350
  `license_finder` requires ruby >= 1.9, or jruby.
data/Rakefile CHANGED
@@ -32,13 +32,19 @@ task :check_dependencies do
32
32
  "pip" => "Pip",
33
33
  "gradle" => "Gradle",
34
34
  "bower" => "Bower",
35
- "rebar" => "Rebar"
35
+ "rebar" => "Rebar",
36
+ "godep" => "Go"
36
37
  }
37
38
  dependencies["pod"] = "Cocoapods" if LicenseFinder::Platform.darwin?
38
39
  satisfied = true
39
40
  dependencies.each do |dependency, description|
40
41
  printf "checking dev dependency for #{description} ... "
41
- `which #{dependency}` ; status = $?
42
+ if LicenseFinder::Platform.windows?
43
+ `where #{dependency} 2>NUL`
44
+ else
45
+ `which #{dependency} 2>/dev/null`
46
+ end
47
+ status = $?
42
48
  if status.success?
43
49
  puts "OK"
44
50
  else
@@ -1,4 +1,4 @@
1
- require 'feature_helper'
1
+ require_relative '../../support/feature_helper'
2
2
 
3
3
  describe "License Finder command line executable" do
4
4
  # As a developer
@@ -7,23 +7,6 @@ describe "License Finder command line executable" do
7
7
 
8
8
  let(:developer) { LicenseFinder::TestingDSL::User.new }
9
9
 
10
- specify "reports unapproved dependencies" do
11
- developer.create_empty_project
12
- developer.execute_command("license_finder dependencies add unapproved_gem Whatever")
13
-
14
- developer.run_license_finder
15
- expect(developer).to be_receiving_exit_code(1)
16
- expect(developer).to be_seeing 'unapproved_gem'
17
- end
18
-
19
- specify "reports that all dependencies are approved" do
20
- developer.create_empty_project
21
-
22
- developer.run_license_finder
23
- expect(developer).to be_receiving_exit_code(0)
24
- expect(developer).to be_seeing 'All dependencies are approved for use'
25
- end
26
-
27
10
  specify "shows usage and subcommand help" do
28
11
  developer.create_empty_project
29
12
 
@@ -40,4 +23,27 @@ describe "License Finder command line executable" do
40
23
  developer.run_license_finder
41
24
  expect(developer).to be_seeing_something_like /license_finder.*MIT/
42
25
  end
26
+
27
+ it "reports dependencies' licenses" do
28
+ developer.create_ruby_app # has license_finder as a dependency, which has thor as a dependency
29
+
30
+ developer.run_license_finder
31
+ expect(developer).to be_seeing_something_like /thor.*MIT/
32
+ end
33
+
34
+ specify "runs default command" do
35
+ developer.create_empty_project
36
+
37
+ developer.run_license_finder
38
+ expect(developer).to be_receiving_exit_code(0)
39
+ expect(developer).to be_seeing 'All dependencies are approved for use'
40
+ end
41
+
42
+ specify "displays an error if project_path does not exist" do
43
+ developer.create_empty_project
44
+
45
+ developer.execute_command('license_finder report --project-path=/path/that/does/not/exist')
46
+ expect(developer).to be_seeing("Project path '/path/that/does/not/exist' does not exist!")
47
+ expect(developer).to be_receiving_exit_code(1)
48
+ end
43
49
  end
@@ -1,4 +1,4 @@
1
- require 'feature_helper'
1
+ require_relative '../../support/feature_helper'
2
2
 
3
3
  describe "Manually Added Dependencies" do
4
4
  # As a developer
@@ -34,4 +34,21 @@ describe "Manually Added Dependencies" do
34
34
  developer.execute_command 'license_finder dependencies list'
35
35
  expect(developer).to_not be_seeing 'manual_dep'
36
36
  end
37
+
38
+ specify "does not report dependencies that are manually removed" do
39
+ developer.create_empty_project
40
+ developer.execute_command("license_finder dependencies add test_gem Random_License 0.0.1")
41
+
42
+ developer.run_license_finder
43
+
44
+ expect(developer).to be_receiving_exit_code(1)
45
+ expect(developer).to be_seeing 'test_gem'
46
+
47
+ developer.execute_command("license_finder dependencies remove test_gem")
48
+
49
+ developer.run_license_finder
50
+
51
+ expect(developer).to be_receiving_exit_code(0)
52
+ expect(developer).not_to be_seeing 'test_gem'
53
+ end
37
54
  end
@@ -1,4 +1,4 @@
1
- require 'feature_helper'
1
+ require_relative '../../support/feature_helper'
2
2
 
3
3
  describe "Manually Approved Dependencies" do
4
4
  # As a developer
@@ -28,4 +28,34 @@ describe "Manually Approved Dependencies" do
28
28
  expect(section).to have_content "We really need this"
29
29
  end
30
30
  end
31
+
32
+ specify "reports unapproved dependencies" do
33
+ developer.create_empty_project
34
+ developer.execute_command("license_finder dependencies add test_gem Random_License 0.0.1")
35
+ developer.execute_command("license_finder approvals add test_gem")
36
+
37
+ developer.run_license_finder
38
+
39
+ expect(developer).to be_receiving_exit_code(0)
40
+ expect(developer).not_to be_seeing 'test_gem'
41
+
42
+ developer.execute_command("license_finder approvals remove test_gem")
43
+
44
+ developer.run_license_finder
45
+
46
+ expect(developer).to be_receiving_exit_code(1)
47
+ expect(developer).to be_seeing 'test_gem'
48
+ end
49
+
50
+ specify "reports only unapproved dependencies, no approved dependencies" do
51
+ developer.create_empty_project
52
+ developer.execute_command("license_finder dependencies add unapproved_gem Random_License 0.0.1")
53
+ developer.execute_command("license_finder dependencies add approved_gem Random_License 0.0.1")
54
+ developer.execute_command("license_finder approvals add approved_gem")
55
+
56
+ developer.run_license_finder
57
+ expect(developer).to be_receiving_exit_code(1)
58
+ expect(developer).to be_seeing 'unapproved_gem'
59
+ expect(developer).not_to be_seeing 'approved_gem '
60
+ end
31
61
  end
@@ -1,4 +1,4 @@
1
- require 'feature_helper'
1
+ require_relative '../../support/feature_helper'
2
2
 
3
3
  describe "Manually Assigned Licenses" do
4
4
  # As a developer
@@ -7,7 +7,7 @@ describe "Manually Assigned Licenses" do
7
7
 
8
8
  let(:developer) { LicenseFinder::TestingDSL::User.new }
9
9
 
10
- specify "are shown in reports" do
10
+ specify "are shown in cli after being added, and default license is not shown" do
11
11
  project = developer.create_ruby_app
12
12
  gem = developer.create_gem 'mislicensed_dep', license: 'Unknown'
13
13
  project.depend_on gem
@@ -17,4 +17,19 @@ describe "Manually Assigned Licenses" do
17
17
  expect(developer).not_to be_seeing_something_like /mislicensed_dep.*Unknown/
18
18
  expect(developer).to be_seeing_something_like /mislicensed_dep.*Known/
19
19
  end
20
- end
20
+
21
+ specify "can be removed, revealing the default license for a dependency" do
22
+ project = developer.create_ruby_app
23
+ gem = developer.create_gem 'mislicensed_dep', license: 'Default'
24
+ project.depend_on gem
25
+ developer.execute_command 'license_finder licenses add mislicensed_dep Manual_license'
26
+
27
+ developer.run_license_finder
28
+ expect(developer).to be_seeing_something_like /mislicensed_dep.*Manual_license/
29
+
30
+ developer.execute_command 'license_finder licenses remove mislicensed_dep Manual_license'
31
+
32
+ developer.run_license_finder
33
+ expect(developer).to be_seeing_something_like /mislicensed_dep.*Default/
34
+ end
35
+ end
@@ -0,0 +1,30 @@
1
+ require_relative '../../support/feature_helper'
2
+
3
+ describe "Blacklisted licenses" do
4
+ # As a lawyer
5
+ # I want to blacklist certain licenses
6
+ # So that any dependencies with only these licenses cannot be approved
7
+
8
+ let(:developer) { LicenseFinder::TestingDSL::User.new }
9
+ let(:lawyer) { LicenseFinder::TestingDSL::User.new }
10
+
11
+ before do
12
+ developer.create_empty_project
13
+ lawyer.execute_command 'license_finder blacklist add BSD'
14
+ developer.execute_command 'license_finder dependencies add blacklisted_dep BSD'
15
+ end
16
+
17
+ specify "prevent packages from being approved" do
18
+ developer.execute_command 'license_finder approval add blacklisted_dep'
19
+
20
+ lawyer.run_license_finder
21
+ expect(lawyer).to be_seeing 'blacklisted_dep'
22
+ end
23
+
24
+ specify "override the whitelist" do
25
+ developer.execute_command 'license_finder whitelist add BSD'
26
+
27
+ lawyer.run_license_finder
28
+ expect(lawyer).to be_seeing 'blacklisted_dep'
29
+ end
30
+ end
@@ -1,4 +1,4 @@
1
- require 'feature_helper'
1
+ require_relative '../../support/feature_helper'
2
2
 
3
3
  describe "Ignored Dependencies" do
4
4
  # As a developer
@@ -1,4 +1,5 @@
1
- require 'feature_helper'
1
+ require_relative '../../support/feature_helper'
2
+ require 'bundler'
2
3
 
3
4
  describe "Ignored Groups" do
4
5
  # As a developer
@@ -17,6 +18,20 @@ describe "Ignored Groups" do
17
18
  expect(developer).to_not be_seeing 'dev_gem'
18
19
  end
19
20
 
21
+ specify "and their dependencies are excluded from reports" do
22
+ project = developer.create_ruby_app
23
+ gem = developer.create_gem 'dev_gem', license: 'GPL', dependencies: 'jwt'
24
+
25
+ # with_clean_env allows jwt to be installed, despite the fact
26
+ # that it isn't one of license_finder's own dependencies
27
+ ::Bundler.with_clean_env do
28
+ project.depend_on gem, groups: ['dev']
29
+ developer.execute_command 'license_finder ignored_group add dev'
30
+ developer.run_license_finder
31
+ expect(developer).to_not be_seeing 'jwt'
32
+ end
33
+ end
34
+
20
35
  specify "appear in the CLI" do
21
36
  developer.create_empty_project
22
37
  developer.execute_command 'license_finder ignored_group add dev'