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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.rdoc +9 -0
- data/MIT.LICENSE +20 -0
- data/db/migrate/201401302113_re_reassociate_license.rb +23 -0
- data/features/gradle_dependencies.feature +9 -0
- data/features/maven_dependencies.feature +9 -0
- data/features/step_definitions/gradle_steps.rb +8 -0
- data/features/step_definitions/maven_steps.rb +8 -0
- data/features/step_definitions/node_steps.rb +1 -1
- data/features/step_definitions/set_license_steps.rb +0 -1
- data/features/step_definitions/shared_steps.rb +26 -13
- data/lib/license_finder.rb +6 -1
- data/lib/license_finder/cli.rb +13 -9
- data/lib/license_finder/configuration.rb +113 -72
- data/lib/license_finder/dependency_manager.rb +12 -7
- data/lib/license_finder/license.rb +39 -65
- data/lib/license_finder/license/any_matcher.rb +13 -0
- data/lib/license_finder/license/definitions.rb +106 -0
- data/lib/license_finder/license/header_matcher.rb +10 -0
- data/lib/license_finder/license/matcher.rb +17 -0
- data/lib/license_finder/license/template.rb +16 -0
- data/lib/license_finder/license/text.rb +19 -0
- data/lib/license_finder/license_url.rb +1 -4
- data/lib/license_finder/package.rb +18 -2
- data/lib/license_finder/package_managers/bower_package.rb +3 -17
- data/lib/license_finder/package_managers/bundler_package.rb +2 -2
- data/lib/license_finder/package_managers/gradle.rb +29 -0
- data/lib/license_finder/package_managers/gradle_package.rb +41 -0
- data/lib/license_finder/package_managers/maven.rb +31 -0
- data/lib/license_finder/package_managers/maven_package.rb +46 -0
- data/lib/license_finder/package_managers/npm_package.rb +2 -16
- data/lib/license_finder/package_managers/pip_package.rb +7 -7
- data/lib/license_finder/package_saver.rb +1 -1
- data/lib/license_finder/possible_license_file.rb +1 -5
- data/lib/license_finder/possible_license_files.rb +4 -2
- data/lib/license_finder/reports/dependency_report.rb +5 -1
- data/lib/license_finder/reports/detailed_text_report.rb +0 -1
- data/lib/license_finder/reports/formatted_report.rb +21 -0
- data/lib/license_finder/reports/html_report.rb +1 -21
- data/lib/license_finder/reports/markdown_report.rb +1 -21
- data/lib/license_finder/reports/reporter.rb +8 -7
- data/lib/license_finder/reports/text_report.rb +0 -2
- data/lib/license_finder/tables.rb +1 -1
- data/lib/license_finder/tables/dependency.rb +12 -12
- data/lib/license_finder/yml_to_sql.rb +4 -4
- data/license_finder.gemspec +3 -2
- data/readme.md +10 -1
- data/release/publish.sh +10 -7
- data/spec/fixtures/build.gradle +24 -0
- data/spec/fixtures/pom.xml +19 -0
- data/spec/lib/license_finder/cli_spec.rb +13 -3
- data/spec/lib/license_finder/configuration_spec.rb +121 -74
- data/spec/lib/license_finder/dependency_manager_spec.rb +34 -16
- data/spec/lib/license_finder/license/{new_bsd_spec.rb → definitions_spec.rb} +93 -7
- data/spec/lib/license_finder/license_spec.rb +72 -26
- data/spec/lib/license_finder/license_url_spec.rb +10 -14
- data/spec/lib/license_finder/package_managers/bower_package_spec.rb +17 -5
- data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +2 -2
- data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +66 -0
- data/spec/lib/license_finder/package_managers/gradle_spec.rb +89 -0
- data/spec/lib/license_finder/package_managers/maven_package_spec.rb +72 -0
- data/spec/lib/license_finder/package_managers/maven_spec.rb +115 -0
- data/spec/lib/license_finder/package_managers/npm_package_spec.rb +17 -3
- data/spec/lib/license_finder/package_managers/pip_package_spec.rb +27 -5
- data/spec/lib/license_finder/possible_license_file_spec.rb +2 -2
- data/spec/lib/license_finder/{detailed_text_report_spec.rb → reports/detailed_text_report_spec.rb} +0 -0
- data/spec/lib/license_finder/{html_report_spec.rb → reports/html_report_spec.rb} +0 -0
- data/spec/lib/license_finder/{markdown_report_spec.rb → reports/markdown_report_spec.rb} +0 -0
- data/spec/lib/license_finder/reports/reporter_spec.rb +33 -0
- data/spec/lib/license_finder/{text_report_spec.rb → reports/text_report_spec.rb} +0 -0
- data/spec/lib/license_finder/tables/dependency_spec.rb +1 -2
- data/spec/lib/license_finder/tables/license_alias_spec.rb +1 -2
- data/spec/lib/license_finder/yml_to_sql_spec.rb +10 -11
- data/spec/lib/license_finder_spec.rb +5 -71
- metadata +64 -53
- data/features/rails_rake.feature +0 -9
- data/features/step_definitions/rails_rake_steps.rb +0 -12
- data/lib/license_finder/license/apache2.rb +0 -8
- data/lib/license_finder/license/bsd.rb +0 -4
- data/lib/license_finder/license/gplv2.rb +0 -4
- data/lib/license_finder/license/isc.rb +0 -3
- data/lib/license_finder/license/lgpl.rb +0 -4
- data/lib/license_finder/license/mit.rb +0 -23
- data/lib/license_finder/license/new_bsd.rb +0 -27
- data/lib/license_finder/license/python.rb +0 -8
- data/lib/license_finder/license/ruby.rb +0 -11
- data/lib/license_finder/license/simplified_bsd.rb +0 -8
- data/lib/license_finder/railtie.rb +0 -7
- data/lib/tasks/license_finder.rake +0 -7
- data/spec/lib/license_finder/license/apache_spec.rb +0 -7
- data/spec/lib/license_finder/license/bsd_spec.rb +0 -41
- data/spec/lib/license_finder/license/gplv2_spec.rb +0 -7
- data/spec/lib/license_finder/license/isc_spec.rb +0 -7
- data/spec/lib/license_finder/license/lgpl_spec.rb +0 -7
- data/spec/lib/license_finder/license/mit_spec.rb +0 -33
- data/spec/lib/license_finder/license/python_spec.rb +0 -7
- data/spec/lib/license_finder/license/ruby_spec.rb +0 -19
- data/spec/lib/license_finder/license/simplified_bsd_spec.rb +0 -7
- data/spec/lib/license_finder/reporter_spec.rb +0 -46
- data/spec/support/license_examples.rb +0 -30
@@ -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,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,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,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,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
|