license_finder 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +8 -0
- data/features/cli.feature +11 -1
- data/features/html_report.feature +1 -1
- data/features/ignore_bundle_groups.feature +15 -2
- data/features/step_definitions/approve_dependencies_steps.rb +1 -1
- data/features/step_definitions/cli_steps.rb +17 -1
- data/features/step_definitions/html_report_steps.rb +1 -1
- data/features/step_definitions/ignore_bundle_groups_steps.rb +18 -2
- data/features/step_definitions/non_bundler_steps.rb +4 -4
- data/features/step_definitions/rails_rake_steps.rb +1 -1
- data/features/step_definitions/set_license_steps.rb +2 -2
- data/features/step_definitions/shared_steps.rb +4 -12
- data/features/step_definitions/whitelist_steps.rb +33 -2
- data/features/whitelist.feature +19 -1
- data/lib/license_finder.rb +4 -0
- data/lib/license_finder/bundle.rb +3 -1
- data/lib/license_finder/bundled_gem.rb +1 -1
- data/lib/license_finder/bundled_gem_saver.rb +35 -12
- data/lib/license_finder/cli.rb +75 -4
- data/lib/license_finder/configuration.rb +12 -5
- data/lib/license_finder/dependency_manager.rb +1 -2
- data/lib/license_finder/license/new_bsd.rb +19 -0
- data/license_finder.gemspec +3 -2
- data/readme.md +47 -1
- data/release.md +7 -2
- data/spec/lib/license_finder/bundled_gem_saver_spec.rb +131 -84
- data/spec/lib/license_finder/cli_spec.rb +78 -6
- data/spec/lib/license_finder/configuration_spec.rb +38 -6
- data/spec/lib/license_finder/dependency_manager_spec.rb +1 -1
- data/spec/lib/license_finder/license/new_bsd_spec.rb +28 -0
- data/spec/lib/license_finder_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20f8ab76aa0c6a0b12a159a4e177648106c9cd7b
|
4
|
+
data.tar.gz: e4a0d2d69fd8cbaeea45c300b676daa6b2a5399b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 822abefcd6d88446a2d178890691ebd0e696cc3572be07d70ff809b1fce088cc2b5eea9b6bfda8e390400f78f8cf69567e702001707696e5d3c55e2c4bb7e175
|
7
|
+
data.tar.gz: 42f08fc6c49d0ff7a408864e5c5fb7d49ca8119d4ec7832c573a1ed6eb59d13f50d02874c30a4baa6e967fdf4de1d59287536a017d48d9c0db411cf62d33c4b1
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
=== TBD
|
2
2
|
|
3
|
+
* Features
|
4
|
+
|
5
|
+
* Can maintain whitelisted licenses from command line
|
6
|
+
* Improve New BSD license detection
|
7
|
+
|
8
|
+
=== 0.8.2 / 2012-07-09
|
9
|
+
|
3
10
|
* Features
|
4
11
|
|
5
12
|
* Switch to thor for CLI, to support future additions to CLI
|
6
13
|
* Restore ability to manage (add/remove) dependencies that Bundler can't find
|
14
|
+
* Can maintain ignored bundler groups from command line
|
7
15
|
|
8
16
|
* Bugfixes
|
9
17
|
|
data/features/cli.feature
CHANGED
@@ -16,7 +16,7 @@ Feature: License Finder command line executable
|
|
16
16
|
|
17
17
|
Scenario: Auditing an application with whitelisted licenses
|
18
18
|
Given I have an app with license finder that depends on a MIT licensed gem
|
19
|
-
When I whitelist MIT and 'other' licenses
|
19
|
+
When I whitelist MIT and 'other' and New BSD licenses
|
20
20
|
Then it should exit with status code 0
|
21
21
|
And I should see all gems approved for use
|
22
22
|
|
@@ -24,3 +24,13 @@ Feature: License Finder command line executable
|
|
24
24
|
Given I have a project that depends on mime-types with a manual license type
|
25
25
|
When I run license_finder
|
26
26
|
Then the mime-types license remains set with my manual license type
|
27
|
+
|
28
|
+
Scenario: Viewing help for license_finder subcommand
|
29
|
+
Given I have an app with license finder
|
30
|
+
When I run license_finder help on a specific command
|
31
|
+
Then I should see the correct subcommand usage instructions
|
32
|
+
|
33
|
+
Scenario: Viewing help for license_finder default
|
34
|
+
Given I have an app with license finder
|
35
|
+
When I run license_finder help
|
36
|
+
Then I should the correct default usage instructions
|
@@ -19,5 +19,5 @@ Feature: HTML Report
|
|
19
19
|
|
20
20
|
Scenario: Dependency summary
|
21
21
|
And my app depends on MIT and GPL licensed gems
|
22
|
-
When I whitelist MIT and 'other' licenses
|
22
|
+
When I whitelist MIT and 'other' and New BSD licenses
|
23
23
|
Then I should see only see GPL liceneses as unapproved in the html
|
@@ -3,8 +3,21 @@ Feature: Ignore Bundle Groups
|
|
3
3
|
I want to ignore certain bundler groups
|
4
4
|
So that any gems I use in development, or for testing, are automatically approved for use
|
5
5
|
|
6
|
-
Scenario:
|
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
|
7
13
|
Given I have an app with license finder that depends on a GPL licensed gem in the test bundler group
|
8
|
-
And I
|
14
|
+
And I add the test group to the ignored bundler groups
|
9
15
|
When I run license_finder
|
10
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
|
@@ -8,7 +8,7 @@ When(/^I approve that gem$/) do
|
|
8
8
|
@output = @user.execute_command "license_finder"
|
9
9
|
@output.should include "gpl_gem"
|
10
10
|
@output = @user.execute_command "license_finder approve gpl_gem"
|
11
|
-
@output = @user.execute_command "license_finder
|
11
|
+
@output = @user.execute_command "license_finder --quiet"
|
12
12
|
end
|
13
13
|
|
14
14
|
Then(/^I should not see that gem in the console output$/) do
|
@@ -17,11 +17,19 @@ Given(/^I have a project that depends on mime\-types with a manual license type$
|
|
17
17
|
@user.create_rails_app
|
18
18
|
@user.add_gem_dependency('mime-types')
|
19
19
|
@user.bundle_app
|
20
|
-
@user.execute_command "license_finder
|
20
|
+
@user.execute_command "license_finder --quiet"
|
21
21
|
@output = @user.execute_command "license_finder license Ruby mime-types"
|
22
22
|
@output.should =~ /mime-types.*Ruby/
|
23
23
|
end
|
24
24
|
|
25
|
+
When(/^I run license_finder help on a specific command$/) do
|
26
|
+
@output = @user.execute_command "license_finder dependencies help add"
|
27
|
+
end
|
28
|
+
|
29
|
+
When(/^I run license_finder help$/) do
|
30
|
+
@output = @user.execute_command "license_finder help"
|
31
|
+
end
|
32
|
+
|
25
33
|
Then(/^it creates a config directory with the license_finder config$/) do
|
26
34
|
File.should be_exists(@user.app_path('config'))
|
27
35
|
text = "---\nwhitelist:\n#- MIT\n#- Apache 2.0\nignore_groups:\n#- test\n#- development\ndependencies_file_dir: './doc/'\n"
|
@@ -43,3 +51,11 @@ end
|
|
43
51
|
Then(/^the mime\-types license remains set with my manual license type$/) do
|
44
52
|
@output.should =~ /mime-types.*Ruby/
|
45
53
|
end
|
54
|
+
|
55
|
+
Then(/^I should see the correct subcommand usage instructions$/) do
|
56
|
+
@output.should include 'license_finder dependencies add LICENSE'
|
57
|
+
end
|
58
|
+
|
59
|
+
Then(/^I should the correct default usage instructions$/) do
|
60
|
+
@output.should include 'license_finder help [COMMAND]'
|
61
|
+
end
|
@@ -25,7 +25,7 @@ end
|
|
25
25
|
|
26
26
|
When(/^I whitelist the MIT license$/) do
|
27
27
|
@user.configure_license_finder_whitelist ["MIT"]
|
28
|
-
@user.execute_command "license_finder
|
28
|
+
@user.execute_command "license_finder --quiet"
|
29
29
|
end
|
30
30
|
|
31
31
|
Then(/^I should see my specific gem details listed in the html$/) do
|
@@ -4,10 +4,26 @@ Given(/^I have an app with license finder that depends on a GPL licensed gem in
|
|
4
4
|
@user.add_dependency_to_app 'gpl_gem', :license => 'GPL', :bundler_groups => 'test'
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
@user.
|
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')
|
9
17
|
end
|
10
18
|
|
11
19
|
Then(/^I should not see the GPL licensed gem in the output$/) do
|
12
20
|
@output.should_not include 'gpl_gem'
|
13
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
|
@@ -9,7 +9,7 @@ When(/^I add my JS dependency$/) do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
When(/^I add my JS dependency with an approval flag$/) do
|
12
|
-
@output = @user.execute_command 'license_finder dependencies add
|
12
|
+
@output = @user.execute_command 'license_finder dependencies add --approve MIT my_js_dep 1.2.3'
|
13
13
|
@output.should == "The my_js_dep dependency has been added and approved!\n"
|
14
14
|
end
|
15
15
|
|
@@ -18,16 +18,16 @@ When(/^I remove my JS dependency$/) do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
Then(/^I should see the JS dependency in the console output$/) do
|
21
|
-
@output = @user.execute_command 'license_finder
|
21
|
+
@output = @user.execute_command 'license_finder --quiet'
|
22
22
|
@output.should include 'my_js_dep, 1.2.3, MIT'
|
23
23
|
end
|
24
24
|
|
25
25
|
Then(/^I should not see the JS dependency in the console output$/) do
|
26
|
-
@output = @user.execute_command 'license_finder
|
26
|
+
@output = @user.execute_command 'license_finder --quiet'
|
27
27
|
@output.should_not include 'my_js_dep, 1.2.3, MIT'
|
28
28
|
end
|
29
29
|
|
30
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
|
31
|
+
@output = @user.execute_command 'license_finder --quiet'
|
32
32
|
@output.should_not include 'my_js_dep, 1.2.3, MIT'
|
33
33
|
end
|
@@ -4,7 +4,7 @@ Given /^I have a rails app(?:lication)? with license finder$/ do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
When(/^I run rake license_finder$/) do
|
7
|
-
@output = @user.execute_command "rake license_finder
|
7
|
+
@output = @user.execute_command "rake license_finder --quiet"
|
8
8
|
end
|
9
9
|
|
10
10
|
Then(/^I should see a normal output$/) do
|
@@ -6,9 +6,9 @@ Given(/^I have an app with license finder that depends on an other licensed gem$
|
|
6
6
|
end
|
7
7
|
|
8
8
|
When(/^I set that gems license to MIT from the command line$/) do
|
9
|
-
@output = @user.execute_command 'license_finder
|
9
|
+
@output = @user.execute_command 'license_finder --quiet'
|
10
10
|
@output = @user.execute_command 'license_finder license MIT other_gem'
|
11
|
-
@output = @user.execute_command 'license_finder
|
11
|
+
@output = @user.execute_command 'license_finder --quiet'
|
12
12
|
end
|
13
13
|
|
14
14
|
Then(/^I should see that other gems license set to MIT$/) do
|
@@ -11,12 +11,12 @@ Given(/^I have an app with license finder$/) do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
When(/^I run license_finder$/) do
|
14
|
-
@output = @user.execute_command "license_finder
|
14
|
+
@output = @user.execute_command "license_finder --quiet"
|
15
15
|
end
|
16
16
|
|
17
|
-
When(/^I whitelist MIT and 'other' licenses$/) do
|
18
|
-
@user.configure_license_finder_whitelist ["MIT","other"]
|
19
|
-
@output = @user.execute_command "license_finder
|
17
|
+
When(/^I whitelist MIT and 'other' and New BSD licenses$/) do
|
18
|
+
@user.configure_license_finder_whitelist ["MIT","other","New BSD"]
|
19
|
+
@output = @user.execute_command "license_finder --quiet"
|
20
20
|
end
|
21
21
|
|
22
22
|
module DSL
|
@@ -108,14 +108,6 @@ module DSL
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def configure_license_finder_bundler_ignore_groups(ignored_groups=[])
|
112
|
-
ignored_groups = Array ignored_groups
|
113
|
-
FileUtils.mkdir_p(config_path)
|
114
|
-
File.open(File.join(config_path, "license_finder.yml"), "w") do |f|
|
115
|
-
f.write({'ignore_groups' => ignored_groups}.to_yaml)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
111
|
def execute_command(command)
|
120
112
|
Bundler.with_clean_env do
|
121
113
|
@output = `cd #{app_path} && bundle exec #{command}`
|
@@ -4,11 +4,42 @@ Given(/^I have an app with license finder that depends on an MIT license$/) do
|
|
4
4
|
@user.add_dependency_to_app 'mit_gem', :license => 'MIT'
|
5
5
|
end
|
6
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
|
+
|
7
17
|
When(/^I whitelist the Expat license$/) do
|
8
|
-
@user.
|
9
|
-
|
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'
|
10
27
|
end
|
11
28
|
|
12
29
|
Then(/^I should not see a MIT licensed gem unapproved$/) do
|
30
|
+
@output = @user.execute_command 'license_finder --quiet'
|
13
31
|
@output.should_not include 'mit_gem'
|
14
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
|
data/features/whitelist.feature
CHANGED
@@ -3,7 +3,25 @@ Feature: Whitelist licenses
|
|
3
3
|
I want to whitelist certain OSS licenses that my business has pre-approved
|
4
4
|
So that any dependencies with those licenses do not show up as action items
|
5
5
|
|
6
|
-
Scenario:
|
6
|
+
Scenario: Adding a license to the whitelist
|
7
|
+
Given I have an app with license finder
|
8
|
+
When I whitelist the Expat license
|
9
|
+
And I view the whitelisted licenses
|
10
|
+
Then I should see Expat in the output
|
11
|
+
|
12
|
+
Scenario: Whitelisting the BSD License should approve BSD licensed dependencies
|
13
|
+
Given I have an app with license finder that depends on an BSD license
|
14
|
+
When I whitelist the BSD license
|
15
|
+
Then I should not see a BSD licensed gem unapproved
|
16
|
+
|
17
|
+
Scenario: Removing a license from the whitelist
|
18
|
+
Given I have an app with license finder
|
19
|
+
When I whitelist the Expat license
|
20
|
+
And I remove Expat from the whitelist
|
21
|
+
And I view the whitelisted licenses
|
22
|
+
Then I should not see Expat in the output
|
23
|
+
|
24
|
+
Scenario: Whitelist with MIT License aliased name "Expat" should whitelist "MIT" licenses
|
7
25
|
Given I have an app with license finder that depends on an MIT license
|
8
26
|
When I whitelist the Expat license
|
9
27
|
Then I should not see a MIT licensed gem unapproved
|
data/lib/license_finder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "bundler"
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class Bundle
|
3
5
|
attr_writer :ignore_groups
|
@@ -34,7 +36,7 @@ module LicenseFinder
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def included_groups
|
37
|
-
definition.groups - ignore_groups
|
39
|
+
definition.groups - ignore_groups.map(&:to_sym)
|
38
40
|
end
|
39
41
|
|
40
42
|
def gemfile_path
|
@@ -4,7 +4,9 @@ module LicenseFinder
|
|
4
4
|
def_delegators :spec, :name, :version, :summary, :description, :homepage
|
5
5
|
def_delegators :bundled_gem, :bundler_dependency, :determine_license, :children
|
6
6
|
|
7
|
-
|
7
|
+
attr_reader :dependency, :bundled_gem
|
8
|
+
|
9
|
+
def self.find_or_create_by_name(name, bundled_gem)
|
8
10
|
dependency = Dependency.named(name)
|
9
11
|
new(dependency, bundled_gem)
|
10
12
|
end
|
@@ -26,19 +28,27 @@ module LicenseFinder
|
|
26
28
|
|
27
29
|
private
|
28
30
|
|
29
|
-
attr_reader :dependency, :bundled_gem
|
30
|
-
|
31
31
|
def spec
|
32
32
|
bundled_gem.spec
|
33
33
|
end
|
34
34
|
|
35
35
|
def apply_dependency_definition
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
if values_have_changed?
|
37
|
+
dependency.version = version.to_s
|
38
|
+
dependency.summary = summary
|
39
|
+
dependency.description = description
|
40
|
+
dependency.homepage = homepage
|
41
|
+
dependency.license ||= LicenseAlias.create(name: determine_license)
|
42
|
+
dependency.save
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def values_have_changed?
|
47
|
+
return dependency.version != version.to_s ||
|
48
|
+
dependency.summary != summary ||
|
49
|
+
dependency.description != description ||
|
50
|
+
dependency.homepage != homepage ||
|
51
|
+
dependency.license.name != determine_license
|
42
52
|
end
|
43
53
|
|
44
54
|
def refresh_bundler_groups
|
@@ -53,14 +63,27 @@ module LicenseFinder
|
|
53
63
|
def refresh_children
|
54
64
|
dependency.remove_all_children
|
55
65
|
children.each do |child|
|
56
|
-
|
66
|
+
if child_required?(child)
|
67
|
+
dependency.add_child Dependency.named(child)
|
68
|
+
end
|
57
69
|
end
|
58
70
|
end
|
59
71
|
|
72
|
+
def child_required?(child)
|
73
|
+
current_gem_names.include?(child)
|
74
|
+
end
|
75
|
+
|
76
|
+
def current_gem_names
|
77
|
+
@current_gem_names ||= LicenseFinder.current_gems.map { |gem| gem.name.split(" ")[0] }
|
78
|
+
end
|
79
|
+
|
60
80
|
def apply_better_license
|
61
81
|
if dependency.license && !dependency.license.manual && determine_license != 'other'
|
62
|
-
|
63
|
-
dependency.license.
|
82
|
+
new_name = determine_license
|
83
|
+
unless new_name == dependency.license.name
|
84
|
+
dependency.license.name = new_name
|
85
|
+
dependency.license.save
|
86
|
+
end
|
64
87
|
end
|
65
88
|
end
|
66
89
|
end
|
data/lib/license_finder/cli.rb
CHANGED
@@ -19,8 +19,17 @@ module LicenseFinder
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
# Thor fix for `license_finder <subcommand> help <action>`
|
23
|
+
class Subcommand < Base
|
24
|
+
# Hack to override the help message produced by Thor.
|
25
|
+
# https://github.com/wycats/thor/issues/261#issuecomment-16880836
|
26
|
+
def self.banner(command, namespace = nil, subcommand = nil)
|
27
|
+
"#{basename} #{name.split("::").last.downcase} #{command.usage}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Dependencies < Subcommand
|
32
|
+
option :approve, type: :boolean, desc: "Approve the added dependency"
|
24
33
|
desc "add LICENSE DEPENDENCY_NAME [VERSION] [--approve]", "Add a dependency that is not managed by Bundler"
|
25
34
|
def add(license, name, version = nil)
|
26
35
|
die_on_error {
|
@@ -44,9 +53,69 @@ module LicenseFinder
|
|
44
53
|
end
|
45
54
|
end
|
46
55
|
|
56
|
+
class Whitelist < Subcommand
|
57
|
+
desc "list", "List all the whitelisted licenses"
|
58
|
+
def list
|
59
|
+
whitelist = LicenseFinder.config.whitelist
|
60
|
+
|
61
|
+
say "Whitelisted Licenses:", :blue
|
62
|
+
whitelist.each do |license|
|
63
|
+
say license
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "add", "Add a license to the whitelist"
|
68
|
+
def add(license)
|
69
|
+
die_on_error {
|
70
|
+
LicenseFinder.config.whitelist.push(license)
|
71
|
+
LicenseFinder.config.save
|
72
|
+
}
|
73
|
+
say "Added #{license} to the license whitelist"
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "remove", "Remove a license from the whitelist"
|
77
|
+
def remove(license)
|
78
|
+
die_on_error {
|
79
|
+
LicenseFinder.config.whitelist.delete(license)
|
80
|
+
LicenseFinder.config.save
|
81
|
+
}
|
82
|
+
say "Removed #{license} from the license whitelist"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class IgnoredBundlerGroups < Subcommand
|
87
|
+
desc "list", "List all the ignored bundler groups"
|
88
|
+
def list
|
89
|
+
ignored = LicenseFinder.config.ignore_groups
|
90
|
+
|
91
|
+
say "Ignored Bundler Groups:", :blue
|
92
|
+
ignored.each do |group|
|
93
|
+
say group
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "add", "Add a bundler group to be ignored"
|
98
|
+
def add(group)
|
99
|
+
die_on_error {
|
100
|
+
LicenseFinder.config.ignore_groups.push(group)
|
101
|
+
LicenseFinder.config.save
|
102
|
+
}
|
103
|
+
say "Added #{group} to the ignored bundler groups"
|
104
|
+
end
|
105
|
+
|
106
|
+
desc "remove", "Remove a bundler group from the ignored bundler groups"
|
107
|
+
def remove(group)
|
108
|
+
die_on_error {
|
109
|
+
LicenseFinder.config.ignore_groups.delete(group)
|
110
|
+
LicenseFinder.config.save
|
111
|
+
}
|
112
|
+
say "Removed #{group} from the ignored bundler groups"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
47
116
|
class Main < Base
|
48
|
-
option :quiet, type: :boolean,
|
49
|
-
desc "rescan", "Find new dependencies."
|
117
|
+
option :quiet, type: :boolean, desc: "silences loading output"
|
118
|
+
desc "rescan", "Find new dependencies. (Default action)"
|
50
119
|
def rescan
|
51
120
|
die_on_error {
|
52
121
|
spinner {
|
@@ -96,6 +165,8 @@ module LicenseFinder
|
|
96
165
|
end
|
97
166
|
|
98
167
|
subcommand "dependencies", Dependencies, "manage non-Bundler dependencies"
|
168
|
+
subcommand "ignored_bundler_groups", IgnoredBundlerGroups, "manage ignored bundler groups"
|
169
|
+
subcommand "whitelist", Whitelist, "manage whitelisted licenses"
|
99
170
|
|
100
171
|
private
|
101
172
|
|