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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +1 -1
  3. data/bin/licensee +42 -28
  4. data/lib/licensee.rb +14 -28
  5. data/lib/licensee/content_helper.rb +38 -12
  6. data/lib/licensee/license.rb +22 -9
  7. data/lib/licensee/matchers.rb +14 -0
  8. data/lib/licensee/matchers/cabal.rb +16 -0
  9. data/lib/licensee/matchers/{copyright_matcher.rb → copyright.rb} +1 -5
  10. data/lib/licensee/matchers/{cran_matcher.rb → cran.rb} +1 -1
  11. data/lib/licensee/matchers/{dice_matcher.rb → dice.rb} +1 -7
  12. data/lib/licensee/matchers/{dist_zilla_matcher.rb → dist_zilla.rb} +1 -1
  13. data/lib/licensee/matchers/{exact_matcher.rb → exact.rb} +2 -1
  14. data/lib/licensee/matchers/gemspec.rb +24 -0
  15. data/lib/licensee/matchers/{package_matcher.rb → matcher.rb} +5 -3
  16. data/lib/licensee/matchers/{npm_bower_matcher.rb → npm_bower.rb} +2 -2
  17. data/lib/licensee/matchers/package.rb +22 -0
  18. data/lib/licensee/project_files.rb +8 -0
  19. data/lib/licensee/project_files/license_file.rb +22 -4
  20. data/lib/licensee/project_files/package_manager_file.rb +37 -0
  21. data/lib/licensee/project_files/project_file.rb +65 -0
  22. data/lib/licensee/project_files/{readme.rb → readme_file.rb} +2 -2
  23. data/lib/licensee/projects.rb +7 -0
  24. data/lib/licensee/projects/fs_project.rb +64 -27
  25. data/lib/licensee/projects/git_project.rb +49 -43
  26. data/lib/licensee/projects/project.rb +149 -0
  27. data/lib/licensee/version.rb +1 -1
  28. data/spec/bin_spec.rb +9 -2
  29. data/spec/fixtures/crlf-license/LICENSE +674 -0
  30. data/spec/fixtures/fcpl-modified-mpl/LICENSE +193 -193
  31. data/spec/fixtures/ipsum.txt +19 -0
  32. data/spec/fixtures/license-in-parent-folder/LICENSE.txt +21 -0
  33. data/spec/fixtures/license-in-parent-folder/license-folder/LICENSE.txt +21 -0
  34. data/spec/fixtures/multiple-license-files/LICENSE +362 -0
  35. data/spec/fixtures/multiple-license-files/LICENSE.txt +21 -0
  36. data/spec/integration_spec.rb +57 -22
  37. data/spec/licensee/content_helper_spec.rb +33 -9
  38. data/spec/licensee/license_spec.rb +8 -1
  39. data/spec/licensee/matchers/cabal_matcher_spec.rb +45 -0
  40. data/spec/licensee/matchers/copyright_matcher_spec.rb +1 -1
  41. data/spec/licensee/matchers/cran_matcher_spec.rb +11 -2
  42. data/spec/licensee/matchers/dice_matcher_spec.rb +1 -2
  43. data/spec/licensee/matchers/dist_zilla_matcher_spec.rb +11 -2
  44. data/spec/licensee/matchers/exact_matcher_spec.rb +1 -1
  45. data/spec/licensee/matchers/gemspec_matcher_spec.rb +19 -1
  46. data/spec/licensee/matchers/npm_bower_matcher_spec.rb +23 -6
  47. data/spec/licensee/matchers/package_matcher_spec.rb +31 -2
  48. data/spec/licensee/project_files/license_file_spec.rb +62 -6
  49. data/spec/licensee/project_files/package_info_spec.rb +10 -1
  50. data/spec/{project_file_spec.rb → licensee/project_files/project_file_spec.rb} +14 -1
  51. data/spec/licensee/project_files/readme_spec.rb +1 -1
  52. data/spec/licensee/project_spec.rb +134 -9
  53. data/spec/licensee_spec.rb +4 -3
  54. data/spec/spec_helper.rb +12 -23
  55. data/spec/vendored_license_spec.rb +16 -13
  56. metadata +29 -17
  57. data/lib/licensee/matchers/gemspec_matcher.rb +0 -19
  58. data/lib/licensee/project.rb +0 -87
  59. data/lib/licensee/project_file.rb +0 -39
  60. data/lib/licensee/project_files/package_info.rb +0 -31
