license_finder 0.8.0-java → 0.8.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,203 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'pathname'
|
3
|
+
require 'bundler'
|
4
|
+
require 'capybara'
|
5
|
+
|
6
|
+
########## COMMON STEPS ##########
|
7
|
+
|
8
|
+
When(/^I run license_finder$/) do
|
9
|
+
@output = @user.execute_command "license_finder -q"
|
10
|
+
end
|
11
|
+
|
12
|
+
When(/^I whitelist MIT and 'other' licenses$/) do
|
13
|
+
@user.configure_license_finder_whitelist ["MIT","other"]
|
14
|
+
@output = @user.execute_command "license_finder -q"
|
15
|
+
end
|
16
|
+
|
17
|
+
module DSL
|
18
|
+
class User
|
19
|
+
def create_nonrails_app
|
20
|
+
reset_projects!
|
21
|
+
|
22
|
+
`cd #{projects_path} && bundle gem #{app_name}`
|
23
|
+
|
24
|
+
add_gem_dependency('rake')
|
25
|
+
add_gem_dependency('license_finder', :path => root_path)
|
26
|
+
|
27
|
+
bundle_app
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_rails_app
|
31
|
+
reset_projects!
|
32
|
+
|
33
|
+
`bundle exec rails new #{app_path} --skip-bundle`
|
34
|
+
|
35
|
+
add_gem_dependency('license_finder', :path => root_path)
|
36
|
+
|
37
|
+
bundle_app
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_license_finder_to_rakefile
|
41
|
+
add_to_rakefile <<-RUBY
|
42
|
+
require 'bundler/setup'
|
43
|
+
require 'license_finder'
|
44
|
+
LicenseFinder.load_rake_tasks
|
45
|
+
RUBY
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_gem(name, attrs)
|
49
|
+
file_contents = YAML.load(File.read(dependencies_file_path))
|
50
|
+
|
51
|
+
index = file_contents.index { |gem| gem['name'] == name }
|
52
|
+
file_contents[index].merge!(attrs)
|
53
|
+
|
54
|
+
File.open(dependencies_file_path, "w") do |f|
|
55
|
+
f.puts file_contents.to_yaml
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def append_to_file(filename, text)
|
60
|
+
File.open(File.join(app_path, filename), "a") do |f|
|
61
|
+
f.puts text
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def add_dependency_to_app(gem_name, options={})
|
66
|
+
license = options.fetch(:license)
|
67
|
+
summary = options.fetch(:summary, "")
|
68
|
+
description = options.fetch(:description, "")
|
69
|
+
bundler_groups = options.fetch(:bundler_groups, "").to_s.split(',').map(&:strip)
|
70
|
+
version = options[:version] || "0.0.0"
|
71
|
+
homepage = options[:homepage]
|
72
|
+
|
73
|
+
gem_dir = File.join(projects_path, gem_name)
|
74
|
+
|
75
|
+
FileUtils.mkdir(gem_dir)
|
76
|
+
File.open(File.join(gem_dir, "#{gem_name}.gemspec"), 'w') do |file|
|
77
|
+
file.write <<-GEMSPEC
|
78
|
+
Gem::Specification.new do |s|
|
79
|
+
s.name = "#{gem_name}"
|
80
|
+
s.version = "#{version}"
|
81
|
+
s.author = "Cucumber"
|
82
|
+
s.summary = "#{summary}"
|
83
|
+
s.license = "#{license}"
|
84
|
+
s.description = "#{description}"
|
85
|
+
s.homepage = "#{homepage}"
|
86
|
+
end
|
87
|
+
GEMSPEC
|
88
|
+
end
|
89
|
+
|
90
|
+
gem_options = {}
|
91
|
+
gem_options[:path] = File.join(projects_path, gem_name)
|
92
|
+
gem_options[:groups] = bundler_groups unless bundler_groups.empty?
|
93
|
+
|
94
|
+
add_gem_dependency(gem_name, gem_options)
|
95
|
+
|
96
|
+
bundle_app
|
97
|
+
end
|
98
|
+
|
99
|
+
def configure_license_finder_whitelist(whitelisted_licenses=[])
|
100
|
+
FileUtils.mkdir_p(config_path)
|
101
|
+
File.open(File.join(config_path, "license_finder.yml"), "w") do |f|
|
102
|
+
f.write({'whitelist' => whitelisted_licenses}.to_yaml)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def configure_license_finder_bundler_whitelist(whitelisted_groups=[])
|
107
|
+
whitelisted_groups = Array whitelisted_groups
|
108
|
+
FileUtils.mkdir_p(config_path)
|
109
|
+
File.open(File.join(config_path, "license_finder.yml"), "w") do |f|
|
110
|
+
f.write({'ignore_groups' => whitelisted_groups}.to_yaml)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def execute_command(command)
|
115
|
+
Bundler.with_clean_env do
|
116
|
+
@output = `cd #{app_path} && bundle exec #{command}`
|
117
|
+
end
|
118
|
+
|
119
|
+
@output
|
120
|
+
end
|
121
|
+
|
122
|
+
def app_path(sub_directory = nil)
|
123
|
+
path = app_path = Pathname.new(File.join(projects_path, app_name)).cleanpath.to_s
|
124
|
+
|
125
|
+
if sub_directory
|
126
|
+
path = Pathname.new(File.join(app_path, sub_directory)).cleanpath.to_s
|
127
|
+
|
128
|
+
raise "#{name} is outside of the app" unless path =~ %r{^#{app_path}/}
|
129
|
+
end
|
130
|
+
|
131
|
+
path
|
132
|
+
end
|
133
|
+
|
134
|
+
def config_path
|
135
|
+
File.join(app_path, 'config')
|
136
|
+
end
|
137
|
+
|
138
|
+
def doc_path
|
139
|
+
File.join(app_path, 'doc')
|
140
|
+
end
|
141
|
+
|
142
|
+
def dependencies_file_path
|
143
|
+
File.join(doc_path, 'dependencies.yml')
|
144
|
+
end
|
145
|
+
|
146
|
+
def dependencies_html_path
|
147
|
+
File.join(doc_path, 'dependencies.html')
|
148
|
+
end
|
149
|
+
|
150
|
+
def add_gem_dependency(name, options = {})
|
151
|
+
line = "gem #{name.inspect}"
|
152
|
+
line << ", " + options.inspect unless options.empty?
|
153
|
+
|
154
|
+
add_to_gemfile(line)
|
155
|
+
end
|
156
|
+
|
157
|
+
def bundle_app
|
158
|
+
Bundler.with_clean_env do
|
159
|
+
`bundle install --gemfile=#{File.join(app_path, "Gemfile")} --path=#{bundle_path}`
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def modifying_dependencies_file
|
164
|
+
FileUtils.mkdir_p(File.dirname(dependencies_file_path))
|
165
|
+
File.open(dependencies_file_path, 'w+') { |f| yield f }
|
166
|
+
end
|
167
|
+
|
168
|
+
private
|
169
|
+
|
170
|
+
def add_to_gemfile(line)
|
171
|
+
`echo #{line.inspect} >> #{File.join(app_path, "Gemfile")}`
|
172
|
+
end
|
173
|
+
|
174
|
+
def add_to_rakefile(line)
|
175
|
+
`echo #{line.inspect} >> #{File.join(app_path, "Rakefile")}`
|
176
|
+
end
|
177
|
+
|
178
|
+
def app_name
|
179
|
+
"my_app"
|
180
|
+
end
|
181
|
+
|
182
|
+
def sandbox_path
|
183
|
+
File.join(root_path, "tmp")
|
184
|
+
end
|
185
|
+
|
186
|
+
def projects_path
|
187
|
+
File.join(sandbox_path, "projects")
|
188
|
+
end
|
189
|
+
|
190
|
+
def bundle_path
|
191
|
+
File.join(sandbox_path, "bundle")
|
192
|
+
end
|
193
|
+
|
194
|
+
def reset_projects!
|
195
|
+
`rm -rf #{projects_path}`
|
196
|
+
`mkdir -p #{projects_path}`
|
197
|
+
end
|
198
|
+
|
199
|
+
def root_path
|
200
|
+
Pathname.new(File.join(File.dirname(__FILE__), "..", "..")).realpath.to_s
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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
|
+
Then(/^I should see those version and license details in the dependencies\.txt file$/) do
|
8
|
+
File.read(@user.app_path("doc/dependencies.txt")).should include "info_gem, 1.1.1, MIT"
|
9
|
+
end
|
@@ -0,0 +1,14 @@
|
|
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
|
+
When(/^I whitelist the Expat license$/) do
|
8
|
+
@user.configure_license_finder_whitelist ["Expat"]
|
9
|
+
@output = @user.execute_command 'license_finder -q'
|
10
|
+
end
|
11
|
+
|
12
|
+
Then(/^I should not see a MIT licensed gem unapproved$/) do
|
13
|
+
@output.should_not include 'mit_gem'
|
14
|
+
end
|
@@ -4,24 +4,6 @@ Feature: Text Report
|
|
4
4
|
I want license finder to generate an easy-to-understand text report
|
5
5
|
|
6
6
|
Scenario: Viewing dependencies
|
7
|
-
Given I have an app with license finder
|
8
|
-
|
9
|
-
|
10
|
-
| MIT | 1.1.1 |
|
11
|
-
When I run "license_finder"
|
12
|
-
Then I should see the file "doc/dependencies.txt" containing:
|
13
|
-
"""
|
14
|
-
descriptive_gem, 1.1.1, MIT
|
15
|
-
"""
|
16
|
-
|
17
|
-
Scenario: Viewing dependencies after multiple runs
|
18
|
-
Given I have an app with license finder
|
19
|
-
And my application depends on a gem "descriptive_gem" with:
|
20
|
-
| license | version |
|
21
|
-
| MIT | 1.1.1 |
|
22
|
-
When I run "license_finder"
|
23
|
-
And I run "license_finder"
|
24
|
-
Then I should see the file "doc/dependencies.txt" containing:
|
25
|
-
"""
|
26
|
-
descriptive_gem, 1.1.1, MIT
|
27
|
-
"""
|
7
|
+
Given I have an app with license finder that depends on a gem with license and version details
|
8
|
+
When I run license_finder
|
9
|
+
Then I should see those version and license details in the dependencies.txt file
|
data/features/whitelist.feature
CHANGED
@@ -3,22 +3,7 @@ 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: Auditing an application with whitelisted licenses
|
7
|
-
Given I have an app with license finder
|
8
|
-
And my app depends on a gem "mit_licensed_gem" licensed with "MIT"
|
9
|
-
When I run "license_finder"
|
10
|
-
Then I should see "mit_licensed_gem" in its output
|
11
|
-
When I whitelist the following licenses: "MIT, other"
|
12
|
-
And I run "license_finder"
|
13
|
-
Then I should see "All gems are approved for use" in its output
|
14
|
-
And it should exit with status code 0
|
15
|
-
|
16
6
|
Scenario: Whitelist with MIT License alternative name "Expat" should whitelist "MIT" licenses
|
17
|
-
Given I have an app with license finder
|
18
|
-
|
19
|
-
|
20
|
-
When I run "license_finder"
|
21
|
-
Then I should see "mit_licensed_gem" in its output
|
22
|
-
When I whitelist the "Expat" license
|
23
|
-
And I run "license_finder"
|
24
|
-
Then I should not see "mit_licensed_gem" in its output
|
7
|
+
Given I have an app with license finder that depends on an MIT license
|
8
|
+
When I whitelist the Expat license
|
9
|
+
Then I should not see a MIT licensed gem unapproved
|
data/license_finder.gemspec
CHANGED
@@ -2,7 +2,7 @@ require './lib/license_finder/platform'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "license_finder"
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.1"
|
6
6
|
s.authors = ["Jacob Maine", "Matthew Kane Parker", "Ian Lesperance", "David Edwards", "Paul Meskers", "Brent Wheeldon", "David Tengdin"]
|
7
7
|
s.email = ["licensefinder@pivotalabs.com"]
|
8
8
|
s.homepage = "https://github.com/pivotal/LicenseFinder"
|
@@ -22,10 +22,11 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "sequel"
|
23
23
|
s.add_dependency LicenseFinder::Platform.sqlite_gem
|
24
24
|
|
25
|
-
%w(rspec rake xpath
|
25
|
+
%w(rspec rake xpath cucumber database_cleaner).each do |gem|
|
26
26
|
s.add_development_dependency gem
|
27
27
|
end
|
28
28
|
|
29
|
+
s.add_development_dependency "capybara", "~> 2.0.0"
|
29
30
|
s.add_development_dependency "rails", "~> 3.2.0"
|
30
31
|
|
31
32
|
s.files = `git ls-files`.split("\n")
|
data/readme.md
CHANGED
@@ -93,6 +93,16 @@ $ license_finder -a awesome_gpl_gem
|
|
93
93
|
|
94
94
|
If you rerun `license_finder`, you should no longer see `awesome_gpl_gem` in the output.
|
95
95
|
|
96
|
+
## Upgrade for pre 0.8.0 users
|
97
|
+
|
98
|
+
If you wish to cleanup your root directory you can run:
|
99
|
+
|
100
|
+
```sh
|
101
|
+
$ license_finder -m
|
102
|
+
```
|
103
|
+
|
104
|
+
This will move your dependencies.* files to the /doc directory and update the config.
|
105
|
+
|
96
106
|
## Compatibility
|
97
107
|
|
98
108
|
license_finder is compatible with ruby 1.9, and ruby 2.0. There is also experimental support for jruby.
|
data/release.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
## Tips on releasing
|
2
|
+
|
3
|
+
Build the gem for both ruby and jruby (use a later version of each ruby, if desired)
|
4
|
+
|
5
|
+
```sh
|
6
|
+
$ rvm use jruby-1.7.3-d19
|
7
|
+
$ rake build
|
8
|
+
$ rvm use ruby-1.9.3-p392
|
9
|
+
$ rake build
|
10
|
+
```
|
11
|
+
|
12
|
+
Push both versions of the gem
|
13
|
+
|
14
|
+
```sh
|
15
|
+
$ rake release # will push default MRI build of gem, and importantly, tag the gem
|
16
|
+
$ gem push pkg/license_finder-LATEST_VERSION_HERE-java.gem
|
17
|
+
```
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: license_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Jacob Maine
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2013-04-
|
18
|
+
date: 2013-04-14 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bundler
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
prerelease: false
|
127
127
|
type: :development
|
128
128
|
- !ruby/object:Gem::Dependency
|
129
|
-
name:
|
129
|
+
name: cucumber
|
130
130
|
version_requirements: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - ">="
|
@@ -144,7 +144,7 @@ dependencies:
|
|
144
144
|
prerelease: false
|
145
145
|
type: :development
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
|
-
name:
|
147
|
+
name: database_cleaner
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
@@ -162,20 +162,18 @@ dependencies:
|
|
162
162
|
prerelease: false
|
163
163
|
type: :development
|
164
164
|
- !ruby/object:Gem::Dependency
|
165
|
-
name:
|
165
|
+
name: capybara
|
166
166
|
version_requirements: !ruby/object:Gem::Requirement
|
167
167
|
requirements:
|
168
|
-
- - "
|
168
|
+
- - "~>"
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
171
|
-
MA==
|
170
|
+
version: 2.0.0
|
172
171
|
none: false
|
173
172
|
requirement: !ruby/object:Gem::Requirement
|
174
173
|
requirements:
|
175
|
-
- - "
|
174
|
+
- - "~>"
|
176
175
|
- !ruby/object:Gem::Version
|
177
|
-
version:
|
178
|
-
MA==
|
176
|
+
version: 2.0.0
|
179
177
|
none: false
|
180
178
|
prerelease: false
|
181
179
|
type: :development
|
@@ -211,6 +209,7 @@ files:
|
|
211
209
|
- ".gitignore"
|
212
210
|
- ".rspec"
|
213
211
|
- ".travis.yml"
|
212
|
+
- CHANGELOG.rdoc
|
214
213
|
- Gemfile
|
215
214
|
- LICENSE
|
216
215
|
- Rakefile
|
@@ -225,14 +224,20 @@ files:
|
|
225
224
|
- db/migrate/201304011027_allow_null_dependency_version.rb
|
226
225
|
- db/migrate/201304020947_change_table_name_licenses_to_license_aliases.rb
|
227
226
|
- features/approve_dependencies.feature
|
227
|
+
- features/cli.feature
|
228
228
|
- features/html_report.feature
|
229
229
|
- features/ignore_bundle_groups.feature
|
230
|
-
- features/license_finder.feature
|
231
|
-
- features/license_finder_rake_task.feature
|
232
230
|
- features/rails_rake.feature
|
233
231
|
- features/set_license.feature
|
234
|
-
- features/step_definitions/
|
235
|
-
- features/step_definitions/
|
232
|
+
- features/step_definitions/approve_dependencies_steps.rb
|
233
|
+
- features/step_definitions/cli_steps.rb
|
234
|
+
- features/step_definitions/html_report_steps.rb
|
235
|
+
- features/step_definitions/ignore_bundle_groups_steps.rb
|
236
|
+
- features/step_definitions/rails_rake_steps.rb
|
237
|
+
- features/step_definitions/set_license_steps.rb
|
238
|
+
- features/step_definitions/shared_steps.rb
|
239
|
+
- features/step_definitions/text_report_steps.rb
|
240
|
+
- features/step_definitions/whitelist_steps.rb
|
236
241
|
- features/text_report.feature
|
237
242
|
- features/whitelist.feature
|
238
243
|
- files/license_finder.yml
|
@@ -282,6 +287,7 @@ files:
|
|
282
287
|
- lib/templates/text_report.erb
|
283
288
|
- license_finder.gemspec
|
284
289
|
- readme.md
|
290
|
+
- release.md
|
285
291
|
- spec/fixtures/APACHE-2-LICENSE
|
286
292
|
- spec/fixtures/GPLv2
|
287
293
|
- spec/fixtures/ISC-LICENSE
|
@@ -370,14 +376,20 @@ specification_version: 3
|
|
370
376
|
summary: Audit the OSS licenses of your application's dependencies.
|
371
377
|
test_files:
|
372
378
|
- features/approve_dependencies.feature
|
379
|
+
- features/cli.feature
|
373
380
|
- features/html_report.feature
|
374
381
|
- features/ignore_bundle_groups.feature
|
375
|
-
- features/license_finder.feature
|
376
|
-
- features/license_finder_rake_task.feature
|
377
382
|
- features/rails_rake.feature
|
378
383
|
- features/set_license.feature
|
379
|
-
- features/step_definitions/
|
380
|
-
- features/step_definitions/
|
384
|
+
- features/step_definitions/approve_dependencies_steps.rb
|
385
|
+
- features/step_definitions/cli_steps.rb
|
386
|
+
- features/step_definitions/html_report_steps.rb
|
387
|
+
- features/step_definitions/ignore_bundle_groups_steps.rb
|
388
|
+
- features/step_definitions/rails_rake_steps.rb
|
389
|
+
- features/step_definitions/set_license_steps.rb
|
390
|
+
- features/step_definitions/shared_steps.rb
|
391
|
+
- features/step_definitions/text_report_steps.rb
|
392
|
+
- features/step_definitions/whitelist_steps.rb
|
381
393
|
- features/text_report.feature
|
382
394
|
- features/whitelist.feature
|
383
395
|
- spec/fixtures/APACHE-2-LICENSE
|