licensee 8.9.2 → 9.0.0.beta.1
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.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/bin/licensee +42 -28
- data/lib/licensee.rb +14 -28
- data/lib/licensee/content_helper.rb +38 -12
- data/lib/licensee/license.rb +22 -9
- data/lib/licensee/matchers.rb +14 -0
- data/lib/licensee/matchers/cabal.rb +16 -0
- data/lib/licensee/matchers/{copyright_matcher.rb → copyright.rb} +1 -5
- data/lib/licensee/matchers/{cran_matcher.rb → cran.rb} +1 -1
- data/lib/licensee/matchers/{dice_matcher.rb → dice.rb} +1 -7
- data/lib/licensee/matchers/{dist_zilla_matcher.rb → dist_zilla.rb} +1 -1
- data/lib/licensee/matchers/{exact_matcher.rb → exact.rb} +2 -1
- data/lib/licensee/matchers/gemspec.rb +24 -0
- data/lib/licensee/matchers/{package_matcher.rb → matcher.rb} +5 -3
- data/lib/licensee/matchers/{npm_bower_matcher.rb → npm_bower.rb} +2 -2
- data/lib/licensee/matchers/package.rb +22 -0
- data/lib/licensee/project_files.rb +8 -0
- data/lib/licensee/project_files/license_file.rb +22 -4
- data/lib/licensee/project_files/package_manager_file.rb +37 -0
- data/lib/licensee/project_files/project_file.rb +65 -0
- data/lib/licensee/project_files/{readme.rb → readme_file.rb} +2 -2
- data/lib/licensee/projects.rb +7 -0
- data/lib/licensee/projects/fs_project.rb +64 -27
- data/lib/licensee/projects/git_project.rb +49 -43
- data/lib/licensee/projects/project.rb +149 -0
- data/lib/licensee/version.rb +1 -1
- data/spec/bin_spec.rb +9 -2
- data/spec/fixtures/crlf-license/LICENSE +674 -0
- data/spec/fixtures/fcpl-modified-mpl/LICENSE +193 -193
- data/spec/fixtures/ipsum.txt +19 -0
- data/spec/fixtures/license-in-parent-folder/LICENSE.txt +21 -0
- data/spec/fixtures/license-in-parent-folder/license-folder/LICENSE.txt +21 -0
- data/spec/fixtures/multiple-license-files/LICENSE +362 -0
- data/spec/fixtures/multiple-license-files/LICENSE.txt +21 -0
- data/spec/integration_spec.rb +57 -22
- data/spec/licensee/content_helper_spec.rb +33 -9
- data/spec/licensee/license_spec.rb +8 -1
- data/spec/licensee/matchers/cabal_matcher_spec.rb +45 -0
- data/spec/licensee/matchers/copyright_matcher_spec.rb +1 -1
- data/spec/licensee/matchers/cran_matcher_spec.rb +11 -2
- data/spec/licensee/matchers/dice_matcher_spec.rb +1 -2
- data/spec/licensee/matchers/dist_zilla_matcher_spec.rb +11 -2
- data/spec/licensee/matchers/exact_matcher_spec.rb +1 -1
- data/spec/licensee/matchers/gemspec_matcher_spec.rb +19 -1
- data/spec/licensee/matchers/npm_bower_matcher_spec.rb +23 -6
- data/spec/licensee/matchers/package_matcher_spec.rb +31 -2
- data/spec/licensee/project_files/license_file_spec.rb +62 -6
- data/spec/licensee/project_files/package_info_spec.rb +10 -1
- data/spec/{project_file_spec.rb → licensee/project_files/project_file_spec.rb} +14 -1
- data/spec/licensee/project_files/readme_spec.rb +1 -1
- data/spec/licensee/project_spec.rb +134 -9
- data/spec/licensee_spec.rb +4 -3
- data/spec/spec_helper.rb +12 -23
- data/spec/vendored_license_spec.rb +16 -13
- metadata +29 -17
- data/lib/licensee/matchers/gemspec_matcher.rb +0 -19
- data/lib/licensee/project.rb +0 -87
- data/lib/licensee/project_file.rb +0 -39
- data/lib/licensee/project_files/package_info.rb +0 -31
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
RSpec.describe Licensee::
|
|
1
|
+
RSpec.describe Licensee::ProjectFiles::PackageManagerFile do
|
|
2
2
|
let(:content) { '' }
|
|
3
3
|
let(:filename) { '' }
|
|
4
4
|
subject { described_class.new(content, filename) }
|
|
@@ -6,6 +6,7 @@ RSpec.describe Licensee::Project::PackageInfo do
|
|
|
6
6
|
context 'name scoring' do
|
|
7
7
|
{
|
|
8
8
|
'licensee.gemspec' => 1.0,
|
|
9
|
+
'test.cabal' => 1.0,
|
|
9
10
|
'package.json' => 1.0,
|
|
10
11
|
'DESCRIPTION' => 0.9,
|
|
11
12
|
'dist.ini' => 0.8,
|
|
@@ -32,6 +33,14 @@ RSpec.describe Licensee::Project::PackageInfo do
|
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
35
|
|
|
36
|
+
context 'with cabal file ' do
|
|
37
|
+
let(:filename) { 'test.cabal' }
|
|
38
|
+
|
|
39
|
+
it 'returns the cabal matcher' do
|
|
40
|
+
expect(possible_matchers).to eql([Licensee::Matchers::Cabal])
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
35
44
|
context 'with package.json' do
|
|
36
45
|
let(:filename) { 'package.json' }
|
|
37
46
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
RSpec.describe Licensee::
|
|
1
|
+
RSpec.describe Licensee::ProjectFiles::ProjectFile do
|
|
2
2
|
let(:filename) { 'LICENSE.txt' }
|
|
3
3
|
let(:mit) { Licensee::License.find('mit') }
|
|
4
4
|
let(:content) { mit.content }
|
|
@@ -30,4 +30,17 @@ RSpec.describe Licensee::Project::File do
|
|
|
30
30
|
it 'returns the license' do
|
|
31
31
|
expect(subject.license).to eql(mit)
|
|
32
32
|
end
|
|
33
|
+
|
|
34
|
+
context 'with additional metadata' do
|
|
35
|
+
subject { described_class.new(content, name: filename, dir: Dir.pwd) }
|
|
36
|
+
|
|
37
|
+
it 'stores the filename' do
|
|
38
|
+
expect(subject.filename).to eql(filename)
|
|
39
|
+
expect(subject[:name]).to eql(filename)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'stores additional metadata' do
|
|
43
|
+
expect(subject[:dir]).to eql(Dir.pwd)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
33
46
|
end
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
[Licensee::FSProject,
|
|
1
|
+
[Licensee::Projects::FSProject,
|
|
2
|
+
Licensee::Projects::GitProject].each do |project_type|
|
|
2
3
|
RSpec.describe project_type do
|
|
3
4
|
let(:mit) { Licensee::License.find('mit') }
|
|
5
|
+
let(:other) { Licensee::License.find('other') }
|
|
4
6
|
let(:fixture) { 'mit' }
|
|
5
7
|
let(:path) { fixture_path(fixture) }
|
|
6
8
|
subject { described_class.new(path) }
|
|
7
9
|
|
|
8
|
-
if described_class == Licensee::GitProject
|
|
10
|
+
if described_class == Licensee::Projects::GitProject
|
|
9
11
|
before do
|
|
10
12
|
Dir.chdir path do
|
|
11
13
|
`git init`
|
|
@@ -14,7 +16,32 @@
|
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
after
|
|
19
|
+
after do
|
|
20
|
+
subject.close
|
|
21
|
+
FileUtils.rm_rf File.expand_path '.git', path
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if described_class == Licensee::Projects::GitProject
|
|
26
|
+
context 'when initialized with a repo' do
|
|
27
|
+
let(:repo) { Rugged::Repository.new(path) }
|
|
28
|
+
subject { described_class.new(repo) }
|
|
29
|
+
|
|
30
|
+
it 'returns the repository' do
|
|
31
|
+
expect(subject.repository).to be_a(Rugged::Repository)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'when initialized with a revision' do
|
|
36
|
+
let(:revision) { subject.repository.last_commit.oid }
|
|
37
|
+
before do
|
|
38
|
+
subject.instance_variable_set('@revision', revision)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'returns the commit' do
|
|
42
|
+
expect(subject.send(:commit).oid).to eql(revision)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
18
45
|
end
|
|
19
46
|
|
|
20
47
|
it 'returns the license' do
|
|
@@ -23,12 +50,12 @@
|
|
|
23
50
|
end
|
|
24
51
|
|
|
25
52
|
it 'returns the matched file' do
|
|
26
|
-
expect(subject.matched_file).to be_a(Licensee::
|
|
53
|
+
expect(subject.matched_file).to be_a(Licensee::ProjectFiles::LicenseFile)
|
|
27
54
|
expect(subject.matched_file.filename).to eql('LICENSE.txt')
|
|
28
55
|
end
|
|
29
56
|
|
|
30
57
|
it 'returns the license file' do
|
|
31
|
-
expect(subject.license_file).to be_a(Licensee::
|
|
58
|
+
expect(subject.license_file).to be_a(Licensee::ProjectFiles::LicenseFile)
|
|
32
59
|
expect(subject.license_file.filename).to eql('LICENSE.txt')
|
|
33
60
|
end
|
|
34
61
|
|
|
@@ -47,7 +74,7 @@
|
|
|
47
74
|
expect(files.count).to eql(2)
|
|
48
75
|
expect(files.first[:name]).to eql('LICENSE.txt')
|
|
49
76
|
|
|
50
|
-
if described_class == Licensee::GitProject
|
|
77
|
+
if described_class == Licensee::Projects::GitProject
|
|
51
78
|
expect(files.first).to have_key(:oid)
|
|
52
79
|
end
|
|
53
80
|
end
|
|
@@ -56,6 +83,31 @@
|
|
|
56
83
|
content = subject.send(:load_file, files.first)
|
|
57
84
|
expect(content).to match('Permission is hereby granted')
|
|
58
85
|
end
|
|
86
|
+
|
|
87
|
+
if described_class == Licensee::Projects::FSProject
|
|
88
|
+
context 'with search root argument' do
|
|
89
|
+
let(:fixture) { 'license-in-parent-folder/license-folder/package' }
|
|
90
|
+
let(:path) { fixture_path(fixture) }
|
|
91
|
+
let(:license_folder) { 'license-in-parent-folder/license-folder' }
|
|
92
|
+
let(:search_root) { fixture_path(license_folder) }
|
|
93
|
+
let(:subject) { described_class.new(path, search_root: search_root) }
|
|
94
|
+
let(:files) { subject.send(:files) }
|
|
95
|
+
|
|
96
|
+
it 'looks for licenses in parent directories up to the search root' do
|
|
97
|
+
# should not include the license in 'license-in-parent-folder' dir
|
|
98
|
+
expect(files.count).to eql(1)
|
|
99
|
+
expect(files.first[:name]).to eql('LICENSE.txt')
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
context 'without search root argument' do
|
|
104
|
+
let(:fixture) { 'license-in-parent-folder/license-folder/package' }
|
|
105
|
+
|
|
106
|
+
it 'looks for licenses in current directory only' do
|
|
107
|
+
expect(files.count).to eql(0)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
59
111
|
end
|
|
60
112
|
|
|
61
113
|
context 'encoding correctness' do
|
|
@@ -73,7 +125,7 @@
|
|
|
73
125
|
subject { described_class.new(path, detect_readme: true) }
|
|
74
126
|
|
|
75
127
|
it 'returns the readme' do
|
|
76
|
-
expect(subject.readme_file).to be_a(Licensee::
|
|
128
|
+
expect(subject.readme_file).to be_a(Licensee::ProjectFiles::ReadmeFile)
|
|
77
129
|
expect(subject.readme_file.filename).to eql('README.md')
|
|
78
130
|
end
|
|
79
131
|
|
|
@@ -89,7 +141,7 @@
|
|
|
89
141
|
# Using a `.gemspec` extension in the fixture breaks `gem release`
|
|
90
142
|
before do
|
|
91
143
|
FileUtils.cp("#{path}/project._gemspec", "#{path}/project.gemspec")
|
|
92
|
-
if described_class == Licensee::GitProject
|
|
144
|
+
if described_class == Licensee::Projects::GitProject
|
|
93
145
|
Dir.chdir path do
|
|
94
146
|
`git add project.gemspec`
|
|
95
147
|
`git commit -m 'add real gemspec'`
|
|
@@ -104,7 +156,8 @@
|
|
|
104
156
|
subject { described_class.new(path, detect_packages: true) }
|
|
105
157
|
|
|
106
158
|
it 'returns the package file' do
|
|
107
|
-
|
|
159
|
+
expected = Licensee::ProjectFiles::PackageManagerFile
|
|
160
|
+
expect(subject.package_file).to be_a(expected)
|
|
108
161
|
expect(subject.package_file.filename).to eql('project.gemspec')
|
|
109
162
|
end
|
|
110
163
|
|
|
@@ -113,5 +166,77 @@
|
|
|
113
166
|
expect(subject.license).to eql(mit)
|
|
114
167
|
end
|
|
115
168
|
end
|
|
169
|
+
|
|
170
|
+
context 'multiple licenses' do
|
|
171
|
+
let(:fixture) { 'multiple-license-files' }
|
|
172
|
+
|
|
173
|
+
it 'returns other for license' do
|
|
174
|
+
expect(subject.license).to eql(other)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it 'returns nil for matched_file' do
|
|
178
|
+
expect(subject.matched_file).to be_nil
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it 'returns nil for license_file' do
|
|
182
|
+
expect(subject.license_file).to be_nil
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it 'returns both licenses' do
|
|
186
|
+
expect(subject.licenses.count).to eql(2)
|
|
187
|
+
expect(subject.licenses.first).to eql(Licensee::License.find('mpl-2.0'))
|
|
188
|
+
expect(subject.licenses.last).to eql(mit)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
it 'returns both matched_files' do
|
|
192
|
+
expect(subject.matched_files.count).to eql(2)
|
|
193
|
+
expect(subject.matched_files.first.filename).to eql('LICENSE')
|
|
194
|
+
expect(subject.matched_files.last.filename).to eql('LICENSE.txt')
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
it 'returns both license_files' do
|
|
198
|
+
expect(subject.license_files.count).to eql(2)
|
|
199
|
+
expect(subject.license_files.first.filename).to eql('LICENSE')
|
|
200
|
+
expect(subject.license_files.last.filename).to eql('LICENSE.txt')
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
context 'lgpl' do
|
|
205
|
+
let(:gpl) { Licensee::License.find('gpl-3.0') }
|
|
206
|
+
let(:lgpl) { Licensee::License.find('lgpl-3.0') }
|
|
207
|
+
let(:fixture) { 'lgpl' }
|
|
208
|
+
|
|
209
|
+
it 'license returns lgpl' do
|
|
210
|
+
expect(subject.license).to eql(lgpl)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
it 'matched_file returns copying.lesser' do
|
|
214
|
+
expect(subject.matched_file).to_not be_nil
|
|
215
|
+
expect(subject.matched_file.filename).to eql('COPYING.lesser')
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it 'license_file returns copying.lesser' do
|
|
219
|
+
expect(subject.license_file).to_not be_nil
|
|
220
|
+
expect(subject.license_file.filename).to eql('COPYING.lesser')
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
it 'returns both licenses' do
|
|
224
|
+
expect(subject.licenses.count).to eql(2)
|
|
225
|
+
expect(subject.licenses.first).to eql(lgpl)
|
|
226
|
+
expect(subject.licenses.last).to eql(gpl)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
it 'returns both matched_files' do
|
|
230
|
+
expect(subject.matched_files.count).to eql(2)
|
|
231
|
+
expect(subject.matched_files.first.filename).to eql('COPYING.lesser')
|
|
232
|
+
expect(subject.matched_files.last.filename).to eql('LICENSE')
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
it 'returns both license_files' do
|
|
236
|
+
expect(subject.license_files.count).to eql(2)
|
|
237
|
+
expect(subject.license_files.first.filename).to eql('COPYING.lesser')
|
|
238
|
+
expect(subject.license_files.last.filename).to eql('LICENSE')
|
|
239
|
+
end
|
|
240
|
+
end
|
|
116
241
|
end
|
|
117
242
|
end
|
data/spec/licensee_spec.rb
CHANGED
|
@@ -18,20 +18,21 @@ RSpec.describe Licensee do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'inits a project' do
|
|
21
|
-
expect(Licensee.project(project_path)).to be_a(Licensee::Project)
|
|
21
|
+
expect(Licensee.project(project_path)).to be_a(Licensee::Projects::Project)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
context 'confidence threshold' do
|
|
25
25
|
it 'exposes the confidence threshold' do
|
|
26
|
-
expect(described_class.confidence_threshold).to eql(
|
|
26
|
+
expect(described_class.confidence_threshold).to eql(98)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it 'exposes the inverse of the confidence threshold' do
|
|
30
|
-
expect(described_class.inverse_confidence_threshold).to eql(0.
|
|
30
|
+
expect(described_class.inverse_confidence_threshold).to eql(0.02)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
context 'user overridden' do
|
|
34
34
|
before { Licensee.confidence_threshold = 50 }
|
|
35
|
+
after { Licensee.confidence_threshold = nil }
|
|
35
36
|
|
|
36
37
|
it 'lets the user override the confidence threshold' do
|
|
37
38
|
expect(described_class.confidence_threshold).to eql(50)
|
data/spec/spec_helper.rb
CHANGED
|
@@ -36,29 +36,16 @@ def sub_copyright_info(text)
|
|
|
36
36
|
text
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def wrap(text, line_width = 80)
|
|
40
|
-
text = text.clone
|
|
41
|
-
text.gsub!(/([^\n])\n([^\n])/, '\1 \2')
|
|
42
|
-
|
|
43
|
-
text = text.split("\n").collect do |line|
|
|
44
|
-
if line.length > line_width
|
|
45
|
-
line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip
|
|
46
|
-
else
|
|
47
|
-
line
|
|
48
|
-
end
|
|
49
|
-
end * "\n"
|
|
50
|
-
|
|
51
|
-
text.strip
|
|
52
|
-
end
|
|
53
|
-
|
|
54
39
|
# Add random words to the end of a license to test similarity tollerances
|
|
55
40
|
def add_random_words(string, count = 5)
|
|
56
|
-
|
|
57
|
-
ipsum =
|
|
41
|
+
words = string.dup.split(' ')
|
|
42
|
+
ipsum = File.read(fixture_path('ipsum.txt')).split(' ')
|
|
58
43
|
count.times do
|
|
59
|
-
|
|
44
|
+
word = ipsum[Random.rand(ipsum.length)]
|
|
45
|
+
index = Random.rand(words.length)
|
|
46
|
+
words.insert(index, word)
|
|
60
47
|
end
|
|
61
|
-
|
|
48
|
+
words.join(' ')
|
|
62
49
|
end
|
|
63
50
|
|
|
64
51
|
# Init git dir
|
|
@@ -85,14 +72,15 @@ end
|
|
|
85
72
|
|
|
86
73
|
RSpec::Matchers.define :be_detected_as do |expected|
|
|
87
74
|
match do |actual|
|
|
88
|
-
@expected_as_array = [expected.
|
|
89
|
-
license_file = Licensee::
|
|
75
|
+
@expected_as_array = [expected.content_normalized(wrap: 80)]
|
|
76
|
+
license_file = Licensee::ProjectFiles::LicenseFile.new(actual, 'LICENSE')
|
|
77
|
+
@actual = license_file.content_normalized(wrap: 80)
|
|
90
78
|
return false unless license_file.license
|
|
91
79
|
values_match? expected, license_file.license
|
|
92
80
|
end
|
|
93
81
|
|
|
94
82
|
failure_message do |actual|
|
|
95
|
-
license_file = Licensee::
|
|
83
|
+
license_file = Licensee::ProjectFiles::LicenseFile.new(actual, 'LICENSE')
|
|
96
84
|
license_name = expected.meta['spdx-id'] || expected.key
|
|
97
85
|
similarity = expected.similarity(license_file)
|
|
98
86
|
msg = "Expected the content to match the #{license_name} license"
|
|
@@ -101,9 +89,10 @@ RSpec::Matchers.define :be_detected_as do |expected|
|
|
|
101
89
|
end
|
|
102
90
|
|
|
103
91
|
failure_message_when_negated do |actual|
|
|
104
|
-
license_file = Licensee::
|
|
92
|
+
license_file = Licensee::ProjectFiles::LicenseFile.new(actual, 'LICENSE')
|
|
105
93
|
license_name = expected.meta['spdx-id'] || expected.key
|
|
106
94
|
similarity = expected.similarity(license_file)
|
|
95
|
+
|
|
107
96
|
msg = "Expected the content to *not* match the #{license_name} license"
|
|
108
97
|
msg << " (#{format_percent(similarity)} similarity)"
|
|
109
98
|
end
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
RSpec.describe 'vendored
|
|
1
|
+
RSpec.describe 'vendored licenses' do
|
|
2
2
|
let(:filename) { 'LICENSE.txt' }
|
|
3
|
-
let(:license_file)
|
|
3
|
+
let(:license_file) do
|
|
4
|
+
Licensee::ProjectFiles::LicenseFile.new(content, filename)
|
|
5
|
+
end
|
|
4
6
|
let(:detected_license) { license_file.license if license_file }
|
|
5
7
|
let(:wtfpl) { Licensee::License.find('wtfpl') }
|
|
6
8
|
|
|
7
9
|
Licensee.licenses(hidden: true).each do |license|
|
|
8
10
|
next if license.pseudo_license?
|
|
9
11
|
|
|
10
|
-
context "the #{license.
|
|
12
|
+
context "the #{license.name} license" do
|
|
11
13
|
let(:content_with_copyright) { sub_copyright_info(license.content) }
|
|
12
14
|
let(:content) { content_with_copyright }
|
|
13
15
|
|
|
@@ -17,8 +19,10 @@ RSpec.describe 'vendored licenes' do
|
|
|
17
19
|
|
|
18
20
|
context 'when modified' do
|
|
19
21
|
let(:line_length) { 60 }
|
|
20
|
-
let(:random_words) {
|
|
21
|
-
let(:content_rewrapped)
|
|
22
|
+
let(:random_words) { 75 }
|
|
23
|
+
let(:content_rewrapped) do
|
|
24
|
+
Licensee::ContentHelper.wrap(content_with_copyright, line_length)
|
|
25
|
+
end
|
|
22
26
|
let(:content_with_random_words) do
|
|
23
27
|
add_random_words(content_with_copyright, random_words)
|
|
24
28
|
end
|
|
@@ -27,7 +31,6 @@ RSpec.describe 'vendored licenes' do
|
|
|
27
31
|
let(:content) { wtfpl.send :strip_title, content_with_copyright }
|
|
28
32
|
|
|
29
33
|
it 'detects the license' do
|
|
30
|
-
skip 'The WTFPL is too short to be modified' if license == wtfpl
|
|
31
34
|
expect(content).to be_detected_as(license)
|
|
32
35
|
end
|
|
33
36
|
end
|
|
@@ -53,18 +56,18 @@ RSpec.describe 'vendored licenes' do
|
|
|
53
56
|
context 'with random words added' do
|
|
54
57
|
let(:content) { content_with_random_words }
|
|
55
58
|
|
|
56
|
-
it '
|
|
57
|
-
|
|
58
|
-
expect(content).to be_detected_as(license)
|
|
59
|
+
it 'does not match the license' do
|
|
60
|
+
expect(content).to_not be_detected_as(license)
|
|
59
61
|
end
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
context 'when rewrapped with random words added' do
|
|
63
|
-
let(:content)
|
|
65
|
+
let(:content) do
|
|
66
|
+
Licensee::ContentHelper.wrap(content_with_random_words, line_length)
|
|
67
|
+
end
|
|
64
68
|
|
|
65
|
-
it '
|
|
66
|
-
|
|
67
|
-
expect(content).to be_detected_as(license)
|
|
69
|
+
it 'does not match the license' do
|
|
70
|
+
expect(content).to_not be_detected_as(license)
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: licensee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 9.0.0.beta.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Balter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rugged
|
|
@@ -108,21 +108,26 @@ files:
|
|
|
108
108
|
- lib/licensee.rb
|
|
109
109
|
- lib/licensee/content_helper.rb
|
|
110
110
|
- lib/licensee/license.rb
|
|
111
|
-
- lib/licensee/matchers
|
|
112
|
-
- lib/licensee/matchers/
|
|
113
|
-
- lib/licensee/matchers/
|
|
114
|
-
- lib/licensee/matchers/
|
|
115
|
-
- lib/licensee/matchers/
|
|
116
|
-
- lib/licensee/matchers/
|
|
117
|
-
- lib/licensee/matchers/
|
|
118
|
-
- lib/licensee/matchers/
|
|
119
|
-
- lib/licensee/
|
|
120
|
-
- lib/licensee/
|
|
111
|
+
- lib/licensee/matchers.rb
|
|
112
|
+
- lib/licensee/matchers/cabal.rb
|
|
113
|
+
- lib/licensee/matchers/copyright.rb
|
|
114
|
+
- lib/licensee/matchers/cran.rb
|
|
115
|
+
- lib/licensee/matchers/dice.rb
|
|
116
|
+
- lib/licensee/matchers/dist_zilla.rb
|
|
117
|
+
- lib/licensee/matchers/exact.rb
|
|
118
|
+
- lib/licensee/matchers/gemspec.rb
|
|
119
|
+
- lib/licensee/matchers/matcher.rb
|
|
120
|
+
- lib/licensee/matchers/npm_bower.rb
|
|
121
|
+
- lib/licensee/matchers/package.rb
|
|
122
|
+
- lib/licensee/project_files.rb
|
|
121
123
|
- lib/licensee/project_files/license_file.rb
|
|
122
|
-
- lib/licensee/project_files/
|
|
123
|
-
- lib/licensee/project_files/
|
|
124
|
+
- lib/licensee/project_files/package_manager_file.rb
|
|
125
|
+
- lib/licensee/project_files/project_file.rb
|
|
126
|
+
- lib/licensee/project_files/readme_file.rb
|
|
127
|
+
- lib/licensee/projects.rb
|
|
124
128
|
- lib/licensee/projects/fs_project.rb
|
|
125
129
|
- lib/licensee/projects/git_project.rb
|
|
130
|
+
- lib/licensee/projects/project.rb
|
|
126
131
|
- lib/licensee/rule.rb
|
|
127
132
|
- lib/licensee/version.rb
|
|
128
133
|
- spec/bin_spec.rb
|
|
@@ -130,22 +135,29 @@ files:
|
|
|
130
135
|
- spec/fixtures/cc-by-nc-sa/LICENSE
|
|
131
136
|
- spec/fixtures/cc-by-nd/LICENSE
|
|
132
137
|
- spec/fixtures/copyright-encoding/COPYING
|
|
138
|
+
- spec/fixtures/crlf-license/LICENSE
|
|
133
139
|
- spec/fixtures/description-license/DESCRIPTION
|
|
134
140
|
- spec/fixtures/description-license/LICENSE
|
|
135
141
|
- spec/fixtures/fcpl-modified-mpl/LICENSE
|
|
136
142
|
- spec/fixtures/gemspec/project._gemspec
|
|
137
143
|
- spec/fixtures/gpl3-without-instructions/LICENSE
|
|
144
|
+
- spec/fixtures/ipsum.txt
|
|
138
145
|
- spec/fixtures/lgpl/COPYING.lesser
|
|
139
146
|
- spec/fixtures/lgpl/LICENSE
|
|
140
147
|
- spec/fixtures/license-folder/README.md
|
|
148
|
+
- spec/fixtures/license-in-parent-folder/LICENSE.txt
|
|
149
|
+
- spec/fixtures/license-in-parent-folder/license-folder/LICENSE.txt
|
|
141
150
|
- spec/fixtures/mit/LICENSE.txt
|
|
142
151
|
- spec/fixtures/mit/README.md
|
|
143
152
|
- spec/fixtures/mpl-without-hrs/LICENSE
|
|
153
|
+
- spec/fixtures/multiple-license-files/LICENSE
|
|
154
|
+
- spec/fixtures/multiple-license-files/LICENSE.txt
|
|
144
155
|
- spec/fixtures/readme/README.md
|
|
145
156
|
- spec/fixtures/wrk-modified-apache/LICENSE
|
|
146
157
|
- spec/integration_spec.rb
|
|
147
158
|
- spec/licensee/content_helper_spec.rb
|
|
148
159
|
- spec/licensee/license_spec.rb
|
|
160
|
+
- spec/licensee/matchers/cabal_matcher_spec.rb
|
|
149
161
|
- spec/licensee/matchers/copyright_matcher_spec.rb
|
|
150
162
|
- spec/licensee/matchers/cran_matcher_spec.rb
|
|
151
163
|
- spec/licensee/matchers/dice_matcher_spec.rb
|
|
@@ -156,11 +168,11 @@ files:
|
|
|
156
168
|
- spec/licensee/matchers/package_matcher_spec.rb
|
|
157
169
|
- spec/licensee/project_files/license_file_spec.rb
|
|
158
170
|
- spec/licensee/project_files/package_info_spec.rb
|
|
171
|
+
- spec/licensee/project_files/project_file_spec.rb
|
|
159
172
|
- spec/licensee/project_files/readme_spec.rb
|
|
160
173
|
- spec/licensee/project_spec.rb
|
|
161
174
|
- spec/licensee/rule_spec.rb
|
|
162
175
|
- spec/licensee_spec.rb
|
|
163
|
-
- spec/project_file_spec.rb
|
|
164
176
|
- spec/spec_helper.rb
|
|
165
177
|
- spec/vendored_license_spec.rb
|
|
166
178
|
- vendor/choosealicense.com/_data/fields.yml
|
|
@@ -211,9 +223,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
211
223
|
version: '2.1'
|
|
212
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
225
|
requirements:
|
|
214
|
-
- - "
|
|
226
|
+
- - ">"
|
|
215
227
|
- !ruby/object:Gem::Version
|
|
216
|
-
version:
|
|
228
|
+
version: 1.3.1
|
|
217
229
|
requirements: []
|
|
218
230
|
rubyforge_project:
|
|
219
231
|
rubygems_version: 2.6.11
|