license_finder 1.2 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/CHANGELOG.rdoc +27 -0
  4. data/CONTRIBUTING.md +38 -0
  5. data/README.md +139 -159
  6. data/Rakefile +17 -13
  7. data/features/features/cli_spec.rb +43 -0
  8. data/features/features/configure/add_dependencies_spec.rb +37 -0
  9. data/features/features/configure/approve_dependencies_spec.rb +30 -0
  10. data/features/features/configure/assign_licenses_spec.rb +20 -0
  11. data/features/features/configure/ignore_dependencies_spec.rb +35 -0
  12. data/features/features/configure/ignore_groups_spec.rb +31 -0
  13. data/features/features/configure/name_project_spec.rb +32 -0
  14. data/features/features/configure/whitelist_licenses_spec.rb +40 -0
  15. data/features/features/package_managers/bower_spec.rb +14 -0
  16. data/features/features/package_managers/cocoapods_spec.rb +14 -0
  17. data/features/features/package_managers/gradle_spec.rb +14 -0
  18. data/features/features/package_managers/maven_spec.rb +14 -0
  19. data/features/features/package_managers/npm_spec.rb +14 -0
  20. data/features/features/package_managers/pip_spec.rb +14 -0
  21. data/features/features/report/csv_spec.rb +17 -0
  22. data/features/features/report/html_spec.rb +50 -0
  23. data/{spec → features}/fixtures/Podfile +0 -0
  24. data/{spec → features}/fixtures/build.gradle +0 -0
  25. data/{spec → features}/fixtures/pom.xml +0 -0
  26. data/features/support/testing_dsl.rb +295 -0
  27. data/lib/license_finder.rb +16 -50
  28. data/lib/license_finder/cli.rb +13 -253
  29. data/lib/license_finder/cli/approvals.rb +26 -0
  30. data/lib/license_finder/cli/base.rb +20 -0
  31. data/lib/license_finder/cli/dependencies.rb +39 -0
  32. data/lib/license_finder/cli/ignored_dependencies.rb +30 -0
  33. data/lib/license_finder/cli/ignored_groups.rb +30 -0
  34. data/lib/license_finder/cli/licenses.rb +24 -0
  35. data/lib/license_finder/cli/main.rb +82 -0
  36. data/lib/license_finder/cli/makes_decisions.rb +48 -0
  37. data/lib/license_finder/cli/patched_thor.rb +34 -0
  38. data/lib/license_finder/cli/project_name.rb +31 -0
  39. data/lib/license_finder/cli/whitelist.rb +32 -0
  40. data/lib/license_finder/configuration.rb +14 -145
  41. data/lib/license_finder/decision_applier.rb +46 -0
  42. data/lib/license_finder/decisions.rb +174 -0
  43. data/lib/license_finder/license.rb +13 -32
  44. data/lib/license_finder/license/definitions.rb +15 -13
  45. data/lib/license_finder/license/template.rb +1 -1
  46. data/lib/{data/licenses → license_finder/license/templates}/Apache2.txt +0 -0
  47. data/lib/{data/licenses → license_finder/license/templates}/BSD.txt +0 -0
  48. data/lib/{data/licenses → license_finder/license/templates}/GPLv2.txt +0 -0
  49. data/lib/{data/licenses → license_finder/license/templates}/ISC.txt +0 -0
  50. data/lib/{data/licenses → license_finder/license/templates}/LGPL.txt +0 -0
  51. data/lib/{data/licenses → license_finder/license/templates}/MIT.txt +0 -0
  52. data/lib/{data/licenses → license_finder/license/templates}/NewBSD.txt +0 -0
  53. data/lib/{data/licenses → license_finder/license/templates}/Python.txt +0 -0
  54. data/lib/{data/licenses → license_finder/license/templates}/Ruby.txt +0 -0
  55. data/lib/{data/licenses → license_finder/license/templates}/SimplifiedBSD.txt +0 -0
  56. data/lib/license_finder/package.rb +77 -7
  57. data/lib/license_finder/package_manager.rb +43 -0
  58. data/lib/license_finder/package_managers/bower.rb +1 -1
  59. data/lib/license_finder/package_managers/bower_package.rb +23 -44
  60. data/lib/license_finder/package_managers/bundler.rb +4 -7
  61. data/lib/license_finder/package_managers/bundler_package.rb +14 -31
  62. data/lib/license_finder/package_managers/cocoa_pods.rb +1 -1
  63. data/lib/license_finder/package_managers/cocoa_pods_package.rb +2 -10
  64. data/lib/license_finder/package_managers/gradle.rb +6 -2
  65. data/lib/license_finder/package_managers/gradle_package.rb +6 -30
  66. data/lib/license_finder/package_managers/manual_package.rb +25 -0
  67. data/lib/license_finder/package_managers/maven_package.rb +8 -37
  68. data/lib/license_finder/package_managers/npm.rb +16 -4
  69. data/lib/license_finder/package_managers/npm_package.rb +12 -43
  70. data/lib/license_finder/package_managers/pip_package.rb +17 -37
  71. data/lib/license_finder/platform.rb +0 -16
  72. data/lib/license_finder/possible_license_file.rb +9 -14
  73. data/lib/license_finder/possible_license_files.rb +1 -5
  74. data/lib/license_finder/report.rb +26 -0
  75. data/lib/license_finder/reports/csv_report.rb +58 -0
  76. data/lib/license_finder/reports/erb_report.rb +61 -0
  77. data/lib/license_finder/reports/html_report.rb +10 -1
  78. data/lib/license_finder/reports/markdown_report.rb +7 -1
  79. data/lib/license_finder/reports/templates/bootstrap.css +9 -0
  80. data/lib/license_finder/reports/templates/html_report.erb +105 -0
  81. data/lib/{templates → license_finder/reports/templates}/markdown_report.erb +7 -7
  82. data/lib/license_finder/reports/text_report.rb +5 -3
  83. data/lib/license_finder/version.rb +3 -0
  84. data/license_finder.gemspec +2 -6
  85. data/release/instructions.md +8 -0
  86. data/spec/feature_helper.rb +11 -0
  87. data/spec/fixtures/config/license_finder.yml +3 -0
  88. data/spec/fixtures/{nested_readme/vendor/README → license_directory/LICENSE/Apache.txt} +0 -0
  89. data/spec/lib/license_finder/cli/approvals_spec.rb +63 -0
  90. data/spec/lib/license_finder/cli/dependencies_spec.rb +59 -0
  91. data/spec/lib/license_finder/cli/ignored_dependencies_spec.rb +47 -0
  92. data/spec/lib/license_finder/cli/ignored_groups_spec.rb +40 -0
  93. data/spec/lib/license_finder/cli/licenses_spec.rb +60 -0
  94. data/spec/lib/license_finder/cli/main_spec.rb +110 -0
  95. data/spec/lib/license_finder/cli/project_name_spec.rb +40 -0
  96. data/spec/lib/license_finder/cli/whitelist_spec.rb +58 -0
  97. data/spec/lib/license_finder/configuration_spec.rb +46 -191
  98. data/spec/lib/license_finder/decision_applier_spec.rb +65 -0
  99. data/spec/lib/license_finder/decisions_spec.rb +347 -0
  100. data/spec/lib/license_finder/license/definitions_spec.rb +1 -7
  101. data/spec/lib/license_finder/license_spec.rb +2 -30
  102. data/spec/lib/license_finder/package_manager_spec.rb +22 -0
  103. data/spec/lib/license_finder/package_managers/bower_package_spec.rb +33 -66
  104. data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +7 -71
  105. data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +8 -11
  106. data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +28 -32
  107. data/spec/lib/license_finder/package_managers/gradle_spec.rb +18 -23
  108. data/spec/lib/license_finder/package_managers/maven_package_spec.rb +20 -43
  109. data/spec/lib/license_finder/package_managers/npm_package_spec.rb +22 -73
  110. data/spec/lib/license_finder/package_managers/npm_spec.rb +18 -21
  111. data/spec/lib/license_finder/package_managers/pip_package_spec.rb +24 -63
  112. data/spec/lib/license_finder/package_spec.rb +121 -0
  113. data/spec/lib/license_finder/possible_license_file_spec.rb +2 -3
  114. data/spec/lib/license_finder/possible_license_files_spec.rb +18 -22
  115. data/spec/lib/license_finder/reports/csv_report_spec.rb +26 -0
  116. data/spec/lib/license_finder/reports/html_report_spec.rb +39 -22
  117. data/spec/lib/license_finder/reports/markdown_report_spec.rb +8 -16
  118. data/spec/lib/license_finder/reports/text_report_spec.rb +21 -12
  119. data/spec/spec_helper.rb +1 -4
  120. data/spec/support/shared_examples_for_package.rb +0 -11
  121. data/spec/support/shared_examples_for_package_manager.rb +1 -0
  122. data/spec/support/stdout_helpers.rb +4 -11
  123. metadata +73 -158
  124. data/db/migrate/201303290935_create_dependencies.rb +0 -14
  125. data/db/migrate/201303291155_create_licenses.rb +0 -13
  126. data/db/migrate/201303291402_create_approvals.rb +0 -13
  127. data/db/migrate/201303291456_create_ancestries.rb +0 -9
  128. data/db/migrate/201303291519_create_bundler_groups.rb +0 -13
  129. data/db/migrate/201303291720_move_manual_from_approvals_to_licenses.rb +0 -11
  130. data/db/migrate/201303291753_allow_null_license_names.rb +0 -7
  131. data/db/migrate/201304011027_allow_null_dependency_version.rb +0 -7
  132. data/db/migrate/201304020947_change_table_name_licenses_to_license_aliases.rb +0 -5
  133. data/db/migrate/201304181524_add_manual_to_dependencies.rb +0 -7
  134. data/db/migrate/201307250917_add_license_manual_to_dependencies.rb +0 -7
  135. data/db/migrate/201307251004_data_fix_manual_licenses.rb +0 -15
  136. data/db/migrate/201307251107_reassociate_license.rb +0 -23
  137. data/db/migrate/201307251340_remove_manual_from_license_aliases.rb +0 -7
  138. data/db/migrate/201311192002_add_manually_approved_to_dependencies.rb +0 -7
  139. data/db/migrate/201311192003_reassociate_manual_approval.rb +0 -13
  140. data/db/migrate/201311192010_drop_approvals.rb +0 -5
  141. data/db/migrate/201401302113_re_reassociate_license.rb +0 -23
  142. data/db/migrate/201403181732_rename_manual_fields.rb +0 -10
  143. data/db/migrate/201403190028_add_manual_approvals.rb +0 -22
  144. data/db/migrate/201403191419_add_timestamps_to_manual_approvals.rb +0 -15
  145. data/db/migrate/201403191645_remove_license_aliases.rb +0 -23
  146. data/db/migrate/201410031451_rename_dependency_license_name.rb +0 -6
  147. data/features/cli.feature +0 -37
  148. data/features/cocoapods_dependencies.feature +0 -10
  149. data/features/configure_bundler_groups.feature +0 -23
  150. data/features/configure_ignore_dependencies.feature +0 -16
  151. data/features/configure_project_name.feature +0 -10
  152. data/features/configure_whitelist.feature +0 -27
  153. data/features/gradle_dependencies.feature +0 -9
  154. data/features/manually_added.feature +0 -19
  155. data/features/manually_approved.feature +0 -10
  156. data/features/manually_assigned_license.feature +0 -16
  157. data/features/maven_dependencies.feature +0 -9
  158. data/features/multiple_licenses.feature +0 -9
  159. data/features/node_dependencies.feature +0 -9
  160. data/features/python_dependencies.feature +0 -9
  161. data/features/report_csv.feature +0 -15
  162. data/features/report_html.feature +0 -24
  163. data/features/step_definitions/cli_steps.rb +0 -51
  164. data/features/step_definitions/cocoapod_steps.rb +0 -8
  165. data/features/step_definitions/configure_bundler_groups_steps.rb +0 -30
  166. data/features/step_definitions/configure_ignore_dependencies.rb +0 -35
  167. data/features/step_definitions/configure_project_name_steps.rb +0 -3
  168. data/features/step_definitions/configure_whitelist_steps.rb +0 -45
  169. data/features/step_definitions/gradle_steps.rb +0 -8
  170. data/features/step_definitions/manually_added_steps.rb +0 -28
  171. data/features/step_definitions/manually_approved_steps.rb +0 -24
  172. data/features/step_definitions/manually_assigned_license_steps.rb +0 -34
  173. data/features/step_definitions/maven_steps.rb +0 -8
  174. data/features/step_definitions/multiple_licenses_steps.rb +0 -14
  175. data/features/step_definitions/node_steps.rb +0 -8
  176. data/features/step_definitions/python_steps.rb +0 -8
  177. data/features/step_definitions/report_csv_steps.rb +0 -20
  178. data/features/step_definitions/report_html_steps.rb +0 -60
  179. data/features/step_definitions/shared_steps.rb +0 -307
  180. data/lib/data/license_finder.example.yml +0 -12
  181. data/lib/license_finder/dependency_manager.rb +0 -92
  182. data/lib/license_finder/package_saver.rb +0 -44
  183. data/lib/license_finder/reports/dependency_report.rb +0 -34
  184. data/lib/license_finder/reports/detailed_text_report.rb +0 -19
  185. data/lib/license_finder/reports/formatted_report.rb +0 -40
  186. data/lib/license_finder/reports/reporter.rb +0 -27
  187. data/lib/license_finder/tables.rb +0 -9
  188. data/lib/license_finder/tables/bundler_group.rb +0 -7
  189. data/lib/license_finder/tables/dependency.rb +0 -113
  190. data/lib/license_finder/tables/manual_approval.rb +0 -13
  191. data/lib/license_finder/yml_to_sql.rb +0 -117
  192. data/lib/templates/html_report.erb +0 -117
  193. data/lib/templates/text_report.erb +0 -3
  194. data/release/gem_version.rb +0 -3
  195. data/release/manual_instructions.md +0 -29
  196. data/release/publish.sh +0 -32
  197. data/spec/fixtures/APACHE-2-LICENSE +0 -202
  198. data/spec/fixtures/GPLv2 +0 -339
  199. data/spec/fixtures/ISC-LICENSE +0 -10
  200. data/spec/fixtures/MIT-LICENSE +0 -22
  201. data/spec/fixtures/MIT-LICENSE-with-varied-disclaimer +0 -22
  202. data/spec/fixtures/README-with-MIT-LICENSE +0 -222
  203. data/spec/fixtures/license_directory/LICENSE/BSD-2-Clause.txt +0 -25
  204. data/spec/fixtures/license_directory/LICENSE/GPL-2.0.txt +0 -339
  205. data/spec/fixtures/license_directory/LICENSE/LICENSE +0 -191
  206. data/spec/fixtures/license_directory/LICENSE/MIT.txt +0 -21
  207. data/spec/fixtures/license_directory/LICENSE/RUBY.txt +0 -60
  208. data/spec/fixtures/mit_licensed_gem/LICENSE +0 -22
  209. data/spec/fixtures/other_licensed_gem/LICENSE +0 -3
  210. data/spec/fixtures/readme/Project ReadMe b/data/spec/fixtures/readme/Project → ReadMe +0 -0
  211. data/spec/fixtures/readme/README +0 -0
  212. data/spec/fixtures/readme/Readme.markdown +0 -0
  213. data/spec/lib/license_finder/cli_spec.rb +0 -298
  214. data/spec/lib/license_finder/dependency_manager_spec.rb +0 -198
  215. data/spec/lib/license_finder/package_saver_spec.rb +0 -82
  216. data/spec/lib/license_finder/reports/detailed_text_report_spec.rb +0 -33
  217. data/spec/lib/license_finder/reports/reporter_spec.rb +0 -33
  218. data/spec/lib/license_finder/tables/dependency_spec.rb +0 -196
  219. data/spec/lib/license_finder/yml_to_sql_spec.rb +0 -123
  220. data/spec/lib/license_finder_spec.rb +0 -16
