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
@@ -1,9 +0,0 @@
1
- Feature: Tracking Maven Dependencies
2
- So that I can track Maven dependencies
3
- As an application developer using license finder
4
- I want to be able to manage Maven dependencies
5
-
6
- Scenario: See the dependencies from the pom file
7
- Given A pom file with dependencies
8
- When I run license_finder
9
- Then I should see a Maven dependency with a license
@@ -1,9 +0,0 @@
1
- Feature: Dependencies with multiple licenses
2
- As a developer
3
- I want multi-licensed dependencies to be approved if one license is whitelisted
4
- So that any dependencies with those licenses do not show up as action items
5
-
6
- Scenario: Depending on whitelisted licenses
7
- Given I have an app that depends on BSD and GPL-2 licenses
8
- When I whitelist the GPL-2 license
9
- Then I should not see a BSD and GPL-2 licensed gem unapproved
@@ -1,9 +0,0 @@
1
- Feature: Tracking Node Dependencies
2
- So that I can track Node dependencies
3
- As an application developer using license finder
4
- I want to be able to manage Node dependencies
5
-
6
- Scenario: See the dependencies from the package file
7
- Given A package file with dependencies
8
- When I run license_finder
9
- Then I should see a Node dependency with a license
@@ -1,9 +0,0 @@
1
- Feature: Tracking Python Dependencies
2
- So that I can track Python dependencies
3
- As an application developer using license finder
4
- I want to be able to manage Python dependencies
5
-
6
- Scenario: See the dependencies from the requirements file
7
- Given A requirements file with dependencies
8
- When I run license_finder
9
- Then I should see a Python dependency with a license
@@ -1,15 +0,0 @@
1
- Feature: Text Report
2
- So that I can easily view a report outlining my application dependencies and licenses
3
- As a non-technical application product owner
4
- I want license finder to generate an easy-to-understand text report
5
-
6
- Scenario: Viewing dependencies
7
- Given I have an app that depends on a gem with license and version details
8
- When I run license_finder
9
- Then I should see those version and license details in the dependencies.csv file
10
-
11
- Scenario: Cleaning up old versions of text report
12
- Given I have an app
13
- And I have a dependencies.txt file
14
- When I run license_finder
15
- Then I should see dependencies.txt replaced by dependencies.csv
@@ -1,24 +0,0 @@
1
- Feature: HTML Report
2
- So that I can easily view a report outlining my application dependencies and licenses
3
- As a non-technical application product owner
4
- I want license finder to generate an easy-to-understand HTML report
5
-
6
- Background:
7
- Given I have an app
8
-
9
- Scenario: Dependency details listed in HTML report
10
- And my app depends on a gem with specific details
11
- When I run license_finder
12
- Then I should see the project name my_app in the html
13
- And I should see my specific gem details listed in the html
14
-
15
- Scenario: Approval status of dependencies indicated in HTML report
16
- And my app depends on MIT and GPL licensed gems
17
- When I whitelist the MIT license
18
- Then I should see the GPL gem unapproved in html
19
- And the MIT gem approved in html
20
-
21
- Scenario: Dependency summary
22
- And my app depends on MIT and GPL licensed gems
23
- When I whitelist everything I can think of
24
- Then I should see only see GPL liceneses as unapproved in the html
@@ -1,51 +0,0 @@
1
- Given(/^I have an app that has no config directory$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- path = @user.config_path
5
- path.rmtree if path.exist?
6
- expect(path).to_not be_exist
7
- end
8
-
9
- Given(/^I have an app with an unapproved dependency$/) do
10
- @user = ::DSL::User.new
11
- @user.create_ruby_app
12
- @user.create_and_depend_on_gem 'unapproved_gem', license: 'MIT'
13
- end
14
-
15
- When(/^I run license_finder help on a specific command$/) do
16
- @user.execute_command "license_finder ignored_bundler_groups help add"
17
- end
18
-
19
- When(/^I run license_finder help$/) do
20
- @user.execute_command "license_finder help"
21
- end
22
-
23
- Then(/^it creates a config directory with the license_finder config$/) do
24
- expect(@user.config_path).to be_exist
25
- text = %|---\nwhitelist:\n#- MIT\n#- Apache 2.0\nignore_groups:\n#- test\n#- development\nignore_dependencies:\n#- bundler\ndependencies_file_dir: './doc/'\nproject_name: # project name\ngradle_command: # only meaningful if used with a Java/gradle project. Defaults to "gradle".\n|
26
- expect(@user.config_file.read).to eq(text.gsub(/^\s+/, ""))
27
- end
28
-
29
- Then /^it should exit with status code (\d)$/ do |status|
30
- expect($last_command_exit_status.exitstatus).to eq(status.to_i)
31
- end
32
-
33
- Then(/^should list my unapproved dependency in the output$/) do
34
- expect(@user).to be_seeing 'unapproved_gem'
35
- end
36
-
37
- Then(/^I should see all dependencies approved for use$/) do
38
- expect(@user).to be_seeing 'All dependencies are approved for use'
39
- end
40
-
41
- Then(/^I should see the correct subcommand usage instructions$/) do
42
- expect(@user).to be_seeing 'license_finder ignored_bundler_groups add GROUP'
43
- end
44
-
45
- Then(/^I should see the default usage instructions$/) do
46
- expect(@user).to be_seeing 'license_finder help [COMMAND]'
47
- end
48
-
49
- Then(/^I should see License Finder has the MIT license$/) do
50
- expect(@user).to be_seeing_something_like /license_finder.*MIT/
51
- end
@@ -1,8 +0,0 @@
1
- Given(/^A Podfile with dependencies$/) do
2
- @user = ::DSL::User.new
3
- @user.create_cocoapods_app
4
- end
5
-
6
- Then(/^I should see a CocoaPods dependency with a license$/) do
7
- expect(@user).to be_seeing_line "ABTest, 0.0.5, MIT"
8
- end
@@ -1,30 +0,0 @@
1
- Given(/^I have an app that depends on a gem in the test bundler group$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_gem 'gpl_gem', license: 'GPL'
5
- @user.depend_on_local_gem 'gpl_gem', groups: ['test']
6
- end
7
-
8
- When(/^I ignore the test group$/) do
9
- @user.execute_command('license_finder ignored_bundler_group add test')
10
- end
11
-
12
- When(/^I stop ignoring the test group$/) do
13
- @user.execute_command('license_finder ignored_bundler_group remove test')
14
- end
15
-
16
- When(/^I get the ignored groups$/) do
17
- @user.execute_command('license_finder ignored_bundler_group list')
18
- end
19
-
20
- Then(/^I should not see the test gem in the output$/) do
21
- expect(@user).to_not be_seeing 'gpl_gem'
22
- end
23
-
24
- Then(/^I should see the test group in the output$/) do
25
- expect(@user).to be_seeing 'test'
26
- end
27
-
28
- Then(/^I should not see the test group in the output$/) do
29
- expect(@user).to_not be_seeing 'test'
30
- end
@@ -1,35 +0,0 @@
1
- Given(/^I have an app that depends on bundler$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_gem 'bundler_faker', license: 'Whatever'
5
- @user.depend_on_local_gem 'bundler_faker', groups: ['test', 'development', 'production']
6
- @user.create_gem 'gpl_gem', license: 'GPL'
7
- @user.depend_on_local_gem 'gpl_gem', groups: ['test']
8
- end
9
-
10
- Given(/^I ignore the bundler dependency$/) do
11
- @user.execute_command('license_finder ignored_dependencies add bundler_faker')
12
- end
13
-
14
- When(/^I get the ignored dependencies$/) do
15
- @user.execute_command('license_finder ignored_dependencies list')
16
- end
17
-
18
- Then(/^I should see 'bundler' in the output$/) do
19
- expect(@user).to be_seeing 'bundler_faker'
20
- end
21
-
22
- Then(/^the bundler dependency is not listed as an action item$/) do
23
- @user.execute_command('license_finder > /dev/null')
24
- @user.execute_command('license_finder action_items')
25
- expect(@user).not_to be_seeing 'bundler_faker'
26
- end
27
-
28
- Then(/^I should not see 'bundler' in the dependency docs$/)do
29
- @user.execute_command('license_finder')
30
- dependencies_csv_path = @user.app_path.join('doc', 'dependencies.csv')
31
- dependencies_csv = File.open(dependencies_csv_path, 'r')
32
-
33
- expect(dependencies_csv.read).not_to match /bundler_faker/
34
- end
35
-
@@ -1,3 +0,0 @@
1
- When(/^I set the project name to (\w+)$/) do |project_name|
2
- @user.execute_command "license_finder project_name set #{project_name}"
3
- end
@@ -1,45 +0,0 @@
1
- Given(/^I have an app that depends on an MIT license$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_and_depend_on_gem 'mit_gem', license: 'MIT'
5
- end
6
-
7
- Given(/^I have an app that depends on an BSD license$/) do
8
- @user = ::DSL::User.new
9
- @user.create_ruby_app
10
- @user.create_and_depend_on_gem 'bsd_gem', license: 'BSD'
11
- end
12
-
13
- When(/^I whitelist the BSD license$/) do
14
- @user.execute_command 'license_finder whitelist add BSD'
15
- end
16
-
17
- When(/^I whitelist the Expat license$/) do
18
- @user.execute_command 'license_finder whitelist add Expat'
19
- end
20
-
21
- When(/^I view the whitelisted licenses$/) do
22
- @user.execute_command 'license_finder whitelist list'
23
- end
24
-
25
- When(/^I remove Expat from the whitelist$/) do
26
- @user.execute_command 'license_finder whitelist remove Expat'
27
- end
28
-
29
- Then(/^I should not see a MIT licensed gem unapproved$/) do
30
- @user.execute_command 'license_finder --quiet'
31
- expect(@user).to_not be_seeing 'mit_gem'
32
- end
33
-
34
- Then(/^I should see Expat in the output$/) do
35
- expect(@user).to be_seeing 'Expat'
36
- end
37
-
38
- Then(/^I should not see Expat in the output$/) do
39
- expect(@user).to_not be_seeing 'Expat'
40
- end
41
-
42
- Then(/^I should not see a BSD licensed gem unapproved$/) do
43
- @user.execute_command 'license_finder --quiet'
44
- expect(@user).to_not be_seeing 'bsd_gem'
45
- end
@@ -1,8 +0,0 @@
1
- Given(/^A build.gradle file with dependencies$/) do
2
- @user = ::DSL::User.new
3
- @user.create_gradle_app
4
- end
5
-
6
- Then(/^I should see a Gradle dependency with a license$/) do
7
- expect(@user).to be_seeing_line "junit, 4.11, Common Public License Version 1.0"
8
- end
@@ -1,28 +0,0 @@
1
- Given(/^I have an app and a JS dependency$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.execute_command 'license_finder dependencies add MIT my_js_dep 1.2.3'
5
- end
6
-
7
- When(/^I add my JS dependency$/) do
8
- @user.execute_command 'license_finder dependencies add MIT my_js_dep 1.2.3'
9
- end
10
-
11
- When(/^I add my JS dependency with an approval flag$/) do
12
- @user.execute_command 'license_finder dependencies add --approve MIT my_js_dep 1.2.3'
13
- expect(@user).to be_seeing "The my_js_dep dependency has been added and approved"
14
- end
15
-
16
- When(/^I remove my JS dependency$/) do
17
- @user.execute_command 'license_finder dependencies remove my_js_dep'
18
- end
19
-
20
- Then(/^I should see the JS dependency in the console output$/) do
21
- @user.execute_command 'license_finder --quiet'
22
- expect(@user).to be_seeing 'my_js_dep, 1.2.3, MIT'
23
- end
24
-
25
- Then(/^I should not see the JS dependency in the console output$/) do
26
- @user.execute_command 'license_finder --quiet'
27
- expect(@user).to_not be_seeing 'my_js_dep, 1.2.3, MIT'
28
- end
@@ -1,24 +0,0 @@
1
- Given(/^I have an app that depends on a GPL licensed gem$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_and_depend_on_gem "gpl_gem", license: "GPL"
5
- end
6
-
7
- When(/^I approve that gem$/) do
8
- @user.execute_command "license_finder"
9
- expect(@user).to be_seeing "gpl_gem"
10
- @user.execute_command "license_finder approve gpl_gem --approver 'Julian' --message 'We really need this'"
11
- @user.execute_command "license_finder --quiet"
12
- end
13
-
14
- Then(/^I should not see that gem in the console output$/) do
15
- expect(@user).to_not be_seeing "gpl_gem"
16
- end
17
-
18
- Then(/^I should see that gem approved in dependencies\.html$/) do
19
- @user.in_gem_html("gpl_gem") do |gpl_gem|
20
- expect(gpl_gem[:class].split(' ')).to include "approved"
21
- expect(gpl_gem).to have_content "Julian"
22
- expect(gpl_gem).to have_content "We really need this"
23
- end
24
- end
@@ -1,34 +0,0 @@
1
- Given(/^I have an app that depends on a few gems without known licenses$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_and_depend_on_gem 'other_gem', version: '1.0', license: 'other'
5
- @user.create_and_depend_on_gem 'control_gem', version: '1.0', license: 'other'
6
- end
7
-
8
- When(/^I set one gem's license to MIT from the command line$/) do
9
- @user.execute_command 'license_finder --quiet'
10
- @user.execute_command 'license_finder license MIT other_gem'
11
- @user.execute_command 'license_finder --quiet'
12
- end
13
-
14
- Then(/^I should see that gem's license set to MIT$/) do
15
- expect(@user).to be_seeing 'other_gem, 1.0, MIT'
16
- end
17
-
18
- Then(/^I should see other gems have not changed their licenses$/) do
19
- expect(@user).to be_seeing 'control_gem, 1.0, other'
20
- end
21
-
22
- Given(/^I have an app that depends on a manually licensed gem$/) do
23
- @user = ::DSL::User.new
24
- @user.create_ruby_app
25
- @user.create_and_depend_on_gem 'changed_gem', license: 'MIT'
26
- @user.execute_command "license_finder --quiet"
27
- @user.execute_command "license_finder license Ruby changed_gem"
28
- expect(@user).to be_seeing_something_like /changed_gem.*Ruby/
29
- end
30
-
31
- Then(/^the gem should keep its manually assigned license$/) do
32
- expect(@user).to be_seeing_something_like /changed_gem.*ruby/
33
- end
34
-
@@ -1,8 +0,0 @@
1
- Given(/^A pom file with dependencies$/) do
2
- @user = ::DSL::User.new
3
- @user.create_maven_app
4
- end
5
-
6
- Then(/^I should see a Maven dependency with a license$/) do
7
- expect(@user).to be_seeing_line "junit, 4.11, Common Public License Version 1.0"
8
- end
@@ -1,14 +0,0 @@
1
- Given(/^I have an app that depends on BSD and GPL-2 licenses$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_and_depend_on_gem 'bsd_and_gpl2_gem', licenses: %w(BSD GPL-2)
5
- end
6
-
7
- When(/^I whitelist the GPL-2 license$/) do
8
- @user.execute_command 'license_finder whitelist add GPL-2'
9
- end
10
-
11
- Then(/^I should not see a BSD and GPL-2 licensed gem unapproved$/) do
12
- @user.execute_command 'license_finder --quiet'
13
- expect(@user).to_not be_seeing 'bsd_and_gpl2_gem'
14
- end
@@ -1,8 +0,0 @@
1
- Given(/^A package file with dependencies$/) do
2
- @user = ::DSL::User.new
3
- @user.create_node_app
4
- end
5
-
6
- Then(/^I should see a Node dependency with a license$/) do
7
- expect(@user).to be_seeing_line "http-server, 0.6.1, MIT"
8
- end
@@ -1,8 +0,0 @@
1
- Given(/^A requirements file with dependencies$/) do
2
- @user = ::DSL::User.new
3
- @user.create_python_app
4
- end
5
-
6
- Then(/^I should see a Python dependency with a license$/) do
7
- expect(@user).to be_seeing_line "argparse, 1.2.1, Python Software Foundation License"
8
- end
@@ -1,20 +0,0 @@
1
- Given(/^I have an app that depends on a gem with license and version details$/) do
2
- @user = ::DSL::User.new
3
- @user.create_ruby_app
4
- @user.create_and_depend_on_gem('info_gem', license: 'MIT', version: '1.1.1')
5
- end
6
-
7
- Given(/^I have a dependencies\.txt file$/) do
8
- @user.app_path("doc").mkpath
9
-
10
- @user.app_path("doc/dependencies.txt").open('w+') { |file| file.puts("Legacy text file") }
11
- end
12
-
13
- Then(/^I should see those version and license details in the dependencies\.csv file$/) do
14
- expect(@user.app_path("doc/dependencies.csv").read).to include "info_gem, 1.1.1, MIT"
15
- end
16
-
17
- Then(/^I should see dependencies\.txt replaced by dependencies\.csv$/) do
18
- expect(@user.app_path("doc/dependencies.txt")).to_not be_exist
19
- expect(@user.app_path("doc/dependencies.csv")).to be_exist
20
- end
@@ -1,60 +0,0 @@
1
- Given(/^my app depends on a gem with specific details$/) do
2
- @gem_name = "mit_licensed_gem"
3
- @gem_homepage = "http://mit_licensed_gem.github.com"
4
- @table = {
5
- license: "MIT",
6
- summary: "mit is cool",
7
- description: "seriously",
8
- version: "0.0.1",
9
- bundler_group: "test"
10
- }
11
- @user.create_gem(@gem_name,
12
- license: @table[:license],
13
- summary: @table[:summary],
14
- description: @table[:description],
15
- version: @table[:version],
16
- homepage: @gem_homepage,
17
- )
18
- @user.depend_on_local_gem(@gem_name, groups: [@table[:bundler_group]])
19
- end
20
-
21
- Given(/^my app depends on MIT and GPL licensed gems$/) do
22
- @user.create_and_depend_on_gem 'gpl_licensed_gem', license: "GPL"
23
- @user.create_and_depend_on_gem 'mit_licensed_gem', license: "MIT"
24
- end
25
-
26
- When(/^I whitelist the MIT license$/) do
27
- @user.configure_license_finder_whitelist ["MIT"]
28
- @user.execute_command "license_finder --quiet"
29
- end
30
-
31
- Then(/^I should see my specific gem details listed in the html$/) do
32
- @user.in_gem_html(@gem_name) do |section|
33
- expect(section.find("a[href='#{@gem_homepage}']", text: @gem_name)).to be
34
- @table.values.each do |property_value|
35
- expect(section).to have_content property_value
36
- end
37
- end
38
- end
39
-
40
- Then(/^I should see the GPL gem unapproved in html$/) do
41
- is_html_status?('gpl_licensed_gem', 'unapproved')
42
- end
43
-
44
- Then(/^the MIT gem approved in html$/) do
45
- is_html_status?('mit_licensed_gem', 'approved')
46
- end
47
-
48
- Then(/^I should see only see GPL liceneses as unapproved in the html$/) do
49
- @user.in_html do |page|
50
- expect(page).to have_content '1 GPL'
51
- action_items = page.find('.action-items')
52
- expect(action_items).to have_content '(GPL)'
53
- end
54
- end
55
-
56
- def is_html_status?(gem, approval)
57
- @user.in_gem_html(gem) do |gpl_gem|
58
- expect(gpl_gem[:class].split(' ')).to include approval
59
- end
60
- end