license_finder 1.0.0.0-java → 1.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.force-build +0 -0
- data/.travis.yml +8 -7
- data/CHANGELOG.rdoc +29 -1
- data/Rakefile +2 -2
- data/db/migrate/201311192003_reassociate_manual_approval.rb +2 -3
- data/db/migrate/201403181732_rename_manual_fields.rb +10 -0
- data/db/migrate/201403190028_add_manual_approvals.rb +22 -0
- data/db/migrate/201403191419_add_timestamps_to_manual_approvals.rb +15 -0
- data/db/migrate/201403191645_remove_license_aliases.rb +23 -0
- data/features/cli.feature +21 -20
- data/features/cocoapods_dependencies.feature +10 -0
- data/features/configure_bundler_groups.feature +23 -0
- data/features/configure_ignore_dependencies.feature +16 -0
- data/features/{project_name.feature → configure_project_name.feature} +1 -1
- data/features/{whitelist.feature → configure_whitelist.feature} +6 -6
- data/features/manually_added.feature +19 -0
- data/features/{approve_dependencies.feature → manually_approved.feature} +2 -2
- data/features/manually_assigned_license.feature +16 -0
- data/features/{text_report.feature → report_csv.feature} +2 -2
- data/features/{html_report.feature → report_html.feature} +2 -2
- data/features/step_definitions/cli_steps.rb +22 -32
- data/features/step_definitions/cocoapod_steps.rb +8 -0
- data/features/step_definitions/configure_bundler_groups_steps.rb +30 -0
- data/features/step_definitions/configure_ignore_dependencies.rb +35 -0
- data/features/step_definitions/{project_name_steps.rb → configure_project_name_steps.rb} +0 -0
- data/features/step_definitions/configure_whitelist_steps.rb +45 -0
- data/features/step_definitions/gradle_steps.rb +2 -2
- data/features/step_definitions/manually_added_steps.rb +28 -0
- data/features/step_definitions/manually_approved_steps.rb +24 -0
- data/features/step_definitions/manually_assigned_license_steps.rb +34 -0
- data/features/step_definitions/maven_steps.rb +2 -2
- data/features/step_definitions/node_steps.rb +2 -2
- data/features/step_definitions/python_steps.rb +1 -1
- data/features/step_definitions/report_csv_steps.rb +20 -0
- data/features/step_definitions/report_html_steps.rb +60 -0
- data/features/step_definitions/shared_steps.rb +125 -104
- data/{files/license_finder.yml → lib/data/license_finder.example.yml} +3 -0
- data/lib/license_finder.rb +3 -2
- data/lib/license_finder/cli.rb +94 -49
- data/lib/license_finder/configuration.rb +21 -14
- data/lib/license_finder/dependency_manager.rb +27 -19
- data/lib/license_finder/license.rb +33 -19
- data/lib/license_finder/license/definitions.rb +153 -104
- data/lib/license_finder/license/matcher.rb +6 -1
- data/lib/license_finder/license/none_matcher.rb +9 -0
- data/lib/license_finder/license/text.rb +1 -0
- data/lib/license_finder/package.rb +30 -6
- data/lib/license_finder/package_managers/bower.rb +2 -2
- data/lib/license_finder/package_managers/bower_package.rb +2 -2
- data/lib/license_finder/package_managers/bundler.rb +9 -17
- data/lib/license_finder/package_managers/bundler_package.rb +1 -1
- data/lib/license_finder/package_managers/cocoa_pods.rb +35 -0
- data/lib/license_finder/package_managers/cocoa_pods_package.rb +19 -0
- data/lib/license_finder/package_managers/gradle.rb +9 -5
- data/lib/license_finder/package_managers/gradle_package.rb +4 -4
- data/lib/license_finder/package_managers/maven.rb +7 -3
- data/lib/license_finder/package_managers/maven_package.rb +5 -5
- data/lib/license_finder/package_managers/npm.rb +2 -2
- data/lib/license_finder/package_managers/npm_package.rb +2 -2
- data/lib/license_finder/package_managers/pip.rb +2 -2
- data/lib/license_finder/package_managers/pip_package.rb +7 -11
- data/lib/license_finder/package_saver.rb +12 -10
- data/lib/license_finder/possible_license_file.rb +1 -1
- data/lib/license_finder/possible_license_files.rb +11 -15
- data/lib/license_finder/reports/formatted_report.rb +25 -6
- data/lib/license_finder/reports/html_report.rb +2 -1
- data/lib/license_finder/reports/reporter.rb +3 -3
- data/lib/license_finder/tables.rb +6 -4
- data/lib/license_finder/tables/dependency.rb +36 -16
- data/lib/license_finder/tables/manual_approval.rb +13 -0
- data/lib/license_finder/yml_to_sql.rb +12 -9
- data/lib/templates/html_report.erb +68 -74
- data/lib/templates/markdown_report.erb +20 -21
- data/license_finder.gemspec +7 -7
- data/readme.md +76 -79
- data/spec/fixtures/Podfile +3 -0
- data/spec/lib/license_finder/cli_spec.rb +71 -23
- data/spec/lib/license_finder/configuration_spec.rb +61 -21
- data/spec/lib/license_finder/dependency_manager_spec.rb +52 -33
- data/spec/lib/license_finder/license/definitions_spec.rb +30 -14
- data/spec/lib/license_finder/license_spec.rb +55 -12
- data/spec/lib/license_finder/package_managers/bower_package_spec.rb +38 -19
- data/spec/lib/license_finder/package_managers/bower_spec.rb +10 -16
- data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +39 -15
- data/spec/lib/license_finder/package_managers/bundler_spec.rb +10 -22
- data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +44 -0
- data/spec/lib/license_finder/package_managers/cocoa_pods_spec.rb +79 -0
- data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +4 -5
- data/spec/lib/license_finder/package_managers/gradle_spec.rb +26 -20
- data/spec/lib/license_finder/package_managers/maven_package_spec.rb +4 -5
- data/spec/lib/license_finder/package_managers/maven_spec.rb +16 -19
- data/spec/lib/license_finder/package_managers/npm_package_spec.rb +39 -19
- data/spec/lib/license_finder/package_managers/npm_spec.rb +10 -16
- data/spec/lib/license_finder/package_managers/pip_package_spec.rb +8 -8
- data/spec/lib/license_finder/package_managers/pip_spec.rb +10 -16
- data/spec/lib/license_finder/package_saver_spec.rb +27 -3
- data/spec/lib/license_finder/possible_license_file_spec.rb +25 -23
- data/spec/lib/license_finder/reports/detailed_text_report_spec.rb +6 -8
- data/spec/lib/license_finder/reports/html_report_spec.rb +45 -44
- data/spec/lib/license_finder/reports/markdown_report_spec.rb +8 -9
- data/spec/lib/license_finder/reports/reporter_spec.rb +1 -1
- data/spec/lib/license_finder/reports/text_report_spec.rb +6 -8
- data/spec/lib/license_finder/tables/dependency_spec.rb +57 -41
- data/spec/lib/license_finder/yml_to_sql_spec.rb +94 -92
- data/spec/spec_helper.rb +1 -0
- data/spec/support/stdout_helpers.rb +25 -0
- metadata +86 -69
- data/MIT.LICENSE +0 -20
- data/features/ignore_bundle_groups.feature +0 -23
- data/features/manually_managed_dependencies.feature +0 -19
- data/features/set_license.feature +0 -10
- data/features/step_definitions/approve_dependencies_steps.rb +0 -25
- data/features/step_definitions/html_report_steps.rb +0 -62
- data/features/step_definitions/ignore_bundle_groups_steps.rb +0 -29
- data/features/step_definitions/manually_managed_steps.rb +0 -33
- data/features/step_definitions/set_license_steps.rb +0 -20
- data/features/step_definitions/text_report_steps.rb +0 -19
- data/features/step_definitions/whitelist_steps.rb +0 -45
- data/files/dependency_breakdown.png +0 -0
- data/files/report_breakdown.png +0 -0
- data/lib/license_finder/license_url.rb +0 -9
- data/lib/license_finder/tables/license_alias.rb +0 -22
- data/spec/lib/license_finder/license_url_spec.rb +0 -16
- data/spec/lib/license_finder/tables/license_alias_spec.rb +0 -37
- data/spec/support/silence_stdout.rb +0 -13
data/MIT.LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008-2014 Pivotal Labs
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: Ignore Bundle Groups
|
2
|
-
As a developer
|
3
|
-
I want to ignore certain bundler groups
|
4
|
-
So that any gems I use in development, or for testing, are automatically approved for use
|
5
|
-
|
6
|
-
Scenario: Bundler groups can be added to the ignore list
|
7
|
-
Given I have an app with license finder
|
8
|
-
And I add the test group to the ignored bundler groups
|
9
|
-
When I get the ignored groups
|
10
|
-
Then I should see the test group in the output
|
11
|
-
|
12
|
-
Scenario: Ignored bundler groups are not evaluated for licenses
|
13
|
-
Given I have an app with license finder that depends on a GPL licensed gem in the test bundler group
|
14
|
-
And I add the test group to the ignored bundler groups
|
15
|
-
When I run license_finder
|
16
|
-
Then I should not see the GPL licensed gem in the output
|
17
|
-
|
18
|
-
Scenario: Bundler groups can be removed from the ignore list
|
19
|
-
Given I have an app with license finder
|
20
|
-
And I add the test group to the ignored bundler groups
|
21
|
-
And I remove the test group from the ignored bundler groups
|
22
|
-
When I get the ignored groups
|
23
|
-
Then I should not see the test group in the output
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Feature: Tracking Unmanaged Dependencies
|
2
|
-
So that I can track dependencies not managed by Bundler, NPM, etc.
|
3
|
-
As an application developer using license finder
|
4
|
-
I want to be able to manually track unmanaged dependencies
|
5
|
-
|
6
|
-
Scenario: Adding a manually managed dependency
|
7
|
-
Given I have an app with license finder
|
8
|
-
When I add my JS dependency
|
9
|
-
Then I should see the JS dependency in the console output
|
10
|
-
|
11
|
-
Scenario: Auto approving a manually managed dependency I add
|
12
|
-
Given I have an app with license finder
|
13
|
-
When I add my JS dependency with an approval flag
|
14
|
-
Then I should not see the JS dependency in the console output since it is approved
|
15
|
-
|
16
|
-
Scenario: Removing a manually managed dependency
|
17
|
-
Given I have an app with license finder and a JS dependency
|
18
|
-
When I remove my JS dependency
|
19
|
-
Then I should not see the JS dependency in the console output
|
@@ -1,10 +0,0 @@
|
|
1
|
-
Feature: Set a dependency's license through a command line interface
|
2
|
-
So that my dependencies all have the correct licenses
|
3
|
-
As an application developer
|
4
|
-
I want a command line interface to set licenses for specific dependencies
|
5
|
-
|
6
|
-
Scenario: Setting a license for a dependency
|
7
|
-
Given I have an app with license finder that depends on an other licensed gem
|
8
|
-
When I set that gems license to MIT from the command line
|
9
|
-
Then I should see that other gems license set to MIT
|
10
|
-
And I see other licensed gems have not changed licenses
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Given(/^I have an app with license finder that depends on a GPL licensed gem$/) do
|
2
|
-
@user = ::DSL::User.new
|
3
|
-
@user.create_nonrails_app
|
4
|
-
@user.add_dependency_to_app "gpl_gem", :license => "GPL"
|
5
|
-
end
|
6
|
-
|
7
|
-
When(/^I approve that gem$/) do
|
8
|
-
@output = @user.execute_command "license_finder"
|
9
|
-
@output.should include "gpl_gem"
|
10
|
-
@output = @user.execute_command "license_finder approve gpl_gem"
|
11
|
-
@output = @user.execute_command "license_finder --quiet"
|
12
|
-
end
|
13
|
-
|
14
|
-
Then(/^I should not see that gem in the console output$/) do
|
15
|
-
@output.should_not include "gpl_gem"
|
16
|
-
end
|
17
|
-
|
18
|
-
Then(/^I should see that gem approved in dependencies\.html$/) do
|
19
|
-
gem_name = "gpl_gem"
|
20
|
-
css_class = "approved"
|
21
|
-
html = File.read(@user.dependencies_html_path)
|
22
|
-
page = Capybara.string(html)
|
23
|
-
gpl_gem = page.find("##{gem_name}")
|
24
|
-
gpl_gem[:class].should == css_class
|
25
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
Given(/^my app depends on a gem with specific details$/) do
|
2
|
-
@gem_name = "mit_licensed_gem"
|
3
|
-
@table = {
|
4
|
-
license: "MIT",
|
5
|
-
summary: "mit is cool",
|
6
|
-
description: "seriously",
|
7
|
-
version: "0.0.1",
|
8
|
-
homepage: "http://mit_licensed_gem.github.com",
|
9
|
-
bundler_groups: "test"
|
10
|
-
}
|
11
|
-
@user.add_dependency_to_app(@gem_name,
|
12
|
-
:license => @table[:license],
|
13
|
-
:summary => @table[:summary],
|
14
|
-
:description => @table[:description],
|
15
|
-
:version => @table[:version],
|
16
|
-
:homepage => @table[:homepage],
|
17
|
-
:bundler_groups => @table[:bundler_groups]
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
Given(/^my app depends on MIT and GPL licensed gems$/) do
|
22
|
-
@user.add_dependency_to_app 'gpl_licensed_gem', :license => "GPL"
|
23
|
-
@user.add_dependency_to_app '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
|
-
html = File.read(@user.dependencies_html_path)
|
33
|
-
page = Capybara.string(html)
|
34
|
-
section = page.find("##{@gem_name}")
|
35
|
-
|
36
|
-
@table.first.each do |property_name, property_value|
|
37
|
-
section.should have_content property_value
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
Then(/^I should see the GPL gem unapproved in html$/) do
|
42
|
-
is_html_status?('gpl_licensed_gem', 'unapproved')
|
43
|
-
end
|
44
|
-
|
45
|
-
Then(/^the MIT gem approved in html$/) do
|
46
|
-
is_html_status?('mit_licensed_gem', 'approved')
|
47
|
-
end
|
48
|
-
|
49
|
-
Then(/^I should see only see GPL liceneses as unapproved in the html$/) do
|
50
|
-
html = File.read(@user.dependencies_html_path)
|
51
|
-
page = Capybara.string(html)
|
52
|
-
page.should have_content '1 GPL'
|
53
|
-
action_items = page.find('.action-items')
|
54
|
-
action_items.should have_content '(GPL)'
|
55
|
-
end
|
56
|
-
|
57
|
-
def is_html_status?(gem, approval)
|
58
|
-
html = File.read(@user.dependencies_html_path)
|
59
|
-
page = Capybara.string(html)
|
60
|
-
gpl_gem = page.find("##{gem}")
|
61
|
-
gpl_gem[:class].should == approval
|
62
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Given(/^I have an app with license finder that depends on a GPL licensed gem in the test bundler group$/) do
|
2
|
-
@user = ::DSL::User.new
|
3
|
-
@user.create_nonrails_app
|
4
|
-
@user.add_dependency_to_app 'gpl_gem', :license => 'GPL', :bundler_groups => 'test'
|
5
|
-
end
|
6
|
-
|
7
|
-
When(/^I add the test group to the ignored bundler groups$/) do
|
8
|
-
@user.execute_command('license_finder ignored_bundler_group add test')
|
9
|
-
end
|
10
|
-
|
11
|
-
When(/^I remove the test group from the ignored bundler groups$/) do
|
12
|
-
@user.execute_command('license_finder ignored_bundler_group remove test')
|
13
|
-
end
|
14
|
-
|
15
|
-
When(/^I get the ignored groups$/) do
|
16
|
-
@output = @user.execute_command('license_finder ignored_bundler_group list')
|
17
|
-
end
|
18
|
-
|
19
|
-
Then(/^I should not see the GPL licensed gem in the output$/) do
|
20
|
-
@output.should_not include 'gpl_gem'
|
21
|
-
end
|
22
|
-
|
23
|
-
Then(/^I should see the test group in the output$/) do
|
24
|
-
@output.should include 'test'
|
25
|
-
end
|
26
|
-
|
27
|
-
Then(/^I should not see the test group in the output$/) do
|
28
|
-
@output.should_not include 'test'
|
29
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Given(/^I have an app with license finder and a JS dependency$/) do
|
2
|
-
@user = ::DSL::User.new
|
3
|
-
@user.create_nonrails_app
|
4
|
-
@output = @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
|
-
@output = @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
|
-
@output = @user.execute_command 'license_finder dependencies add --approve MIT my_js_dep 1.2.3'
|
13
|
-
@output.should match /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
|
-
@output = @user.execute_command 'license_finder --quiet'
|
22
|
-
@output.should include '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
|
-
@output = @user.execute_command 'license_finder --quiet'
|
27
|
-
@output.should_not include 'my_js_dep, 1.2.3, MIT'
|
28
|
-
end
|
29
|
-
|
30
|
-
Then(/^I should not see the JS dependency in the console output since it is approved$/) do
|
31
|
-
@output = @user.execute_command 'license_finder --quiet'
|
32
|
-
@output.should_not include 'my_js_dep, 1.2.3, MIT'
|
33
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Given(/^I have an app with license finder that depends on an other licensed gem$/) do
|
2
|
-
@user = ::DSL::User.new
|
3
|
-
@user.create_nonrails_app
|
4
|
-
@user.add_dependency_to_app 'other_gem', version: '1.0', license: 'other'
|
5
|
-
@user.add_dependency_to_app 'control_gem', version: '1.0', license: 'other'
|
6
|
-
end
|
7
|
-
|
8
|
-
When(/^I set that gems 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
|
-
@output = @user.execute_command 'license_finder --quiet'
|
12
|
-
end
|
13
|
-
|
14
|
-
Then(/^I should see that other gems license set to MIT$/) do
|
15
|
-
@output.should include 'other_gem, 1.0, MIT'
|
16
|
-
end
|
17
|
-
|
18
|
-
Then(/^I see other licensed gems have not changed licenses$/) do
|
19
|
-
@output.should include 'control_gem, 1.0, other'
|
20
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Given(/^I have an app with license finder that depends on a gem with license and version details$/) do
|
2
|
-
@user = ::DSL::User.new
|
3
|
-
@user.create_nonrails_app
|
4
|
-
@user.add_dependency_to_app('info_gem', license: 'MIT', version: '1.1.1')
|
5
|
-
end
|
6
|
-
|
7
|
-
Given(/^I have a dependencies\.txt file$/) do
|
8
|
-
Dir.mkdir(@user.app_path("doc"))
|
9
|
-
File.open(@user.app_path("doc/dependencies.txt"), 'w+') { |file| file.puts("Legacy text file") }
|
10
|
-
end
|
11
|
-
|
12
|
-
Then(/^I should see those version and license details in the dependencies\.csv file$/) do
|
13
|
-
File.read(@user.app_path("doc/dependencies.csv")).should include "info_gem, 1.1.1, MIT"
|
14
|
-
end
|
15
|
-
|
16
|
-
Then(/^I should see dependencies\.txt replaced by dependencies\.csv$/) do
|
17
|
-
File.exists?(@user.app_path("doc/dependencies.txt")).should be_false
|
18
|
-
File.exists?(@user.app_path("doc/dependencies.csv")).should be_true
|
19
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
Given(/^I have an app with license finder that depends on an MIT license$/) do
|
2
|
-
@user = ::DSL::User.new
|
3
|
-
@user.create_nonrails_app
|
4
|
-
@user.add_dependency_to_app 'mit_gem', :license => 'MIT'
|
5
|
-
end
|
6
|
-
|
7
|
-
Given(/^I have an app with license finder that depends on an BSD license$/) do
|
8
|
-
@user = ::DSL::User.new
|
9
|
-
@user.create_nonrails_app
|
10
|
-
@user.add_dependency_to_app '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
|
-
@output = @user.execute_command 'license_finder whitelist list'
|
23
|
-
end
|
24
|
-
|
25
|
-
When(/^I remove Expat from the whitelist$/) do
|
26
|
-
@output = @user.execute_command 'license_finder whitelist remove Expat'
|
27
|
-
end
|
28
|
-
|
29
|
-
Then(/^I should not see a MIT licensed gem unapproved$/) do
|
30
|
-
@output = @user.execute_command 'license_finder --quiet'
|
31
|
-
@output.should_not include 'mit_gem'
|
32
|
-
end
|
33
|
-
|
34
|
-
Then(/^I should see Expat in the output$/) do
|
35
|
-
@output.should include 'Expat'
|
36
|
-
end
|
37
|
-
|
38
|
-
Then(/^I should not see Expat in the output$/) do
|
39
|
-
@output.should_not include 'Expat'
|
40
|
-
end
|
41
|
-
|
42
|
-
Then(/^I should not see a BSD licensed gem unapproved$/) do
|
43
|
-
@output = @user.execute_command 'license_finder --quiet'
|
44
|
-
@output.should_not include 'bsd_gem'
|
45
|
-
end
|
Binary file
|
data/files/report_breakdown.png
DELETED
Binary file
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module LicenseFinder
|
2
|
-
class LicenseAlias < Sequel::Model
|
3
|
-
def self.named(name)
|
4
|
-
find_or_create(name: name)
|
5
|
-
end
|
6
|
-
|
7
|
-
def initialize(*args)
|
8
|
-
super
|
9
|
-
self.url = LicenseUrl.find_by_name name
|
10
|
-
end
|
11
|
-
|
12
|
-
def whitelisted?
|
13
|
-
!!(config.whitelisted?(name))
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def config
|
19
|
-
LicenseFinder.config
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
describe LicenseUrl do
|
5
|
-
describe ".find_by_name" do
|
6
|
-
subject { LicenseUrl }
|
7
|
-
|
8
|
-
before do
|
9
|
-
License.stub(:find_by_name).with("Foo").
|
10
|
-
and_return(double(:foo_license, url: "http://foo.license.com"))
|
11
|
-
end
|
12
|
-
|
13
|
-
specify { subject.find_by_name("Foo").should == "http://foo.license.com" }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module LicenseFinder
|
4
|
-
describe LicenseAlias do
|
5
|
-
describe 'initializes' do
|
6
|
-
it "delegates to LicenseUrl.find_by_name for the url" do
|
7
|
-
LicenseUrl.stub(:find_by_name).with("MIT").and_return "http://license-url.com"
|
8
|
-
license = described_class.new(name: 'MIT')
|
9
|
-
license.url.should == "http://license-url.com"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#whitelisted?" do
|
14
|
-
let(:config) { Configuration.new('whitelist' => ['MIT', 'other']) }
|
15
|
-
|
16
|
-
before do
|
17
|
-
LicenseFinder.stub(:config).and_return config
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should return true when the license is whitelisted" do
|
21
|
-
described_class.new(name: 'MIT').should be_whitelisted
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should return true when the license is an alternative name of a whitelisted license" do
|
25
|
-
described_class.new(name: 'Expat').should be_whitelisted
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should return true when the license has no matching license class, but is whitelisted anyways" do
|
29
|
-
described_class.new(name: 'other').should be_whitelisted
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should return false when the license is not whitelisted" do
|
33
|
-
described_class.new(name: 'GPL').should_not be_whitelisted
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|