license_finder 0.8.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/.rspec +1 -0
- data/.travis.yml +15 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/Rakefile +21 -0
- data/bin/license_finder +54 -0
- data/db/migrate/201303290935_create_dependencies.rb +14 -0
- data/db/migrate/201303291155_create_licenses.rb +13 -0
- data/db/migrate/201303291402_create_approvals.rb +13 -0
- data/db/migrate/201303291456_create_ancestries.rb +9 -0
- data/db/migrate/201303291519_create_bundler_groups.rb +13 -0
- data/db/migrate/201303291720_move_manual_from_approvals_to_licenses.rb +11 -0
- data/db/migrate/201303291753_allow_null_license_names.rb +7 -0
- data/db/migrate/201304011027_allow_null_dependency_version.rb +7 -0
- data/db/migrate/201304020947_change_table_name_licenses_to_license_aliases.rb +5 -0
- data/features/approve_dependencies.feature +14 -0
- data/features/html_report.feature +38 -0
- data/features/ignore_bundle_groups.feature +11 -0
- data/features/license_finder.feature +47 -0
- data/features/license_finder_rake_task.feature +37 -0
- data/features/rails_rake.feature +9 -0
- data/features/set_license.feature +12 -0
- data/features/step_definitions/license_finder_steps.rb +25 -0
- data/features/step_definitions/steps.rb +376 -0
- data/features/text_report.feature +27 -0
- data/features/whitelist.feature +24 -0
- data/files/license_finder.yml +8 -0
- data/lib/data/licenses/Apache2.txt +172 -0
- data/lib/data/licenses/BSD.txt +24 -0
- data/lib/data/licenses/GPLv2.txt +339 -0
- data/lib/data/licenses/ISC.txt +2 -0
- data/lib/data/licenses/LGPL.txt +165 -0
- data/lib/data/licenses/MIT.txt +9 -0
- data/lib/data/licenses/NewBSD.txt +21 -0
- data/lib/data/licenses/Ruby.txt +52 -0
- data/lib/data/licenses/SimplifiedBSD.txt +23 -0
- data/lib/license_finder.rb +47 -0
- data/lib/license_finder/bundle.rb +48 -0
- data/lib/license_finder/bundle_syncer.rb +11 -0
- data/lib/license_finder/bundled_gem.rb +48 -0
- data/lib/license_finder/cli.rb +49 -0
- data/lib/license_finder/configuration.rb +71 -0
- data/lib/license_finder/dependency_report.rb +30 -0
- data/lib/license_finder/gem_saver.rb +69 -0
- data/lib/license_finder/html_report.rb +14 -0
- data/lib/license_finder/license.rb +90 -0
- data/lib/license_finder/license/apache2.rb +8 -0
- data/lib/license_finder/license/bsd.rb +4 -0
- data/lib/license_finder/license/gplv2.rb +4 -0
- data/lib/license_finder/license/isc.rb +3 -0
- data/lib/license_finder/license/lgpl.rb +3 -0
- data/lib/license_finder/license/mit.rb +23 -0
- data/lib/license_finder/license/new_bsd.rb +8 -0
- data/lib/license_finder/license/ruby.rb +11 -0
- data/lib/license_finder/license/simplified_bsd.rb +8 -0
- data/lib/license_finder/license_files.rb +36 -0
- data/lib/license_finder/license_url.rb +12 -0
- data/lib/license_finder/platform.rb +32 -0
- data/lib/license_finder/possible_license_file.rb +32 -0
- data/lib/license_finder/railtie.rb +7 -0
- data/lib/license_finder/reporter.rb +20 -0
- data/lib/license_finder/tables.rb +7 -0
- data/lib/license_finder/tables/approval.rb +4 -0
- data/lib/license_finder/tables/bundler_group.rb +4 -0
- data/lib/license_finder/tables/dependency.rb +31 -0
- data/lib/license_finder/tables/license_alias.rb +22 -0
- data/lib/license_finder/text_report.rb +9 -0
- data/lib/license_finder/yml_to_sql.rb +127 -0
- data/lib/tasks/license_finder.rake +7 -0
- data/lib/templates/html_report.erb +111 -0
- data/lib/templates/text_report.erb +3 -0
- data/license_finder.gemspec +36 -0
- data/readme.md +115 -0
- data/spec/fixtures/APACHE-2-LICENSE +202 -0
- data/spec/fixtures/GPLv2 +339 -0
- data/spec/fixtures/ISC-LICENSE +10 -0
- data/spec/fixtures/MIT-LICENSE +22 -0
- data/spec/fixtures/MIT-LICENSE-with-varied-disclaimer +22 -0
- data/spec/fixtures/README-with-MIT-LICENSE +222 -0
- data/spec/fixtures/license_directory/COPYING +0 -0
- data/spec/fixtures/license_directory/LICENSE/BSD-2-Clause.txt +25 -0
- data/spec/fixtures/license_directory/LICENSE/GPL-2.0.txt +339 -0
- data/spec/fixtures/license_directory/LICENSE/LICENSE +191 -0
- data/spec/fixtures/license_directory/LICENSE/MIT.txt +21 -0
- data/spec/fixtures/license_directory/LICENSE/RUBY.txt +60 -0
- data/spec/fixtures/license_names/COPYING.txt +0 -0
- data/spec/fixtures/license_names/LICENSE +0 -0
- data/spec/fixtures/license_names/Licence.rdoc +0 -0
- data/spec/fixtures/license_names/Mit-License +0 -0
- data/spec/fixtures/license_names/README.rdoc +0 -0
- data/spec/fixtures/mit_licensed_gem/LICENSE +22 -0
- data/spec/fixtures/nested_gem/vendor/LICENSE +0 -0
- data/spec/fixtures/nested_readme/vendor/README +0 -0
- data/spec/fixtures/other_licensed_gem/LICENSE +3 -0
- data/spec/fixtures/readme/Project ReadMe b/data/spec/fixtures/readme/Project → ReadMe +0 -0
- data/spec/fixtures/readme/README +0 -0
- data/spec/fixtures/readme/Readme.markdown +0 -0
- data/spec/fixtures/utf8_gem/README +210 -0
- data/spec/lib/license_finder/bundle_spec.rb +61 -0
- data/spec/lib/license_finder/bundle_syncer_spec.rb +16 -0
- data/spec/lib/license_finder/bundled_gem_spec.rb +62 -0
- data/spec/lib/license_finder/cli_spec.rb +38 -0
- data/spec/lib/license_finder/configuration_spec.rb +70 -0
- data/spec/lib/license_finder/gem_saver_spec.rb +155 -0
- data/spec/lib/license_finder/html_report_spec.rb +84 -0
- data/spec/lib/license_finder/license/apache_spec.rb +7 -0
- data/spec/lib/license_finder/license/bsd_spec.rb +41 -0
- data/spec/lib/license_finder/license/gplv2_spec.rb +7 -0
- data/spec/lib/license_finder/license/isc_spec.rb +7 -0
- data/spec/lib/license_finder/license/lgpl_spec.rb +7 -0
- data/spec/lib/license_finder/license/mit_spec.rb +33 -0
- data/spec/lib/license_finder/license/new_bsd_spec.rb +35 -0
- data/spec/lib/license_finder/license/ruby_spec.rb +19 -0
- data/spec/lib/license_finder/license/simplified_bsd_spec.rb +7 -0
- data/spec/lib/license_finder/license_files_spec.rb +50 -0
- data/spec/lib/license_finder/license_spec.rb +45 -0
- data/spec/lib/license_finder/license_url_spec.rb +20 -0
- data/spec/lib/license_finder/possible_license_file_spec.rb +37 -0
- data/spec/lib/license_finder/reporter_spec.rb +4 -0
- data/spec/lib/license_finder/tables/dependency_spec.rb +102 -0
- data/spec/lib/license_finder/tables/license_alias_spec.rb +54 -0
- data/spec/lib/license_finder/text_report_spec.rb +31 -0
- data/spec/lib/license_finder/yml_to_sql_spec.rb +99 -0
- data/spec/lib/license_finder_spec.rb +82 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/license_examples.rb +30 -0
- metadata +435 -0
@@ -0,0 +1,376 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'pathname'
|
3
|
+
require 'bundler'
|
4
|
+
require 'capybara'
|
5
|
+
|
6
|
+
Given /^I have a rails app(?:lication)? with license finder$/ do
|
7
|
+
@user = ::DSL::User.new
|
8
|
+
@user.create_rails_app
|
9
|
+
end
|
10
|
+
|
11
|
+
Given /^I have an app(?:lication)? with license finder$/ do
|
12
|
+
@user = ::DSL::User.new
|
13
|
+
@user.create_nonrails_app
|
14
|
+
end
|
15
|
+
|
16
|
+
Given /^I have an app(?:lication)? with rake and license finder$/ do
|
17
|
+
@user = ::DSL::User.new
|
18
|
+
@user.create_nonrails_app
|
19
|
+
@user.add_license_finder_to_rakefile
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /^my app(?:lication)? does not have a "([^"]+)" directory$/ do |name|
|
23
|
+
path = @user.app_path(name)
|
24
|
+
|
25
|
+
FileUtils.rm_rf(path)
|
26
|
+
File.should_not be_exists(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
Given /^my (?:rails )?app(?:lication)? depends on a gem "(.*?)" licensed with "(.*?)"$/ do |gem_name, license|
|
30
|
+
@user.add_dependency_to_app gem_name, :license => license
|
31
|
+
end
|
32
|
+
|
33
|
+
Given /^my (?:rails )?app(?:lication)? depends on a gem "(.*?)" licensed with "(.*?)" in the "(.*?)" bundler groups$/ do |gem_name, license, bundler_groups|
|
34
|
+
@user.add_dependency_to_app gem_name, :license => license, :bundler_groups => bundler_groups
|
35
|
+
end
|
36
|
+
|
37
|
+
Given /^I whitelist the "(.*?)" license$/ do |license|
|
38
|
+
@user.configure_license_finder_whitelist [license]
|
39
|
+
end
|
40
|
+
|
41
|
+
Given /^I whitelist the following licenses: "([^"]*)"$/ do |licenses|
|
42
|
+
@user.configure_license_finder_whitelist licenses.split(", ")
|
43
|
+
end
|
44
|
+
|
45
|
+
Given /^I have a legacy dependencies\.yml file with "(.*?)" approved with its "(.*?)" license$/ do |gem_name, license_name|
|
46
|
+
@user.modifying_dependencies_file do |f|
|
47
|
+
f.write <<-YAML
|
48
|
+
- name: #{gem_name}
|
49
|
+
version: 1.5.0
|
50
|
+
license: #{license_name}
|
51
|
+
approved: true
|
52
|
+
notes: ''
|
53
|
+
license_files:
|
54
|
+
- path: /some/path/to/files/that/are/rad
|
55
|
+
YAML
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
And /^I have a legacy dependencies\.yml file with readme_files entry for gem "(.*?)"$/ do |gem_name|
|
60
|
+
@user.modifying_dependencies_file do |f|
|
61
|
+
f.write <<-YAML
|
62
|
+
- name: #{gem_name}
|
63
|
+
version: 1.5.0
|
64
|
+
license: some_license
|
65
|
+
approved: true
|
66
|
+
notes: ''
|
67
|
+
license_files:
|
68
|
+
- path: /some/path/to/files/that/are/rad
|
69
|
+
readme_files:
|
70
|
+
- path: /some/path/to/files/that/are/rad/readme
|
71
|
+
YAML
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
Given /^I have a legacy dependencies\.yml file with a blank readme_files entry for gem "(.*?)"$/ do |gem_name|
|
76
|
+
@user.modifying_dependencies_file do |f|
|
77
|
+
f.write(<<-YAML)
|
78
|
+
- name: #{gem_name}
|
79
|
+
version: 1.5.0
|
80
|
+
license: some_license
|
81
|
+
approved: true
|
82
|
+
notes: ''
|
83
|
+
license_files:
|
84
|
+
- path: /some/path/to/files/that/are/rad
|
85
|
+
readme_files:
|
86
|
+
YAML
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
When /^I run "(.*?)"$/ do |command|
|
91
|
+
@output = @user.execute_command command
|
92
|
+
end
|
93
|
+
|
94
|
+
When /^I update the settings for "([^"]*)" with the following content:$/ do |gem, text|
|
95
|
+
@user.update_gem(gem, YAML.load(text))
|
96
|
+
end
|
97
|
+
|
98
|
+
When /^I add the following content to "([^"]*)":$/ do |filename, text|
|
99
|
+
@user.append_to_file(filename, @content = text)
|
100
|
+
end
|
101
|
+
|
102
|
+
When /^my app(?:lication)? depends on a gem "([^"]*)" with:$/ do |gem_name, gem_info|
|
103
|
+
info = gem_info.hashes.first
|
104
|
+
@user.add_dependency_to_app(gem_name,
|
105
|
+
:license => info["license"],
|
106
|
+
:summary => info["summary"],
|
107
|
+
:description => info["description"],
|
108
|
+
:version => info["version"],
|
109
|
+
:homepage => info["homepage"],
|
110
|
+
:bundler_groups => info["bundler_groups"]
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
When /^the text "([^"]*)" should link to "([^"]*)"$/ do |text, link|
|
115
|
+
html = Capybara.string File.read(@user.dependencies_html_path)
|
116
|
+
html.all(:xpath, "//a[@href='#{link}']").first.text.should == text
|
117
|
+
end
|
118
|
+
|
119
|
+
When /^"([^"]*)" is an alternative name for the "MIT" license$/ do |alternative_name|
|
120
|
+
# this step is simply for readability
|
121
|
+
end
|
122
|
+
|
123
|
+
When /^I whitelist the "([^"]*)" bundler group$/ do |group|
|
124
|
+
@user.configure_license_finder_bundler_whitelist(group)
|
125
|
+
end
|
126
|
+
|
127
|
+
Then(/^I should see other_license_gem set to MIT license$/) do
|
128
|
+
@output.should =~ /other_license_gem.*MIT/
|
129
|
+
end
|
130
|
+
|
131
|
+
Then /^I should see a "([^"]+)" directory$/ do |name|
|
132
|
+
File.should be_exists(@user.app_path(name))
|
133
|
+
end
|
134
|
+
|
135
|
+
Then /^I should see "(.*?)" in its output$/ do |gem_name|
|
136
|
+
@output.should include gem_name
|
137
|
+
end
|
138
|
+
|
139
|
+
Then /^I should not see "(.*?)" in its output$/ do |gem_name|
|
140
|
+
@output.should_not include gem_name
|
141
|
+
end
|
142
|
+
|
143
|
+
Then /^I should see the file "([^"]*)" with the following content:$/ do |filename, text|
|
144
|
+
File.read(@user.app_path(filename)).should == text.gsub(/^\s+/, "")
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^I should see the file "([^"]*)" containing:$/ do |filename, text|
|
148
|
+
File.read(@user.app_path(filename)).should include(text.gsub(/^\s+/, ""))
|
149
|
+
end
|
150
|
+
|
151
|
+
Then /^I should see exactly one entry for "(.*?)" in "(.*?)"$/ do |gem_name, filename|
|
152
|
+
file_contents = File.read(@user.app_path(filename))
|
153
|
+
file_contents.scan(/#{gem_name}/).size.should == 1
|
154
|
+
end
|
155
|
+
|
156
|
+
Then /^I should not see an entry "(.*?)" for gem "(.*?)" in my dependencies\.yml$/ do |entry_key, gem_name|
|
157
|
+
settings = YAML.load(File.read(@user.dependencies_file_path))
|
158
|
+
gem_settings = settings.detect { |gem| gem['name'] == gem_name }
|
159
|
+
gem_settings.should_not have_key entry_key
|
160
|
+
end
|
161
|
+
|
162
|
+
Then /^it should exit with status code (\d)$/ do |status|
|
163
|
+
$?.exitstatus.should == status.to_i
|
164
|
+
end
|
165
|
+
|
166
|
+
Then /^I should see the "([^"]*)" in the html flagged as "([^"]*)"$/ do |gem_name, css_class|
|
167
|
+
html = File.read(@user.dependencies_html_path)
|
168
|
+
page = Capybara.string(html)
|
169
|
+
gpl_gem = page.find("##{gem_name}")
|
170
|
+
gpl_gem[:class].should == css_class
|
171
|
+
end
|
172
|
+
|
173
|
+
Then /^I should see (?:the )?"([^"]*)" in the html with the following details:$/ do |gem_name, table|
|
174
|
+
html = File.read(@user.dependencies_html_path)
|
175
|
+
page = Capybara.string(html)
|
176
|
+
section = page.find("##{gem_name}")
|
177
|
+
|
178
|
+
table.hashes.first.each do |property_name, property_value|
|
179
|
+
section.should have_content property_value
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
Then /^I should see "([^"]*)" in the html$/ do |text|
|
184
|
+
html = File.read(@user.dependencies_html_path)
|
185
|
+
page = Capybara.string(html)
|
186
|
+
|
187
|
+
page.should have_content text
|
188
|
+
end
|
189
|
+
|
190
|
+
module DSL
|
191
|
+
class User
|
192
|
+
def create_nonrails_app
|
193
|
+
reset_projects!
|
194
|
+
|
195
|
+
`cd #{projects_path} && bundle gem #{app_name}`
|
196
|
+
|
197
|
+
add_gem_dependency('rake')
|
198
|
+
add_gem_dependency('license_finder', :path => root_path)
|
199
|
+
|
200
|
+
bundle_app
|
201
|
+
end
|
202
|
+
|
203
|
+
def create_rails_app
|
204
|
+
reset_projects!
|
205
|
+
|
206
|
+
`bundle exec rails new #{app_path} --skip-bundle`
|
207
|
+
|
208
|
+
add_gem_dependency('license_finder', :path => root_path)
|
209
|
+
|
210
|
+
bundle_app
|
211
|
+
end
|
212
|
+
|
213
|
+
def add_license_finder_to_rakefile
|
214
|
+
add_to_rakefile <<-RUBY
|
215
|
+
require 'bundler/setup'
|
216
|
+
require 'license_finder'
|
217
|
+
LicenseFinder.load_rake_tasks
|
218
|
+
RUBY
|
219
|
+
end
|
220
|
+
|
221
|
+
def update_gem(name, attrs)
|
222
|
+
file_contents = YAML.load(File.read(dependencies_file_path))
|
223
|
+
|
224
|
+
index = file_contents.index { |gem| gem['name'] == name }
|
225
|
+
file_contents[index].merge!(attrs)
|
226
|
+
|
227
|
+
File.open(dependencies_file_path, "w") do |f|
|
228
|
+
f.puts file_contents.to_yaml
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def append_to_file(filename, text)
|
233
|
+
File.open(File.join(app_path, filename), "a") do |f|
|
234
|
+
f.puts text
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def add_dependency_to_app(gem_name, options={})
|
239
|
+
license = options.fetch(:license)
|
240
|
+
summary = options.fetch(:summary, "")
|
241
|
+
description = options.fetch(:description, "")
|
242
|
+
bundler_groups = options.fetch(:bundler_groups, "").to_s.split(',').map(&:strip)
|
243
|
+
version = options[:version] || "0.0.0"
|
244
|
+
homepage = options[:homepage]
|
245
|
+
|
246
|
+
gem_dir = File.join(projects_path, gem_name)
|
247
|
+
|
248
|
+
FileUtils.mkdir(gem_dir)
|
249
|
+
File.open(File.join(gem_dir, "#{gem_name}.gemspec"), 'w') do |file|
|
250
|
+
file.write <<-GEMSPEC
|
251
|
+
Gem::Specification.new do |s|
|
252
|
+
s.name = "#{gem_name}"
|
253
|
+
s.version = "#{version}"
|
254
|
+
s.author = "Cucumber"
|
255
|
+
s.summary = "#{summary}"
|
256
|
+
s.license = "#{license}"
|
257
|
+
s.description = "#{description}"
|
258
|
+
s.homepage = "#{homepage}"
|
259
|
+
end
|
260
|
+
GEMSPEC
|
261
|
+
end
|
262
|
+
|
263
|
+
gem_options = {}
|
264
|
+
gem_options[:path] = File.join(projects_path, gem_name)
|
265
|
+
gem_options[:groups] = bundler_groups unless bundler_groups.empty?
|
266
|
+
|
267
|
+
add_gem_dependency(gem_name, gem_options)
|
268
|
+
|
269
|
+
bundle_app
|
270
|
+
end
|
271
|
+
|
272
|
+
def configure_license_finder_whitelist(whitelisted_licenses=[])
|
273
|
+
FileUtils.mkdir_p(config_path)
|
274
|
+
File.open(File.join(config_path, "license_finder.yml"), "w") do |f|
|
275
|
+
f.write({'whitelist' => whitelisted_licenses}.to_yaml)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def configure_license_finder_bundler_whitelist(whitelisted_groups=[])
|
280
|
+
whitelisted_groups = Array whitelisted_groups
|
281
|
+
FileUtils.mkdir_p(config_path)
|
282
|
+
File.open(File.join(config_path, "license_finder.yml"), "w") do |f|
|
283
|
+
f.write({'ignore_groups' => whitelisted_groups}.to_yaml)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def execute_command(command)
|
288
|
+
Bundler.with_clean_env do
|
289
|
+
@output = `cd #{app_path} && bundle exec #{command}`
|
290
|
+
end
|
291
|
+
|
292
|
+
@output
|
293
|
+
end
|
294
|
+
|
295
|
+
def app_path(sub_directory = nil)
|
296
|
+
path = app_path = Pathname.new(File.join(projects_path, app_name)).cleanpath.to_s
|
297
|
+
|
298
|
+
if sub_directory
|
299
|
+
path = Pathname.new(File.join(app_path, sub_directory)).cleanpath.to_s
|
300
|
+
|
301
|
+
raise "#{name} is outside of the app" unless path =~ %r{^#{app_path}/}
|
302
|
+
end
|
303
|
+
|
304
|
+
path
|
305
|
+
end
|
306
|
+
|
307
|
+
def config_path
|
308
|
+
File.join(app_path, 'config')
|
309
|
+
end
|
310
|
+
|
311
|
+
def doc_path
|
312
|
+
File.join(app_path, 'doc')
|
313
|
+
end
|
314
|
+
|
315
|
+
def dependencies_file_path
|
316
|
+
File.join(doc_path, 'dependencies.yml')
|
317
|
+
end
|
318
|
+
|
319
|
+
def dependencies_html_path
|
320
|
+
File.join(doc_path, 'dependencies.html')
|
321
|
+
end
|
322
|
+
|
323
|
+
def add_gem_dependency(name, options = {})
|
324
|
+
line = "gem #{name.inspect}"
|
325
|
+
line << ", " + options.inspect unless options.empty?
|
326
|
+
|
327
|
+
add_to_gemfile(line)
|
328
|
+
end
|
329
|
+
|
330
|
+
def bundle_app
|
331
|
+
Bundler.with_clean_env do
|
332
|
+
`bundle install --gemfile=#{File.join(app_path, "Gemfile")} --path=#{bundle_path}`
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
def modifying_dependencies_file
|
337
|
+
FileUtils.mkdir_p(File.dirname(dependencies_file_path))
|
338
|
+
File.open(dependencies_file_path, 'w+') { |f| yield f }
|
339
|
+
end
|
340
|
+
|
341
|
+
private
|
342
|
+
|
343
|
+
def add_to_gemfile(line)
|
344
|
+
`echo #{line.inspect} >> #{File.join(app_path, "Gemfile")}`
|
345
|
+
end
|
346
|
+
|
347
|
+
def add_to_rakefile(line)
|
348
|
+
`echo #{line.inspect} >> #{File.join(app_path, "Rakefile")}`
|
349
|
+
end
|
350
|
+
|
351
|
+
def app_name
|
352
|
+
"my_app"
|
353
|
+
end
|
354
|
+
|
355
|
+
def sandbox_path
|
356
|
+
File.join(root_path, "tmp")
|
357
|
+
end
|
358
|
+
|
359
|
+
def projects_path
|
360
|
+
File.join(sandbox_path, "projects")
|
361
|
+
end
|
362
|
+
|
363
|
+
def bundle_path
|
364
|
+
File.join(sandbox_path, "bundle")
|
365
|
+
end
|
366
|
+
|
367
|
+
def reset_projects!
|
368
|
+
`rm -rf #{projects_path}`
|
369
|
+
`mkdir -p #{projects_path}`
|
370
|
+
end
|
371
|
+
|
372
|
+
def root_path
|
373
|
+
Pathname.new(File.join(File.dirname(__FILE__), "..", "..")).realpath.to_s
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Text Report
|
2
|
+
So that I can easily view a report outlining my application dependencies and licenses
|
3
|
+
As a non-technical application product owner
|
4
|
+
I want license finder to generate an easy-to-understand text report
|
5
|
+
|
6
|
+
Scenario: Viewing dependencies
|
7
|
+
Given I have an app with license finder
|
8
|
+
And my application depends on a gem "descriptive_gem" with:
|
9
|
+
| license | version |
|
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
|
+
"""
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: Whitelist licenses
|
2
|
+
As a developer
|
3
|
+
I want to whitelist certain OSS licenses that my business has pre-approved
|
4
|
+
So that any dependencies with those licenses do not show up as action items
|
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
|
+
Scenario: Whitelist with MIT License alternative name "Expat" should whitelist "MIT" licenses
|
17
|
+
Given I have an app with license finder
|
18
|
+
And "Expat" is an alternative name for the "MIT" license
|
19
|
+
And my app depends on a gem "mit_licensed_gem" licensed with "MIT"
|
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
|
@@ -0,0 +1,172 @@
|
|
1
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
2
|
+
|
3
|
+
1. Definitions.
|
4
|
+
|
5
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
6
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
7
|
+
|
8
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
9
|
+
the copyright owner that is granting the License.
|
10
|
+
|
11
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
12
|
+
other entities that control, are controlled by, or are under common
|
13
|
+
control with that entity. For the purposes of this definition,
|
14
|
+
"control" means (i) the power, direct or indirect, to cause the
|
15
|
+
direction or management of such entity, whether by contract or
|
16
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
17
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
18
|
+
|
19
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
20
|
+
exercising permissions granted by this License.
|
21
|
+
|
22
|
+
"Source" form shall mean the preferred form for making modifications,
|
23
|
+
including but not limited to software source code, documentation
|
24
|
+
source, and configuration files.
|
25
|
+
|
26
|
+
"Object" form shall mean any form resulting from mechanical
|
27
|
+
transformation or translation of a Source form, including but
|
28
|
+
not limited to compiled object code, generated documentation,
|
29
|
+
and conversions to other media types.
|
30
|
+
|
31
|
+
"Work" shall mean the work of authorship, whether in Source or
|
32
|
+
Object form, made available under the License, as indicated by a
|
33
|
+
copyright notice that is included in or attached to the work
|
34
|
+
(an example is provided in the Appendix below).
|
35
|
+
|
36
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
37
|
+
form, that is based on (or derived from) the Work and for which the
|
38
|
+
editorial revisions, annotations, elaborations, or other modifications
|
39
|
+
represent, as a whole, an original work of authorship. For the purposes
|
40
|
+
of this License, Derivative Works shall not include works that remain
|
41
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
42
|
+
the Work and Derivative Works thereof.
|
43
|
+
|
44
|
+
"Contribution" shall mean any work of authorship, including
|
45
|
+
the original version of the Work and any modifications or additions
|
46
|
+
to that Work or Derivative Works thereof, that is intentionally
|
47
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
48
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
49
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
50
|
+
means any form of electronic, verbal, or written communication sent
|
51
|
+
to the Licensor or its representatives, including but not limited to
|
52
|
+
communication on electronic mailing lists, source code control systems,
|
53
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
54
|
+
Licensor for the purpose of discussing and improving the Work, but
|
55
|
+
excluding communication that is conspicuously marked or otherwise
|
56
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
57
|
+
|
58
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
59
|
+
on behalf of whom a Contribution has been received by Licensor and
|
60
|
+
subsequently incorporated within the Work.
|
61
|
+
|
62
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
63
|
+
this License, each Contributor hereby grants to You a perpetual,
|
64
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
65
|
+
copyright license to reproduce, prepare Derivative Works of,
|
66
|
+
publicly display, publicly perform, sublicense, and distribute the
|
67
|
+
Work and such Derivative Works in Source or Object form.
|
68
|
+
|
69
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
70
|
+
this License, each Contributor hereby grants to You a perpetual,
|
71
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
72
|
+
(except as stated in this section) patent license to make, have made,
|
73
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
74
|
+
where such license applies only to those patent claims licensable
|
75
|
+
by such Contributor that are necessarily infringed by their
|
76
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
77
|
+
with the Work to which such Contribution(s) was submitted. If You
|
78
|
+
institute patent litigation against any entity (including a
|
79
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
80
|
+
or a Contribution incorporated within the Work constitutes direct
|
81
|
+
or contributory patent infringement, then any patent licenses
|
82
|
+
granted to You under this License for that Work shall terminate
|
83
|
+
as of the date such litigation is filed.
|
84
|
+
|
85
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
86
|
+
Work or Derivative Works thereof in any medium, with or without
|
87
|
+
modifications, and in Source or Object form, provided that You
|
88
|
+
meet the following conditions:
|
89
|
+
|
90
|
+
(a) You must give any other recipients of the Work or
|
91
|
+
Derivative Works a copy of this License; and
|
92
|
+
|
93
|
+
(b) You must cause any modified files to carry prominent notices
|
94
|
+
stating that You changed the files; and
|
95
|
+
|
96
|
+
(c) You must retain, in the Source form of any Derivative Works
|
97
|
+
that You distribute, all copyright, patent, trademark, and
|
98
|
+
attribution notices from the Source form of the Work,
|
99
|
+
excluding those notices that do not pertain to any part of
|
100
|
+
the Derivative Works; and
|
101
|
+
|
102
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
103
|
+
distribution, then any Derivative Works that You distribute must
|
104
|
+
include a readable copy of the attribution notices contained
|
105
|
+
within such NOTICE file, excluding those notices that do not
|
106
|
+
pertain to any part of the Derivative Works, in at least one
|
107
|
+
of the following places: within a NOTICE text file distributed
|
108
|
+
as part of the Derivative Works; within the Source form or
|
109
|
+
documentation, if provided along with the Derivative Works; or,
|
110
|
+
within a display generated by the Derivative Works, if and
|
111
|
+
wherever such third-party notices normally appear. The contents
|
112
|
+
of the NOTICE file are for informational purposes only and
|
113
|
+
do not modify the License. You may add Your own attribution
|
114
|
+
notices within Derivative Works that You distribute, alongside
|
115
|
+
or as an addendum to the NOTICE text from the Work, provided
|
116
|
+
that such additional attribution notices cannot be construed
|
117
|
+
as modifying the License.
|
118
|
+
|
119
|
+
You may add Your own copyright statement to Your modifications and
|
120
|
+
may provide additional or different license terms and conditions
|
121
|
+
for use, reproduction, or distribution of Your modifications, or
|
122
|
+
for any such Derivative Works as a whole, provided Your use,
|
123
|
+
reproduction, and distribution of the Work otherwise complies with
|
124
|
+
the conditions stated in this License.
|
125
|
+
|
126
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
127
|
+
any Contribution intentionally submitted for inclusion in the Work
|
128
|
+
by You to the Licensor shall be under the terms and conditions of
|
129
|
+
this License, without any additional terms or conditions.
|
130
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
131
|
+
the terms of any separate license agreement you may have executed
|
132
|
+
with Licensor regarding such Contributions.
|
133
|
+
|
134
|
+
6. Trademarks. This License does not grant permission to use the trade
|
135
|
+
names, trademarks, service marks, or product names of the Licensor,
|
136
|
+
except as required for reasonable and customary use in describing the
|
137
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
138
|
+
|
139
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
140
|
+
agreed to in writing, Licensor provides the Work (and each
|
141
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
142
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
143
|
+
implied, including, without limitation, any warranties or conditions
|
144
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
145
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
146
|
+
appropriateness of using or redistributing the Work and assume any
|
147
|
+
risks associated with Your exercise of permissions under this License.
|
148
|
+
|
149
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
150
|
+
whether in tort (including negligence), contract, or otherwise,
|
151
|
+
unless required by applicable law (such as deliberate and grossly
|
152
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
153
|
+
liable to You for damages, including any direct, indirect, special,
|
154
|
+
incidental, or consequential damages of any character arising as a
|
155
|
+
result of this License or out of the use or inability to use the
|
156
|
+
Work (including but not limited to damages for loss of goodwill,
|
157
|
+
work stoppage, computer failure or malfunction, or any and all
|
158
|
+
other commercial damages or losses), even if such Contributor
|
159
|
+
has been advised of the possibility of such damages.
|
160
|
+
|
161
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
162
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
163
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
164
|
+
or other liability obligations and/or rights consistent with this
|
165
|
+
License. However, in accepting such obligations, You may act only
|
166
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
167
|
+
of any other Contributor, and only if You agree to indemnify,
|
168
|
+
defend, and hold each Contributor harmless for any liability
|
169
|
+
incurred by, or claims asserted against, such Contributor by reason
|
170
|
+
of your accepting any such warranty or additional liability.
|
171
|
+
|
172
|
+
END OF TERMS AND CONDITIONS
|