license_finder 0.9.5.1-java → 1.0.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +9 -0
  4. data/CHANGELOG.rdoc +9 -0
  5. data/MIT.LICENSE +20 -0
  6. data/db/migrate/201401302113_re_reassociate_license.rb +23 -0
  7. data/features/gradle_dependencies.feature +9 -0
  8. data/features/maven_dependencies.feature +9 -0
  9. data/features/step_definitions/gradle_steps.rb +8 -0
  10. data/features/step_definitions/maven_steps.rb +8 -0
  11. data/features/step_definitions/node_steps.rb +1 -1
  12. data/features/step_definitions/set_license_steps.rb +0 -1
  13. data/features/step_definitions/shared_steps.rb +26 -13
  14. data/lib/license_finder.rb +6 -1
  15. data/lib/license_finder/cli.rb +13 -9
  16. data/lib/license_finder/configuration.rb +113 -72
  17. data/lib/license_finder/dependency_manager.rb +12 -7
  18. data/lib/license_finder/license.rb +39 -65
  19. data/lib/license_finder/license/any_matcher.rb +13 -0
  20. data/lib/license_finder/license/definitions.rb +106 -0
  21. data/lib/license_finder/license/header_matcher.rb +10 -0
  22. data/lib/license_finder/license/matcher.rb +17 -0
  23. data/lib/license_finder/license/template.rb +16 -0
  24. data/lib/license_finder/license/text.rb +19 -0
  25. data/lib/license_finder/license_url.rb +1 -4
  26. data/lib/license_finder/package.rb +18 -2
  27. data/lib/license_finder/package_managers/bower_package.rb +3 -17
  28. data/lib/license_finder/package_managers/bundler_package.rb +2 -2
  29. data/lib/license_finder/package_managers/gradle.rb +29 -0
  30. data/lib/license_finder/package_managers/gradle_package.rb +41 -0
  31. data/lib/license_finder/package_managers/maven.rb +31 -0
  32. data/lib/license_finder/package_managers/maven_package.rb +46 -0
  33. data/lib/license_finder/package_managers/npm_package.rb +2 -16
  34. data/lib/license_finder/package_managers/pip_package.rb +7 -7
  35. data/lib/license_finder/package_saver.rb +1 -1
  36. data/lib/license_finder/possible_license_file.rb +1 -5
  37. data/lib/license_finder/possible_license_files.rb +4 -2
  38. data/lib/license_finder/reports/dependency_report.rb +5 -1
  39. data/lib/license_finder/reports/detailed_text_report.rb +0 -1
  40. data/lib/license_finder/reports/formatted_report.rb +21 -0
  41. data/lib/license_finder/reports/html_report.rb +1 -21
  42. data/lib/license_finder/reports/markdown_report.rb +1 -21
  43. data/lib/license_finder/reports/reporter.rb +8 -7
  44. data/lib/license_finder/reports/text_report.rb +0 -2
  45. data/lib/license_finder/tables.rb +1 -1
  46. data/lib/license_finder/tables/dependency.rb +12 -12
  47. data/lib/license_finder/yml_to_sql.rb +4 -4
  48. data/license_finder.gemspec +3 -2
  49. data/readme.md +10 -1
  50. data/release/publish.sh +10 -7
  51. data/spec/fixtures/build.gradle +24 -0
  52. data/spec/fixtures/pom.xml +19 -0
  53. data/spec/lib/license_finder/cli_spec.rb +13 -3
  54. data/spec/lib/license_finder/configuration_spec.rb +121 -74
  55. data/spec/lib/license_finder/dependency_manager_spec.rb +34 -16
  56. data/spec/lib/license_finder/license/{new_bsd_spec.rb → definitions_spec.rb} +93 -7
  57. data/spec/lib/license_finder/license_spec.rb +72 -26
  58. data/spec/lib/license_finder/license_url_spec.rb +10 -14
  59. data/spec/lib/license_finder/package_managers/bower_package_spec.rb +17 -5
  60. data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +2 -2
  61. data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +66 -0
  62. data/spec/lib/license_finder/package_managers/gradle_spec.rb +89 -0
  63. data/spec/lib/license_finder/package_managers/maven_package_spec.rb +72 -0
  64. data/spec/lib/license_finder/package_managers/maven_spec.rb +115 -0
  65. data/spec/lib/license_finder/package_managers/npm_package_spec.rb +17 -3
  66. data/spec/lib/license_finder/package_managers/pip_package_spec.rb +27 -5
  67. data/spec/lib/license_finder/possible_license_file_spec.rb +2 -2
  68. data/spec/lib/license_finder/{detailed_text_report_spec.rb → reports/detailed_text_report_spec.rb} +0 -0
  69. data/spec/lib/license_finder/{html_report_spec.rb → reports/html_report_spec.rb} +0 -0
  70. data/spec/lib/license_finder/{markdown_report_spec.rb → reports/markdown_report_spec.rb} +0 -0
  71. data/spec/lib/license_finder/reports/reporter_spec.rb +33 -0
  72. data/spec/lib/license_finder/{text_report_spec.rb → reports/text_report_spec.rb} +0 -0
  73. data/spec/lib/license_finder/tables/dependency_spec.rb +1 -2
  74. data/spec/lib/license_finder/tables/license_alias_spec.rb +1 -2
  75. data/spec/lib/license_finder/yml_to_sql_spec.rb +10 -11
  76. data/spec/lib/license_finder_spec.rb +5 -71
  77. metadata +64 -53
  78. data/features/rails_rake.feature +0 -9
  79. data/features/step_definitions/rails_rake_steps.rb +0 -12
  80. data/lib/license_finder/license/apache2.rb +0 -8
  81. data/lib/license_finder/license/bsd.rb +0 -4
  82. data/lib/license_finder/license/gplv2.rb +0 -4
  83. data/lib/license_finder/license/isc.rb +0 -3
  84. data/lib/license_finder/license/lgpl.rb +0 -4
  85. data/lib/license_finder/license/mit.rb +0 -23
  86. data/lib/license_finder/license/new_bsd.rb +0 -27
  87. data/lib/license_finder/license/python.rb +0 -8
  88. data/lib/license_finder/license/ruby.rb +0 -11
  89. data/lib/license_finder/license/simplified_bsd.rb +0 -8
  90. data/lib/license_finder/railtie.rb +0 -7
  91. data/lib/tasks/license_finder.rake +0 -7
  92. data/spec/lib/license_finder/license/apache_spec.rb +0 -7
  93. data/spec/lib/license_finder/license/bsd_spec.rb +0 -41
  94. data/spec/lib/license_finder/license/gplv2_spec.rb +0 -7
  95. data/spec/lib/license_finder/license/isc_spec.rb +0 -7
  96. data/spec/lib/license_finder/license/lgpl_spec.rb +0 -7
  97. data/spec/lib/license_finder/license/mit_spec.rb +0 -33
  98. data/spec/lib/license_finder/license/python_spec.rb +0 -7
  99. data/spec/lib/license_finder/license/ruby_spec.rb +0 -19
  100. data/spec/lib/license_finder/license/simplified_bsd_spec.rb +0 -7
  101. data/spec/lib/license_finder/reporter_spec.rb +0 -46
  102. data/spec/support/license_examples.rb +0 -30