@@ -0,0 +1,362 @@
1
+ Mozilla Public License Version 2.0
2
+
3
+ 1. Definitions
4
+
5
+ 1.1. "Contributor"
6
+ means each individual or legal entity that creates, contributes to
7
+ the creation of, or owns Covered Software.
8
+
9
+ 1.2. "Contributor Version"
10
+ means the combination of the Contributions of others (if any) used
11
+ by a Contributor and that particular Contributor's Contribution.
12
+
13
+ 1.3. "Contribution"
14
+ means Covered Software of a particular Contributor.
15
+
16
+ 1.4. "Covered Software"
17
+ means Source Code Form to which the initial Contributor has attached
18
+ the notice in Exhibit A, the Executable Form of such Source Code
19
+ Form, and Modifications of such Source Code Form, in each case
20
+ including portions thereof.
21
+
22
+ 1.5. "Incompatible With Secondary Licenses"
23
+ means
24
+
25
+ (a) that the initial Contributor has attached the notice described
26
+ in Exhibit B to the Covered Software; or
27
+
28
+ (b) that the Covered Software was made available under the terms of
29
+ version 1.1 or earlier of the License, but not also under the
30
+ terms of a Secondary License.
31
+
32
+ 1.6. "Executable Form"
33
+ means any form of the work other than Source Code Form.
34
+
35
+ 1.7. "Larger Work"
36
+ means a work that combines Covered Software with other material, in
37
+ a separate file or files, that is not Covered Software.
38
+
39
+ 1.8. "License"
40
+ means this document.
41
+
42
+ 1.9. "Licensable"
43
+ means having the right to grant, to the maximum extent possible,
44
+ whether at the time of the initial grant or subsequently, any and
45
+ all of the rights conveyed by this License.
46
+
47
+ 1.10. "Modifications"
48
+ means any of the following:
49
+
50
+ (a) any file in Source Code Form that results from an addition to,
51
+ deletion from, or modification of the contents of Covered
52
+ Software; or
53
+
54
+ (b) any new file in Source Code Form that contains any Covered
55
+ Software.
56
+
57
+ 1.11. "Patent Claims" of a Contributor
58
+ means any patent claim(s), including without limitation, method,
59
+ process, and apparatus claims, in any patent Licensable by such
60
+ Contributor that would be infringed, but for the grant of the
61
+ License, by the making, using, selling, offering for sale, having
62
+ made, import, or transfer of either its Contributions or its
63
+ Contributor Version.
64
+
65
+ 1.12. "Secondary License"
66
+ means either the GNU General Public License, Version 2.0, the GNU
67
+ Lesser General Public License, Version 2.1, the GNU Affero General
68
+ Public License, Version 3.0, or any later versions of those
69
+ licenses.
70
+
71
+ 1.13. "Source Code Form"
72
+ means the form of the work preferred for making modifications.
73
+
74
+ 1.14. "You" (or "Your")
75
+ means an individual or a legal entity exercising rights under this
76
+ License. For legal entities, "You" includes any entity that
77
+ controls, is controlled by, or is under common control with You. For
78
+ purposes of this definition, "control" means (a) the power, direct
79
+ or indirect, to cause the direction or management of such entity,
80
+ whether by contract or otherwise, or (b) ownership of more than
81
+ fifty percent (50%) of the outstanding shares or beneficial
82
+ ownership of such entity.
83
+
84
+ 2. License Grants and Conditions
85
+
86
+ 2.1. Grants
87
+
88
+ Each Contributor hereby grants You a world-wide, royalty-free,
89
+ non-exclusive license:
90
+
91
+ (a) under intellectual property rights (other than patent or trademark)
92
+ Licensable by such Contributor to use, reproduce, make available,
93
+ modify, display, perform, distribute, and otherwise exploit its
94
+ Contributions, either on an unmodified basis, with Modifications, or
95
+ as part of a Larger Work; and
96
+
97
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
98
+ for sale, have made, import, and otherwise transfer either its
99
+ Contributions or its Contributor Version.
100
+
101
+ 2.2. Effective Date
102
+
103
+ The licenses granted in Section 2.1 with respect to any Contribution
104
+ become effective for each Contribution on the date the Contributor first
105
+ distributes such Contribution.
106
+
107
+ 2.3. Limitations on Grant Scope
108
+
109
+ The licenses granted in this Section 2 are the only rights granted under
110
+ this License. No additional rights or licenses will be implied from the
111
+ distribution or licensing of Covered Software under this License.
112
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
113
+ Contributor:
114
+
115
+ (a) for any code that a Contributor has removed from Covered Software;
116
+ or
117
+
118
+ (b) for infringements caused by: (i) Your and any other third party's
119
+ modifications of Covered Software, or (ii) the combination of its
120
+ Contributions with other software (except as part of its Contributor
121
+ Version); or
122
+
123
+ (c) under Patent Claims infringed by Covered Software in the absence of
124
+ its Contributions.
125
+
126
+ This License does not grant any rights in the trademarks, service marks,
127
+ or logos of any Contributor (except as may be necessary to comply with
128
+ the notice requirements in Section 3.4).
129
+
130
+ 2.4. Subsequent Licenses
131
+
132
+ No Contributor makes additional grants as a result of Your choice to
133
+ distribute the Covered Software under a subsequent version of this
134
+ License (see Section 10.2) or under the terms of a Secondary License (if
135
+ permitted under the terms of Section 3.3).
136
+
137
+ 2.5. Representation
138
+
139
+ Each Contributor represents that the Contributor believes its
140
+ Contributions are its original creation(s) or it has sufficient rights
141
+ to grant the rights to its Contributions conveyed by this License.
142
+
143
+ 2.6. Fair Use
144
+
145
+ This License is not intended to limit any rights You have under
146
+ applicable copyright doctrines of fair use, fair dealing, or other
147
+ equivalents.
148
+
149
+ 2.7. Conditions
150
+
151
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
152
+ in Section 2.1.
153
+
154
+ 3. Responsibilities
155
+
156
+ 3.1. Distribution of Source Form
157
+
158
+ All distribution of Covered Software in Source Code Form, including any
159
+ Modifications that You create or to which You contribute, must be under
160
+ the terms of this License. You must inform recipients that the Source
161
+ Code Form of the Covered Software is governed by the terms of this
162
+ License, and how they can obtain a copy of this License. You may not
163
+ attempt to alter or restrict the recipients' rights in the Source Code
164
+ Form.
165
+
166
+ 3.2. Distribution of Executable Form
167
+
168
+ If You distribute Covered Software in Executable Form then:
169
+
170
+ (a) such Covered Software must also be made available in Source Code
171
+ Form, as described in Section 3.1, and You must inform recipients of
172
+ the Executable Form how they can obtain a copy of such Source Code
173
+ Form by reasonable means in a timely manner, at a charge no more
174
+ than the cost of distribution to the recipient; and
175
+
176
+ (b) You may distribute such Executable Form under the terms of this
177
+ License, or sublicense it under different terms, provided that the
178
+ license for the Executable Form does not attempt to limit or alter
179
+ the recipients' rights in the Source Code Form under this License.
180
+
181
+ 3.3. Distribution of a Larger Work
182
+
183
+ You may create and distribute a Larger Work under terms of Your choice,
184
+ provided that You also comply with the requirements of this License for
185
+ the Covered Software. If the Larger Work is a combination of Covered
186
+ Software with a work governed by one or more Secondary Licenses, and the
187
+ Covered Software is not Incompatible With Secondary Licenses, this
188
+ License permits You to additionally distribute such Covered Software
189
+ under the terms of such Secondary License(s), so that the recipient of
190
+ the Larger Work may, at their option, further distribute the Covered
191
+ Software under the terms of either this License or such Secondary
192
+ License(s).
193
+
194
+ 3.4. Notices
195
+
196
+ You may not remove or alter the substance of any license notices
197
+ (including copyright notices, patent notices, disclaimers of warranty,
198
+ or limitations of liability) contained within the Source Code Form of
199
+ the Covered Software, except that You may alter any license notices to
200
+ the extent required to remedy known factual inaccuracies.
201
+
202
+ 3.5. Application of Additional Terms
203
+
204
+ You may choose to offer, and to charge a fee for, warranty, support,
205
+ indemnity or liability obligations to one or more recipients of Covered
206
+ Software. However, You may do so only on Your own behalf, and not on
207
+ behalf of any Contributor. You must make it absolutely clear that any
208
+ such warranty, support, indemnity, or liability obligation is offered by
209
+ You alone, and You hereby agree to indemnify every Contributor for any
210
+ liability incurred by such Contributor as a result of warranty, support,
211
+ indemnity or liability terms You offer. You may include additional
212
+ disclaimers of warranty and limitations of liability specific to any
213
+ jurisdiction.
214
+
215
+ 4. Inability to Comply Due to Statute or Regulation
216
+
217
+ If it is impossible for You to comply with any of the terms of this
218
+ License with respect to some or all of the Covered Software due to
219
+ statute, judicial order, or regulation then You must: (a) comply with
220
+ the terms of this License to the maximum extent possible; and (b)
221
+ describe the limitations and the code they affect. Such description must
222
+ be placed in a text file included with all distributions of the Covered
223
+ Software under this License. Except to the extent prohibited by statute
224
+ or regulation, such description must be sufficiently detailed for a
225
+ recipient of ordinary skill to be able to understand it.
226
+
227
+ 5. Termination
228
+
229
+ 5.1. The rights granted under this License will terminate automatically
230
+ if You fail to comply with any of its terms. However, if You become
231
+ compliant, then the rights granted under this License from a particular
232
+ Contributor are reinstated (a) provisionally, unless and until such
233
+ Contributor explicitly and finally terminates Your grants, and (b) on an
234
+ ongoing basis, if such Contributor fails to notify You of the
235
+ non-compliance by some reasonable means prior to 60 days after You have
236
+ come back into compliance. Moreover, Your grants from a particular
237
+ Contributor are reinstated on an ongoing basis if such Contributor
238
+ notifies You of the non-compliance by some reasonable means, this is the
239
+ first time You have received notice of non-compliance with this License
240
+ from such Contributor, and You become compliant prior to 30 days after
241
+ Your receipt of the notice.
242
+
243
+ 5.2. If You initiate litigation against any entity by asserting a patent
244
+ infringement claim (excluding declaratory judgment actions,
245
+ counter-claims, and cross-claims) alleging that a Contributor Version
246
+ directly or indirectly infringes any patent, then the rights granted to
247
+ You by any and all Contributors for the Covered Software under Section
248
+ 2.1 of this License shall terminate.
249
+
250
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
251
+ end user license agreements (excluding distributors and resellers) which
252
+ have been validly granted by You or Your distributors under this License
253
+ prior to termination shall survive termination.
254
+
255
+ ************************************************************************
256
+ * *
257
+ * 6. Disclaimer of Warranty *
258
+ * ------------------------- *
259
+ * *
260
+ * Covered Software is provided under this License on an "as is" *
261
+ * basis, without warranty of any kind, either expressed, implied, or *
262
+ * statutory, including, without limitation, warranties that the *
263
+ * Covered Software is free of defects, merchantable, fit for a *
264
+ * particular purpose or non-infringing. The entire risk as to the *
265
+ * quality and performance of the Covered Software is with You. *
266
+ * Should any Covered Software prove defective in any respect, You *
267
+ * (not any Contributor) assume the cost of any necessary servicing, *
268
+ * repair, or correction. This disclaimer of warranty constitutes an *
269
+ * essential part of this License. No use of any Covered Software is *
270
+ * authorized under this License except under this disclaimer. *
271
+ * *
272
+ ************************************************************************
273
+
274
+ ************************************************************************
275
+ * *
276
+ * 7. Limitation of Liability *
277
+ * -------------------------- *
278
+ * *
279
+ * Under no circumstances and under no legal theory, whether tort *
280
+ * (including negligence), contract, or otherwise, shall any *
281
+ * Contributor, or anyone who distributes Covered Software as *
282
+ * permitted above, be liable to You for any direct, indirect, *
283
+ * special, incidental, or consequential damages of any character *
284
+ * including, without limitation, damages for lost profits, loss of *
285
+ * goodwill, work stoppage, computer failure or malfunction, or any *
286
+ * and all other commercial damages or losses, even if such party *
287
+ * shall have been informed of the possibility of such damages. This *
288
+ * limitation of liability shall not apply to liability for death or *
289
+ * personal injury resulting from such party's negligence to the *
290
+ * extent applicable law prohibits such limitation. Some *
291
+ * jurisdictions do not allow the exclusion or limitation of *
292
+ * incidental or consequential damages, so this exclusion and *
293
+ * limitation may not apply to You. *
294
+ * *
295
+ ************************************************************************
296
+
297
+ 8. Litigation
298
+
299
+ Any litigation relating to this License may be brought only in the
300
+ courts of a jurisdiction where the defendant maintains its principal
301
+ place of business and such litigation shall be governed by laws of that
302
+ jurisdiction, without reference to its conflict-of-law provisions.
303
+ Nothing in this Section shall prevent a party's ability to bring
304
+ cross-claims or counter-claims.
305
+
306
+ 9. Miscellaneous
307
+
308
+ This License represents the complete agreement concerning the subject
309
+ matter hereof. If any provision of this License is held to be
310
+ unenforceable, such provision shall be reformed only to the extent
311
+ necessary to make it enforceable. Any law or regulation which provides
312
+ that the language of a contract shall be construed against the drafter
313
+ shall not be used to construe this License against a Contributor.
314
+
315
+ 10. Versions of the License
316
+
317
+ 10.1. New Versions
318
+
319
+ Mozilla Foundation is the license steward. Except as provided in Section
320
+ 10.3, no one other than the license steward has the right to modify or
321
+ publish new versions of this License. Each version will be given a
322
+ distinguishing version number.
323
+
324
+ 10.2. Effect of New Versions
325
+
326
+ You may distribute the Covered Software under the terms of the version
327
+ of the License under which You originally received the Covered Software,
328
+ or under the terms of any subsequent version published by the license
329
+ steward.
330
+
331
+ 10.3. Modified Versions
332
+
333
+ If you create software not governed by this License, and you want to
334
+ create a new license for such software, you may create and use a
335
+ modified version of this License if you rename the license and remove
336
+ any references to the name of the license steward (except to note that
337
+ such modified license differs from this License).
338
+
339
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
340
+ Licenses
341
+
342
+ If You choose to distribute Source Code Form that is Incompatible With
343
+ Secondary Licenses under the terms of this version of the License, the
344
+ notice described in Exhibit B of this License must be attached.
345
+
346
+ Exhibit A - Source Code Form License Notice
347
+
348
+ This Source Code Form is subject to the terms of the Mozilla Public
349
+ License, v. 2.0. If a copy of the MPL was not distributed with this
350
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
351
+
352
+ If it is not possible or desirable to put the notice in a particular
353
+ file, then You may include the notice in a location (such as a LICENSE
354
+ file in a relevant directory) where a recipient would be likely to look
355
+ for such a notice.
356
+
357
+ You may add additional accurate notices of copyright ownership.
358
+
359
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
360
+
361
+ This Source Code Form is "Incompatible With Secondary Licenses", as
362
+ defined by the Mozilla Public License, v. 2.0.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Ben Balter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,8 +1,12 @@
1
1
  RSpec.describe 'integration test' do