data/Rakefile CHANGED
@@ -3,31 +3,35 @@ Bundler::GemHelper.install_tasks
3
3
 
4
4
  require './lib/license_finder/platform'
5
5
  require 'rspec/core/rake_task'
6
- require 'cucumber'
7
- require 'cucumber/rake/task'
8
6
 
9
7
  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]
8
+ task :spec do
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ t.fail_on_error = true
11
+ t.pattern = "./spec/**/*_spec.rb"
12
+ t.rspec_opts = %w[--color]
13
+ end
14
14
  end
15
15
 
16
- desc "Run all cukes in features/"
17
- Cucumber::Rake::Task.new(:features) do |t|
18
- tags = LicenseFinder::Platform.darwin? ? "" : "--tags ~@ios"
19
- t.cucumber_opts = "features --format pretty #{tags}"
16
+ desc "Run all specs in features/"
17
+ task :features do
18
+ RSpec::Core::RakeTask.new(:features) do |t|
19
+ t.fail_on_error = true
20
+ t.pattern = "./features/**/*_spec.rb"
21
+ opts = %w[--color --format d]
22
+ opts += LicenseFinder::Platform.darwin? ? [] : %w[--tag ~ios]
23
+ t.rspec_opts = opts
24
+ end
20
25
  end
21
26
 
