license_finder 0.8.0-java → 0.8.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +98 -0
- data/bin/license_finder +13 -2
- data/features/approve_dependencies.feature +4 -8
- data/features/cli.feature +26 -0
- data/features/html_report.feature +10 -25
- data/features/ignore_bundle_groups.feature +4 -5
- data/features/rails_rake.feature +3 -3
- data/features/set_license.feature +3 -6
- data/features/step_definitions/approve_dependencies_steps.rb +25 -0
- data/features/step_definitions/cli_steps.rb +45 -0
- data/features/step_definitions/html_report_steps.rb +67 -0
- data/features/step_definitions/ignore_bundle_groups_steps.rb +13 -0
- data/features/step_definitions/rails_rake_steps.rb +12 -0
- data/features/step_definitions/set_license_steps.rb +16 -0
- data/features/step_definitions/shared_steps.rb +203 -0
- data/features/step_definitions/text_report_steps.rb +9 -0
- data/features/step_definitions/whitelist_steps.rb +14 -0
- data/features/text_report.feature +3 -21
- data/features/whitelist.feature +3 -18
- data/license_finder.gemspec +3 -2
- data/readme.md +10 -0
- data/release.md +17 -0
- metadata +31 -19
- data/features/license_finder.feature +0 -47
- data/features/license_finder_rake_task.feature +0 -37
- data/features/step_definitions/license_finder_steps.rb +0 -25
- data/features/step_definitions/steps.rb +0 -376
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
=== 0.8.1 / 2013-04-14
|
2
|
+
|
3
|
+
* Features
|
4
|
+
|
5
|
+
* Add spinner to show that the binary is actually doing something.
|
6
|
+
* JRuby version of the gem.
|
7
|
+
* Official ruby 2.0 support.
|
8
|
+
* CLI interface for moving dependencies.* files to `doc/`.
|
9
|
+
|
10
|
+
* Bugfixes
|
11
|
+
|
12
|
+
* Fix ruby 1.9.2 support.
|
13
|
+
|
14
|
+
=== 0.8.0 / 2013-04-03
|
15
|
+
|
16
|
+
* Features
|
17
|
+
|
18
|
+
* Add spinner to show that the binary is actually doing something.
|
19
|
+
* Add action items to dependencies.html.
|
20
|
+
* Add generation timestamp to dependencies.html.
|
21
|
+
* Default location for dependencies.* files is now `doc/`.
|
22
|
+
* Temporarily remove non-bundler (e.g. JavaScript) dependencies. This will
|
23
|
+
be readded in a more sustainable way soon.
|
24
|
+
* Use sqlite, not YAML, for dependencies.
|
25
|
+
* Officially deprecate rake tasks.
|
26
|
+
|
27
|
+
* Bugfixes
|
28
|
+
|
29
|
+
* Don't blow away manually set licenses when dependencies are rescanned.
|
30
|
+
* Ignore empty `readme_files` section in dependencies.yml.
|
31
|
+
* Clean up HTML generation for dependencies.html.
|
32
|
+
* Add an option to silence the binary's spinner so as not to fill up log
|
33
|
+
files.
|
34
|
+
|
35
|
+
=== 0.7.2 / 2013-02-18
|
36
|
+
|
37
|
+
* Features
|
38
|
+
|
39
|
+
* Dependency cleanup.
|
40
|
+
|
41
|
+
=== 0.7.1 / 2013-02-18
|
42
|
+
|
43
|
+
* Features
|
44
|
+
|
45
|
+
* Add variants to detectable licenses.
|
46
|
+
* Remove README files from data persistence.
|
47
|
+
|
48
|
+
=== 0.7.0 / 2012-09-25
|
49
|
+
|
50
|
+
* Features
|
51
|
+
|
52
|
+
* Dependencies can be approved via CLI.
|
53
|
+
* Dependencies licenses can be set via CLI.
|
54
|
+
|
55
|
+
=== 0.6.0 / 2012-09-15
|
56
|
+
|
57
|
+
* Features
|
58
|
+
|
59
|
+
* Create a dependencies.html containing a nicely formatted version of
|
60
|
+
dependencies.txt, with lots of extra information.
|
61
|
+
* All rake tasks, and the binary, run the init task automatically.
|
62
|
+
* Simplify dependencies.txt file since more detail can now go into
|
63
|
+
dependencies.html.
|
64
|
+
* Promote binary to be the default, take first steps to deprecate rake task.
|
65
|
+
|
66
|
+
* Bugfixes
|
67
|
+
|
68
|
+
* Fix formatting of `rake license:action_items` output.
|
69
|
+
|
70
|
+
=== 0.5.0 / 2012-09-12
|
71
|
+
|
72
|
+
* Features
|
73
|
+
|
74
|
+
* `rake license:action_items` exits with a non-zero status if there are
|
75
|
+
non-approved dependencies.
|
76
|
+
* New binary, eventual replacement for rake tasks.
|
77
|
+
* Initial implementation of non-gem dependencies.
|
78
|
+
* Support BSD, New BSD, and Simplified BSD licenses.
|
79
|
+
* Improve ruby license detection.
|
80
|
+
* Add dependency's bundler group to dependencies.txt output.
|
81
|
+
* Add description and summary to dependencies.txt output.
|
82
|
+
|
83
|
+
* Bugfixes
|
84
|
+
|
85
|
+
* Create `config/` director if it doesn't exist, don't blow up.
|
86
|
+
* Better support for non-US word spellings.
|
87
|
+
|
88
|
+
=== 0.4.5 / 2012-09-09
|
89
|
+
|
90
|
+
* Features
|
91
|
+
|
92
|
+
* Allow dependencies.* files to be written to a custom directory.
|
93
|
+
* Detect LGPL licenses
|
94
|
+
* Detect ISC licenses
|
95
|
+
|
96
|
+
* Bugfixes
|
97
|
+
|
98
|
+
* Fix blow up if there's not `ignore_groups` setting in the config file.
|
data/bin/license_finder
CHANGED
@@ -28,6 +28,7 @@ end
|
|
28
28
|
|
29
29
|
options = {}
|
30
30
|
spinner = SpinnerStrategy::Spin
|
31
|
+
skip = false
|
31
32
|
|
32
33
|
OptionParser.new do |opts|
|
33
34
|
opts.banner = "Usage: license_finder [options] [dependency]"
|
@@ -43,6 +44,16 @@ OptionParser.new do |opts|
|
|
43
44
|
opts.on("-q", "--quiet") do
|
44
45
|
spinner = SpinnerStrategy::Noop
|
45
46
|
end
|
47
|
+
|
48
|
+
opts.on("-m", "--move") do
|
49
|
+
skip = true
|
50
|
+
`sed '$d' < config/license_finder.yml > tmp34567.txt`
|
51
|
+
`mv tmp34567.txt config/license_finder.yml`
|
52
|
+
`echo "dependencies_file_dir: './doc/'" >> config/license_finder.yml`
|
53
|
+
`mkdir doc`
|
54
|
+
`mv dependencies.* doc/`
|
55
|
+
puts "Congratulations, you have cleaned up your root directory!'"
|
56
|
+
end
|
46
57
|
end.parse!
|
47
58
|
|
48
59
|
unless options.empty?
|
@@ -50,5 +61,5 @@ unless options.empty?
|
|
50
61
|
end
|
51
62
|
|
52
63
|
spinner.run {
|
53
|
-
LicenseFinder::CLI.execute!
|
54
|
-
}
|
64
|
+
LicenseFinder::CLI.execute!(options)
|
65
|
+
} unless skip
|
@@ -4,11 +4,7 @@ Feature: Approving non-whitelisted Dependencies
|
|
4
4
|
I want to be able to manually approve dependencies that have licenses which fall outside of my whitelist
|
5
5
|
|
6
6
|
Scenario: Approving a non-whitelisted dependency via the `license_finder` command
|
7
|
-
Given I have an app with license finder
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
When I run "license_finder -a gpl_gem"
|
12
|
-
When I run "license_finder"
|
13
|
-
Then I should not see "gpl_gem" in its output
|
14
|
-
Then I should see the "gpl_gem" in the html flagged as "approved"
|
7
|
+
Given I have an app with license finder that depends on a GPL licensed gem
|
8
|
+
When I approve that gem
|
9
|
+
Then I should not see that gem in the console output
|
10
|
+
And I should see that gem approved in dependencies.html
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Feature: License Finder command line executable
|
2
|
+
So that I can report and manage my application's dependencies and licenses to my business
|
3
|
+
As an application developer
|
4
|
+
I want a command-line interface
|
5
|
+
|
6
|
+
Scenario: Running without a configuration file
|
7
|
+
Given I have an app with license finder that has no config directory
|
8
|
+
When I run license_finder
|
9
|
+
Then it creates a config directory with the license_finder config
|
10
|
+
|
11
|
+
Scenario: Auditing an application with non-whitelisted licenses
|
12
|
+
Given I have an app with license finder that depends on a MIT licensed gem
|
13
|
+
When I run license_finder
|
14
|
+
Then it should exit with status code 1
|
15
|
+
And should list my MIT gem in the output
|
16
|
+
|
17
|
+
Scenario: Auditing an application with whitelisted licenses
|
18
|
+
Given I have an app with license finder that depends on a MIT licensed gem
|
19
|
+
When I whitelist MIT and 'other' licenses
|
20
|
+
Then it should exit with status code 0
|
21
|
+
And I should see all gems approved for use
|
22
|
+
|
23
|
+
Scenario: Keep manually set license dependencies
|
24
|
+
Given I have a project that depends on mime-types with a manual license type
|
25
|
+
When I run license_finder
|
26
|
+
Then the mime-types license remains set with my manual license type
|
@@ -7,32 +7,17 @@ Feature: HTML Report
|
|
7
7
|
Given I have an app with license finder
|
8
8
|
|
9
9
|
Scenario: Dependency details listed in HTML report
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
When I run "license_finder"
|
14
|
-
And I should see the "mit_licensed_gem" in the html with the following details:
|
15
|
-
| license | summary | description | name | bundler_groups |
|
16
|
-
| MIT | mit is cool | seriously | mit_licensed_gem v0.0.1 | test |
|
17
|
-
And the text "MIT" should link to "http://opensource.org/licenses/mit-license"
|
18
|
-
And the text "mit_licensed_gem" should link to "http://mit_licensed_gem.github.com"
|
10
|
+
And my app depends on a gem with specific details
|
11
|
+
When I run license_finder
|
12
|
+
Then I should see my specific gem details listed in the html
|
19
13
|
|
20
14
|
Scenario: Approval status of dependencies indicated in HTML report
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
Then I should see the "gpl_licensed_gem" in the html flagged as "unapproved"
|
26
|
-
And I should see the "mit_licensed_gem" in the html flagged as "approved"
|
15
|
+
And my app depends on MIT and GPL licensed gems
|
16
|
+
When I whitelist the MIT license
|
17
|
+
Then I should see the GPL gem unapproved in html
|
18
|
+
And the MIT gem approved in html
|
27
19
|
|
28
20
|
Scenario: Dependency summary
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
When I run "license_finder"
|
33
|
-
# rake, bundler, license_finder, my_app, gpl_licensed_gem, mit_licensed_gem
|
34
|
-
Then I should see "8 total" in the html
|
35
|
-
# gpl_licensed_gem
|
36
|
-
And I should see "1 unapproved" in the html
|
37
|
-
# gpl_licensed_gem
|
38
|
-
And I should see "1 GPL" in the html
|
21
|
+
And my app depends on MIT and GPL licensed gems
|
22
|
+
When I whitelist MIT and 'other' licenses
|
23
|
+
Then I should see only see GPL liceneses as unapproved in the html
|
@@ -4,8 +4,7 @@ Feature: Ignore Bundle Groups
|
|
4
4
|
So that any gems I use in development, or for testing, are automatically approved for use
|
5
5
|
|
6
6
|
Scenario:
|
7
|
-
Given I have an app with license finder
|
8
|
-
And
|
9
|
-
|
10
|
-
|
11
|
-
Then I should not see "gpl_gem" in its output
|
7
|
+
Given I have an app with license finder that depends on a GPL licensed gem in the test bundler group
|
8
|
+
And I ignore the test group
|
9
|
+
When I run license_finder
|
10
|
+
Then I should not see the GPL licensed gem in the output
|
data/features/rails_rake.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: The rake task is automatically made available in Rails project
|
|
3
3
|
As an application developer
|
4
4
|
I want the license_finder rake task automatically loaded for me in a rails project
|
5
5
|
|
6
|
-
Scenario: The application is a Rails app
|
6
|
+
Scenario: The application is a Rails app #THIS FEATURE SHOULD BE REMOVED FOR 1.0.0 release
|
7
7
|
Given I have a rails app with license finder
|
8
|
-
When I run
|
9
|
-
Then I should see
|
8
|
+
When I run rake license_finder
|
9
|
+
Then I should see a normal output
|
@@ -4,9 +4,6 @@ Feature: Set a dependency's license through a command line interface
|
|
4
4
|
I want a command line interface to set licenses for specific dependencies
|
5
5
|
|
6
6
|
Scenario: Setting a license for a dependency
|
7
|
-
Given I have an app with license finder
|
8
|
-
|
9
|
-
|
10
|
-
When I run "license_finder -l MIT other_license_gem"
|
11
|
-
And I run license_finder again
|
12
|
-
Then I should see other_license_gem set to MIT license
|
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
|
@@ -0,0 +1,25 @@
|
|
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 -a gpl_gem"
|
11
|
+
@output = @user.execute_command "license_finder -q"
|
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
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Given(/^I have an app with license finder that has no config directory$/) do
|
2
|
+
@user = ::DSL::User.new
|
3
|
+
@user.create_nonrails_app
|
4
|
+
path = @user.app_path('config')
|
5
|
+
FileUtils.rm_rf(path)
|
6
|
+
File.should_not be_exists(path)
|
7
|
+
end
|
8
|
+
|
9
|
+
Given(/^I have an app with license finder that depends on a MIT licensed gem$/) do
|
10
|
+
@user = ::DSL::User.new
|
11
|
+
@user.create_nonrails_app
|
12
|
+
@user.add_dependency_to_app 'mit_gem', :license => 'MIT'
|
13
|
+
end
|
14
|
+
|
15
|
+
Given(/^I have a project that depends on mime\-types with a manual license type$/) do
|
16
|
+
@user = ::DSL::User.new
|
17
|
+
@user.create_rails_app
|
18
|
+
@user.add_gem_dependency('mime-types')
|
19
|
+
@user.bundle_app
|
20
|
+
@user.execute_command "license_finder -q"
|
21
|
+
@output = @user.execute_command "license_finder -l Ruby mime-types"
|
22
|
+
@output.should =~ /mime-types.*Ruby/
|
23
|
+
end
|
24
|
+
|
25
|
+
Then(/^it creates a config directory with the license_finder config$/) do
|
26
|
+
File.should be_exists(@user.app_path('config'))
|
27
|
+
text = "---\nwhitelist:\n#- MIT\n#- Apache 2.0\nignore_groups:\n#- test\n#- development\ndependencies_file_dir: './doc/'\n"
|
28
|
+
File.read(@user.app_path('config/license_finder.yml')).should == text.gsub(/^\s+/, "")
|
29
|
+
end
|
30
|
+
|
31
|
+
Then /^it should exit with status code (\d)$/ do |status|
|
32
|
+
$?.exitstatus.should == status.to_i
|
33
|
+
end
|
34
|
+
|
35
|
+
Then(/^should list my MIT gem in the output$/) do
|
36
|
+
@output.should include 'mit_gem'
|
37
|
+
end
|
38
|
+
|
39
|
+
Then(/^I should see all gems approved for use$/) do
|
40
|
+
@output.should include 'All gems are approved for use'
|
41
|
+
end
|
42
|
+
|
43
|
+
Then(/^the mime\-types license remains set with my manual license type$/) do
|
44
|
+
@output.should =~ /mime-types.*Ruby/
|
45
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
Given(/^I have an app with license finder$/) do
|
2
|
+
@user = ::DSL::User.new
|
3
|
+
@user.create_nonrails_app
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^my app depends on a gem with specific details$/) do
|
7
|
+
@gem_name = "mit_licensed_gem"
|
8
|
+
@table = {
|
9
|
+
license: "MIT",
|
10
|
+
summary: "mit is cool",
|
11
|
+
description: "seriously",
|
12
|
+
version: "0.0.1",
|
13
|
+
homepage: "http://mit_licensed_gem.github.com",
|
14
|
+
bundler_groups: "test"
|
15
|
+
}
|
16
|
+
@user.add_dependency_to_app(@gem_name,
|
17
|
+
:license => @table[:license],
|
18
|
+
:summary => @table[:summary],
|
19
|
+
:description => @table[:description],
|
20
|
+
:version => @table[:version],
|
21
|
+
:homepage => @table[:homepage],
|
22
|
+
:bundler_groups => @table[:bundler_groups]
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
Given(/^my app depends on MIT and GPL licensed gems$/) do
|
27
|
+
@user.add_dependency_to_app 'gpl_licensed_gem', :license => "GPL"
|
28
|
+
@user.add_dependency_to_app 'mit_licensed_gem', :license => "MIT"
|
29
|
+
end
|
30
|
+
|
31
|
+
When(/^I whitelist the MIT license$/) do
|
32
|
+
@user.configure_license_finder_whitelist ["MIT"]
|
33
|
+
@user.execute_command "license_finder -q"
|
34
|
+
end
|
35
|
+
|
36
|
+
Then(/^I should see my specific gem details listed in the html$/) do
|
37
|
+
html = File.read(@user.dependencies_html_path)
|
38
|
+
page = Capybara.string(html)
|
39
|
+
section = page.find("##{@gem_name}")
|
40
|
+
|
41
|
+
@table.first.each do |property_name, property_value|
|
42
|
+
section.should have_content property_value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Then(/^I should see the GPL gem unapproved in html$/) do
|
47
|
+
is_html_status?('gpl_licensed_gem', 'unapproved')
|
48
|
+
end
|
49
|
+
|
50
|
+
Then(/^the MIT gem approved in html$/) do
|
51
|
+
is_html_status?('mit_licensed_gem', 'approved')
|
52
|
+
end
|
53
|
+
|
54
|
+
Then(/^I should see only see GPL liceneses as unapproved in the html$/) do
|
55
|
+
html = File.read(@user.dependencies_html_path)
|
56
|
+
page = Capybara.string(html)
|
57
|
+
page.should have_content '8 total'
|
58
|
+
page.should have_content '1 unapproved'
|
59
|
+
page.should have_content '1 GPL'
|
60
|
+
end
|
61
|
+
|
62
|
+
def is_html_status?(gem, approval)
|
63
|
+
html = File.read(@user.dependencies_html_path)
|
64
|
+
page = Capybara.string(html)
|
65
|
+
gpl_gem = page.find("##{gem}")
|
66
|
+
gpl_gem[:class].should == approval
|
67
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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
|
+
And(/^I ignore the test group$/) do
|
8
|
+
@user.configure_license_finder_bundler_whitelist('test')
|
9
|
+
end
|
10
|
+
|
11
|
+
Then(/^I should not see the GPL licensed gem in the output$/) do
|
12
|
+
@output.should_not include 'gpl_gem'
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Given /^I have a rails app(?:lication)? with license finder$/ do
|
2
|
+
@user = ::DSL::User.new
|
3
|
+
@user.create_rails_app
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^I run rake license_finder$/) do
|
7
|
+
@output = @user.execute_command "rake license_finder -q"
|
8
|
+
end
|
9
|
+
|
10
|
+
Then(/^I should see a normal output$/) do
|
11
|
+
@output.should include "Dependencies that need approval:"
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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_license_finder_to_rakefile
|
5
|
+
@user.add_dependency_to_app 'other_gem', :license => 'other'
|
6
|
+
end
|
7
|
+
|
8
|
+
When(/^I set that gems license to MIT from the command line$/) do
|
9
|
+
@output = @user.execute_command 'license_finder -q'
|
10
|
+
@output = @user.execute_command 'license_finder -lq MIT other_gem'
|
11
|
+
@output = @user.execute_command 'license_finder -q'
|
12
|
+
end
|
13
|
+
|
14
|
+
Then(/^I should see that other gems license set to MIT$/) do
|
15
|
+
@output.should include 'other_gem'
|
16
|
+
end
|