2
- [Licensee::FSProject, Licensee::GitProject].each do |project_type|
2
+ [
3
+ Licensee::Projects::FSProject,
4
+ Licensee::Projects::GitProject
5
+ ].each do |project_type|
3
6
  context "with a #{project_type} project" do
4
7
  let(:filename) { 'LICENSE' }
5
8
  let(:license) { Licensee::License.find('mit') }
9
+ let(:other_license) { Licensee::License.find('other') }
6
10
  let(:content) { license.content }
7
11
  let(:license_path) { File.expand_path(filename, project_path) }
8
12
  let(:arguments) { {} }
@@ -14,7 +18,7 @@ RSpec.describe 'integration test' do
14
18
  let(:project_path) { fixture_path(fixture) }
15
19
  let(:git_path) { File.expand_path('.git', project_path) }
16
20
 
17
- if project_type == Licensee::GitProject
21
+ if project_type == Licensee::Projects::GitProject
18
22
  before { git_init(project_path) }
19
23
  after { FileUtils.rm_rf(git_path) }
20
24
  end
@@ -27,6 +31,28 @@ RSpec.describe 'integration test' do
27
31
  end
28
32
  end
29
33
 
34
+ context 'with no license files' do
35
+ let(:project_path) { Dir.mktmpdir }
36
+ let(:file_path) { File.expand_path('foo.md', project_path) }
37
+
38
+ before do
39
+ File.write(file_path, 'bar')
40
+ if project_type == Licensee::Projects::GitProject
41
+ git_init(project_path)
42
+ end
43
+ end
44
+
45
+ after { FileUtils.rm_rf(project_path) }
46
+
47
+ it 'returns nil' do
48
+ expect(subject.license).to be_nil
49
+ expect(subject.license_files).to be_empty
50
+
51
+ expect(subject.matched_file).to be_nil
52
+ expect(subject.matched_files).to be_empty
53
+ end
54
+ end
55
+
30
56
  context 'with LICENSE.lesser' do