22
27
  desc "Check for non-Ruby development dependencies."
23
28
  task :check_dependencies do
24
- require "open3"
25
-
26
29
  dependencies = {
27
30
  "mvn" => "Maven",
28
31
  "npm" => "node.js",
29
32
  "pip" => "Python",
30
- "gradle" => "Gradle"
33
+ "gradle" => "Gradle",
34
+ "bower" => "Bower"
31
35
  }
32
36
  dependencies["pod"] = "Cocoapods" if LicenseFinder::Platform.darwin?
33
37
  satisfied = true
@@ -0,0 +1,43 @@
1
+ require 'feature_helper'
2
+
3
+ describe "License Finder command line executable" do
4
+ # As a developer
5
+ # I want a command-line interface
6
+ # So that I can manage my application's dependencies and licenses
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ specify "reports unapproved dependencies" do
11
+ user.create_empty_project
12
+ user.execute_command("license_finder dependencies add unapproved_gem Whatever")
13
+
14
+ user.run_license_finder
15
+ expect(user).to be_receiving_exit_code(1)
16
+ expect(user).to be_seeing 'unapproved_gem'
17
+ end
18
+
19
+ specify "reports that all dependencies are approved" do
20
+ user.create_empty_project
21
+
22
+ user.run_license_finder
23
+ expect(user).to be_receiving_exit_code(0)
24
+ expect(user).to be_seeing 'All dependencies are approved for use'
25
+ end
26
+
27
+ specify "shows usage and subcommand help" do
28
+ user.create_empty_project
29
+
30
+ user.execute_command "license_finder help"
31
+ expect(user).to be_seeing 'license_finder help [COMMAND]'
32
+
33
+ user.execute_command "license_finder ignored_groups help add"
34
+ expect(user).to be_seeing 'license_finder ignored_groups add GROUP'
35
+ end
36
+
37
+ it "reports `license_finder`'s license is MIT" do
38
+ user.create_ruby_app # has license_finder as a dependency
39
+
40
+ user.run_license_finder
41
+ expect(user).to be_seeing_something_like /license_finder.*MIT/
42
+ end
43
+ end
@@ -0,0 +1,37 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Manually Added Dependencies" do
4
+ # As a developer
5
+ # I want to be able to manually add dependencies
6
+ # So that I can track dependencies not managed by Bundler, NPM, etc.
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ before { user.create_empty_project }
11
+
12
+ specify "appear in reports" do
13
+ user.execute_command 'license_finder dependencies add manual_dep MIT 1.2.3'
14
+
15
+ user.run_license_finder
16
+ expect(user).to be_seeing 'manual_dep, 1.2.3, MIT'
17
+ end
18
+
19
+ specify "can be simultaneously approved" do
20
+ user.execute_command 'license_finder dependencies add --approve manual Whatever'
21
+
22
+ user.run_license_finder
23
+ expect(user).not_to be_seeing 'manual_dep'
24
+ end
25
+
26
+ specify "appear in the CLI" do
27
+ user.execute_command 'license_finder dependencies add manual_dep Whatever'
28
+ expect(user).to be_seeing 'manual_dep'
29
+
30
+ user.execute_command 'license_finder dependencies list'
31
+ expect(user).to be_seeing 'manual_dep'
32
+
33
+ user.execute_command 'license_finder dependencies remove manual_dep'
34
+ user.execute_command 'license_finder dependencies list'
35
+ expect(user).to_not be_seeing 'manual_dep'
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Manually Approved Dependencies" do
4
+ # As a developer
5
+ # I want to approve dependencies that do not have whitelisted licenses
6
+ # So that I can track the dependencies which my business has approved
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ before do
11
+ user.create_empty_project
12
+ user.execute_command 'license_finder dependencies add manual_dep MIT 1.2.3'
13
+ user.execute_command "license_finder approval add manual_dep --who 'Julian' --why 'We really need this'"
14
+ end
15
+
16
+ specify "do not appear in action items" do
17
+ user.run_license_finder
18
+ expect(user).to_not be_seeing "manual_dep"
19
+ end
20
+
21
+ specify "include approval detail in reports" do
22
+ html = user.view_html
23
+ expect(html).to be_approved 'manual_dep'
24
+
25
+ html.in_dep("manual_dep") do |section|
26
+ expect(section).to have_content "Julian"
27
+ expect(section).to have_content "We really need this"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Manually Assigned Licenses" do
4
+ # As a developer
5
+ # I want to be able to override the licenses license_finder finds
6
+ # So that my dependencies all have the correct licenses
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ specify "are shown in reports" do
11
+ project = user.create_ruby_app
12
+ gem = user.create_gem 'mislicensed_dep', license: 'Unknown'
13
+ project.depend_on gem
14
+ user.execute_command 'license_finder licenses add mislicensed_dep Known'
15
+
16
+ user.run_license_finder
17
+ expect(user).not_to be_seeing_something_like /mislicensed_dep.*Unknown/
18
+ expect(user).to be_seeing_something_like /mislicensed_dep.*Known/
19
+ end
20
+ end
@@ -0,0 +1,35 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Ignored Dependencies" do
4
+ # As a developer
5
+ # I want to ignore certain dependencies
6
+ # To avoid frequently changing reports about dependencies I know will always be approved
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ before do
11
+ user.create_empty_project
12
+ user.execute_command 'license_finder dependencies add ignored_dep Whatever'
13
+ end
14
+
15
+ specify "are excluded from reports" do
16
+ user.execute_command 'license_finder ignored_dependencies add ignored_dep'
17
+
18
+ user.run_license_finder
19
+ expect(user).to_not be_seeing 'ignored_dep'
20
+ user.execute_command('license_finder report')
21
+ expect(user).to_not be_seeing 'ignored_dep'
22
+ end
23
+
24
+ specify "appear in the CLI" do
25
+ user.execute_command 'license_finder ignored_dependencies add ignored_dep'
26
+ expect(user).to be_seeing 'ignored_dep'
27
+
28
+ user.execute_command 'license_finder ignored_dependencies list'
29
+ expect(user).to be_seeing 'ignored_dep'
30
+
31
+ user.execute_command 'license_finder ignored_dependencies remove ignored_dep'
32
+ user.execute_command 'license_finder ignored_dependencies list'
33
+ expect(user).to_not be_seeing 'ignored_dep'
34
+ end
35
+ end
@@ -0,0 +1,31 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Ignored Groups" do
4
+ # As a developer
5
+ # I want to ignore certain groups
6
+ # So that any gems I use in development, or for testing, are automatically approved for use
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ specify "are excluded from reports" do
11
+ project = user.create_ruby_app
12
+ gem = user.create_gem 'dev_gem', license: 'GPL'
13
+ project.depend_on gem, groups: ['dev']
14
+ user.execute_command 'license_finder ignored_group add dev'
15
+
16
+ user.run_license_finder
17
+ expect(user).to_not be_seeing 'dev_gem'
18
+ end
19
+
20
+ specify "appear in the CLI" do
21
+ user.create_empty_project
22
+ user.execute_command 'license_finder ignored_group add dev'
23
+ expect(user).to be_seeing 'dev'
24
+ user.execute_command 'license_finder ignored_group list'
25
+ expect(user).to be_seeing 'dev'
26
+
27
+ user.execute_command 'license_finder ignored_group remove dev'
28
+ user.execute_command 'license_finder ignored_group list'
29
+ expect(user).to_not be_seeing 'dev'
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Project name" do
4
+ # As a developer
5
+ # I want to assign a name for my project
6
+ # So that the reports show it
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ before { user.create_empty_project }
11
+
12
+ specify "appears in the HTML report" do
13
+ user.execute_command 'license_finder project_name add changed_name'
14
+
15
+ expect(user.view_html).to be_titled 'changed_name'
16
+ end
17
+
18
+ specify "defaults to the directory name" do
19
+ expect(user.view_html).to be_titled 'my_app'
20
+ end
21
+
22
+ specify "appears in the CLI" do
23
+ user.execute_command 'license_finder project_name add my_proj'
24
+ expect(user).to be_seeing 'my_proj'
25
+ user.execute_command 'license_finder project_name show'
26
+ expect(user).to be_seeing 'my_proj'
27
+
28
+ user.execute_command 'license_finder project_name remove'
29
+ user.execute_command 'license_finder project_name show'
30
+ expect(user).to_not be_seeing 'my_proj'
31
+ end
32
+ end
@@ -0,0 +1,40 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Whitelisted licenses" do
4
+ # As a developer
5
+ # I want to whitelist certain OSS licenses that my business has pre-approved
6
+ # So that any dependencies with those licenses do not show up as action items
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ before { user.create_empty_project }
11
+
12
+ specify "approve dependencies with those licenses" do
13
+ user.execute_command 'license_finder dependencies add bsd_gem BSD'
14
+ user.execute_command 'license_finder whitelist add BSD'
15
+
16
+ user.run_license_finder
17
+ expect(user).to_not be_seeing 'bsd_gem'
18
+ end
19
+
20
+ specify "approve dependencies with any of those licenses" do
21
+ user.execute_command 'license_finder dependencies add dep_with_many_licenses GPL'
22
+ user.execute_command 'license_finder licenses add dep_with_many_licenses MIT'
23
+ user.execute_command 'license_finder whitelist add GPL'
24
+
25
+ user.run_license_finder
26
+ expect(user).not_to be_seeing 'dep_with_many_licenses'
27
+ end
28
+
29
+ specify "are shown in the CLI" do
30
+ user.execute_command 'license_finder whitelist add Expat'
31
+ expect(user).to be_seeing 'Expat'
32
+ user.execute_command 'license_finder whitelist list'
33
+ expect(user).to be_seeing 'MIT'
34
+
35
+ user.execute_command 'license_finder whitelist remove Expat'
36
+ expect(user).to be_seeing 'Expat'
37
+ user.execute_command 'license_finder whitelist list'
38
+ expect(user).to_not be_seeing 'MIT'
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Bower Dependencies" do
4
+ # As a JS developer
5
+ # I want to be able to manage Bower dependencies
6
+
7
+ let(:user) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::BowerProject.create
11
+ user.run_license_finder
12
+ expect(user).to be_seeing_line "gmaps, 0.2.30, MIT"
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "CocoaPods Dependencies", ios: true do
4
+ # As a Mac developer
5
+ # I want to be able to manage CocoaPods dependencies
6
+
7
+ let(:user) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::CocoaPodsProject.create
11
+ user.run_license_finder
12
+ expect(user).to be_seeing_line "ABTest, 0.0.5, MIT"
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Gradle Dependencies" do
4
+ # As a Java developer
5
+ # I want to be able to manage Gradle dependencies
6
+
7
+ let(:user) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::GradleProject.create
11
+ user.run_license_finder
12
+ expect(user).to be_seeing_line 'junit, 4.11, "Common Public License Version 1.0"'
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Maven Dependencies" do
4
+ # As a Java developer
5
+ # I want to be able to manage Maven dependencies
6
+
7
+ let(:user) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::MavenProject.create
11
+ user.run_license_finder
12
+ expect(user).to be_seeing_line 'junit, 4.11, "Common Public License Version 1.0"'
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "NPM Dependencies" do
4
+ # As a Node developer
5
+ # I want to be able to manage NPM dependencies
6
+
7
+ let(:user) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::NpmProject.create
11
+ user.run_license_finder
12
+ expect(user).to be_seeing_line "http-server, 0.6.1, MIT"
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Pip Dependencies" do
4
+ # As a Python developer
5
+ # I want to be able to manage Pip dependencies
6
+
7
+ let(:user) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::PipProject.create
11
+ user.run_license_finder
12
+ expect(user).to be_seeing_line 'argparse, 1.2.1, "Python Software Foundation License"'
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ require 'feature_helper'
2
+
3
+ describe "CSV report" do
4
+ # As a non-technical application product owner
5
+ # I want license finder to generate an easy-to-understand text report
6
+ # So that I can quickly review my application dependencies and licenses
7
+
8
+ let(:user) { LicenseFinder::TestingDSL::User.new }
9
+
10
+ specify "shows dependency data in CSV form" do
11
+ user.create_empty_project
12
+ user.execute_command 'license_finder dependencies add info_gem BSD 1.1.1'
13
+
14
+ user.execute_command('license_finder report --format csv --columns approved name version licenses')
15
+ expect(user).to be_seeing "Not approved,info_gem,1.1.1,BSD"
16
+ end
17
+ end