@@ -1,7 +0,0 @@
1
- module LicenseFinder
2
- class Railtie < Rails::Railtie
3
- rake_tasks do
4
- load "tasks/license_finder.rake"
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- desc 'Audit your Gemfile for software licenses. This is the same as running `license_finder` in the terminal.'
2
- task :license_finder do
3
- puts "DEPRECATION WARNING: 'rake license_finder' is going to be removed
4
- for the 1.0.0 release. Please instead use the command line utility 'license_finder'
5
- or refer to the README for avalible command line utilities"
6
- LicenseFinder::CLI::Main.new.rescan
7
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::Apache2 do
4
- subject { LicenseFinder::License::Apache2.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::BSD do
4
- subject { LicenseFinder::License::BSD.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
-
8
- it "should match regardless of organization or copyright holder names or quotes" do
9
- license = LicenseFinder::License::BSD.new <<-LICENSE
10
- Copyright (c) 2000, Widgets, Inc.
11
- All rights reserved.
12
-
13
- Redistribution and use in source and binary forms, with or without
14
- modification, are permitted provided that the following conditions are met:
15
- 1. Redistributions of source code must retain the above copyright
16
- notice, this list of conditions and the following disclaimer.
17
- 2. Redistributions in binary form must reproduce the above copyright
18
- notice, this list of conditions and the following disclaimer in the
19
- documentation and/or other materials provided with the distribution.
20
- 3. All advertising materials mentioning features or use of this software
21
- must display the following acknowledgement:
22
- This product includes software developed by <organization>.
23
- 4. Neither the name of foo bar *%*%*%*% nor the
24
- names of its contributors may be used to endorse or promote products
25
- derived from this software without specific prior written permission.
26
-
27
- THIS SOFTWARE IS PROVIDED BY awesome *$*$* copyright name 'AS IS' AND ANY
28
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30
- DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
31
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
34
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
- LICENSE
38
-
39
- license.should be_matches
40
- end
41
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::GPLv2 do
4
- subject { LicenseFinder::License::GPLv2.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::ISC do
4
- subject { LicenseFinder::License::ISC.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::LGPL do
4
- subject { LicenseFinder::License::LGPL.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
- end
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::MIT do
4
- subject { LicenseFinder::License::MIT.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
-
8
- describe "#matches?" do
9
- it "should return true if the text contains the MIT url" do
10
- subject.text = "MIT License is awesome http://opensource.org/licenses/mit-license"
11
- should be_matches
12
-
13
- subject.text = "MIT Licence is awesome http://www.opensource.org/licenses/mit-license"
14
- should be_matches
15
- end
16
-
17
- it "should return true if the text contains 'The MIT License'" do
18
- subject.text = "The MIT License"
19
- should be_matches
20
-
21
- subject.text = "The MIT Licence"
22
- should be_matches
23
- end
24
-
25
- it "should return true if the text contains 'is released under the MIT license'" do
26
- subject.text = "is released under the MIT license"
27
- should be_matches
28
-
29
- subject.text = "is released under the MIT licence"
30
- should be_matches
31
- end
32
- end
33
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::Python do
4
- subject { LicenseFinder::License::Python.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::Ruby do
4
- subject { LicenseFinder::License::Ruby.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
-
8
- describe "#matches?" do
9
- it "should return true when the Ruby license URL is present" do
10
- subject.text = "This gem is available under the following license:\nhttp://www.ruby-lang.org/en/LICENSE.txt\nOkay?"
11
- should be_matches
12
- end
13
-
14
- it "should return false when the Ruby License URL is not present" do
15
- subject.text = "This gem is available under the following license:\nhttp://www.example.com\nOkay?"
16
- should_not be_matches
17
- end
18
- end
19
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LicenseFinder::License::SimplifiedBSD do
4
- subject { LicenseFinder::License::SimplifiedBSD.new("") }
5
-
6
- it_behaves_like "a license matcher"
7
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module LicenseFinder
4
- describe Reporter do
5
- describe "#write_reports" do
6
- subject { Reporter.write_reports }
7
-
8
- before do
9
- Dependency.stub(:all) { [double(:dep)] }
10
- File.any_instance.stub(:puts)
11
-
12
- LicenseFinder.stub_chain(:config, :dependencies_html) { 'html_file_path' }
13
- LicenseFinder.stub_chain(:config, :dependencies_text) { 'text_file_path' }
14
- LicenseFinder.stub_chain(:config, :dependencies_detailed_text) { 'detailed_text_file_path' }
15
- LicenseFinder.stub_chain(:config, :dependencies_markdown) { 'markdown_file_path' }
16
-
17
- MarkdownReport.stub_chain(:new, :to_s) { 'text report' }
18
- DetailedTextReport.stub_chain(:new, :to_s) { 'text report' }
19
- TextReport.stub_chain(:new, :to_s) { 'text report' }
20
- HtmlReport.stub_chain(:new, :to_s) { 'text report' }
21
-
22
- LicenseFinder.stub_chain(:config, :dependencies_legacy_text) { 'legacy_text_path' }
23
- File.stub(:exists?).with('legacy_text_path') { false }
24
-
25
- File.stub(:open).with('html_file_path', 'w+')
26
- File.stub(:open).with('text_file_path', 'w+')
27
- File.stub(:open).with('detailed_text_file_path', 'w+')
28
- File.stub(:open).with('markdown_file_path', 'w+')
29
- end
30
-
31
- it "writes an html file" do
32
- File.should_receive(:open).with('html_file_path', 'w+')
33
- File.should_receive(:open).with('text_file_path', 'w+')
34
- File.should_receive(:open).with('detailed_text_file_path', 'w+')
35
- File.should_receive(:open).with('markdown_file_path', 'w+')
36
- subject
37
- end
38
-
39
- it "deletes old dependencies.txt file" do
40
- File.stub(:exists?).with('legacy_text_path') { true }
41
- File.should_receive(:delete).with('legacy_text_path')
42
- subject
43
- end
44
- end
45
- end
46
- end
@@ -1,30 +0,0 @@
1
- shared_examples_for "a license matcher" do
2
- describe "#matches?" do
3
- context "when a license text template exists" do
4
- before do
5
- subject.class.stub(:license_text).and_return('AWESOME "FOO" LICENSE')
6
- end
7
-
8
- it "should return true if the body matches exactly" do
9
- subject.text = 'AWESOME "FOO" LICENSE'
10
- should be_matches
11
- end
12
-
13
- it "should return false if the body does not match at all" do
14
- subject.text = "hi"
15
- should_not be_matches
16
- end
17
-
18
- it "should return true if the body matches disregarding quote and new line differences" do
19
- subject.text = "AWESOME\n'FOO'\nLICENSE"
20
- should be_matches
21
- end
22
- end
23
- end
24
-
25
- describe "#license_text" do
26
- it "should always produce a license text" do
27
- subject.class.license_text.should_not be_nil, "No license text found for #{subject.class}! Add a license template to lib/data/licenses named '#{subject.class.demodulized_name}.txt'"
28
- end
29
- end
30
- end