31
57
  let(:license) { Licensee::License.find('lgpl-3.0') }
32
58
  let(:fixture) { 'lgpl' }
@@ -37,35 +63,43 @@ RSpec.describe 'integration test' do
37
63
  end
38
64
  end
39
65
 
66
+ context 'with multiple license files' do
67
+ let(:fixture) { 'multiple-license-files' }
68
+
69
+ it 'matches other' do
70
+ expect(subject.license).to eql(other_license)
71
+ end
72
+ end
73
+
40
74
  context 'with CC-BY-NC-SA' do
41
75
  let(:fixture) { 'cc-by-nc-sa' }
42
76
 
43
- it 'matches nothing' do
44
- expect(subject.license).to eql(nil)
77
+ it 'matches other' do
78
+ expect(subject.license).to eql(other_license)
45
79
  end
46
80
  end
47
81
 
48
82
  context 'with CC-BY-ND' do
49
83
  let(:fixture) { 'cc-by-nd' }
50
84
 
51
- it 'matches nothing' do
52
- expect(subject.license).to eql(nil)
85
+ it 'matches other' do
86
+ expect(subject.license).to eql(other_license)
53
87
  end
54
88
  end
55
89
 
56
90
  context 'with WRK Modified Apache 2.0.1' do
57
91
  let(:fixture) { 'wrk-modified-apache' }
58
92
 
59
- it 'matches nothing' do
60
- expect(subject.license).to eql(nil)
93
+ it 'matches other' do
94
+ expect(subject.license).to eql(other_license)
61
95
  end
62
96
  end
63
97
 
64
98
  context 'with FCPL Modified MPL' do
65
99
  let(:fixture) { 'fcpl-modified-mpl' }
66
100
 
67
- it 'matches nothing' do
68
- expect(subject.license).to eql(nil)
101
+ it 'matches other' do
102
+ expect(subject.license).to eql(other_license)
69
103
  end
70
104
  end
71
105
 
@@ -88,13 +122,21 @@ RSpec.describe 'integration test' do
88
122
  end
89
123
 
90
124
  context 'DESCRIPTION file with a LICENSE file' do
91
- let(:license) { Licensee::License.find('mit') }
92
125
  let(:fixture) { 'description-license' }
93
126
  let(:arguments) { { detect_packages: true } }
94
127
 
128
+ it 'matches other' do
129
+ expect(subject.license).to eql(other_license)
130
+ expect(subject.package_file.path).to eql('DESCRIPTION')
131
+ end
132
+ end
133
+
134
+ context 'A license with CRLF line-endings' do
135
+ let(:license) { Licensee::License.find('gpl-3.0') }
136
+ let(:fixture) { 'crlf-license' }
137
+
95
138
  it 'matches' do
96
139
  expect(subject.license).to eql(license)
97
- expect(subject.package_file.path).to eql('DESCRIPTION')
98
140
  end
99
141
  end
100
142
  end
@@ -104,7 +146,9 @@ RSpec.describe 'integration test' do
104
146
 
105
147
  before do
106
148
  File.write(license_path, content)
107
- git_init(project_path) if project_type == Licensee::GitProject
149
+ if project_type == Licensee::Projects::GitProject
150
+ git_init(project_path)
151
+ end
108
152
  end
109
153
 
110
154
  after { FileUtils.rm_rf(project_path) }
@@ -123,15 +167,6 @@ RSpec.describe 'integration test' do
123
167
  end
124
168
  end
125
169
 
126
- context 'an unlicensed project' do
127
- let(:content) { '' }
128
-
129
- it "doesn't match" do
130
- expect(subject.license).to be_nil
131
- expect(subject.license_file.path).to eql('LICENSE')
132
- end
133
- end
134
-
135
170
  context 'a package.json file' do
136
171
  let(:content) { '{"license": "mit"}' }
137
172
  let(:filename) { 'package.json' }