licensee 8.5.0 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -104
  3. data/bin/licensee +26 -12
  4. data/lib/licensee.rb +1 -0
  5. data/lib/licensee/license.rb +6 -2
  6. data/lib/licensee/matchers/copyright_matcher.rb +2 -0
  7. data/lib/licensee/matchers/cran_matcher.rb +20 -0
  8. data/lib/licensee/matchers/exact_matcher.rb +2 -0
  9. data/lib/licensee/project.rb +2 -1
  10. data/lib/licensee/project_file.rb +8 -2
  11. data/lib/licensee/project_files/license_file.rb +27 -6
  12. data/lib/licensee/project_files/package_info.rb +6 -1
  13. data/lib/licensee/project_files/readme.rb +2 -2
  14. data/lib/licensee/projects/fs_project.rb +0 -1
  15. data/lib/licensee/version.rb +1 -1
  16. data/spec/bin_spec.rb +56 -0
  17. data/spec/fixtures/case-sensitive/LiCeNsE.TxT +0 -0
  18. data/spec/fixtures/gemspec/project.gemspec +1 -0
  19. data/spec/fixtures/lgpl/COPYING.lesser +165 -0
  20. data/spec/fixtures/lgpl/LICENSE +674 -0
  21. data/spec/fixtures/license-folder/README.md +0 -0
  22. data/{test/fixtures/mit-without-title/mit.txt → spec/fixtures/mit/LICENSE.txt} +3 -1
  23. data/{test/fixtures/mit-with-redundant-title/mit.txt → spec/fixtures/mit/README.md} +4 -2
  24. data/spec/fixtures/mpl-without-hrs/LICENSE +362 -0
  25. data/spec/fixtures/readme/README.md +23 -0
  26. data/spec/integration_spec.rb +121 -0
  27. data/spec/licensee/content_helper_spec.rb +77 -0
  28. data/spec/licensee/license_spec.rb +224 -0
  29. data/spec/licensee/matchers/copyright_matcher_spec.rb +47 -0
  30. data/spec/licensee/matchers/cran_matcher_spec.rb +18 -0
  31. data/spec/licensee/matchers/dice_matcher_spec.rb +43 -0
  32. data/spec/licensee/matchers/exact_matcher_spec.rb +26 -0
  33. data/spec/licensee/matchers/gemspec_matcher_spec.rb +29 -0
  34. data/spec/licensee/matchers/npm_bower_matcher_spec.rb +31 -0
  35. data/spec/licensee/matchers/package_matcher_spec.rb +15 -0
  36. data/spec/licensee/project_files/license_file_spec.rb +122 -0
  37. data/spec/licensee/project_files/package_info_spec.rb +51 -0
  38. data/spec/licensee/project_files/readme_spec.rb +77 -0
  39. data/spec/licensee/project_spec.rb +91 -0
  40. data/spec/licensee_spec.rb +41 -0
  41. data/spec/project_file_spec.rb +33 -0
  42. data/spec/spec_helper.rb +78 -0
  43. data/spec/vendored_license_spec.rb +75 -0
  44. data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +48 -0
  45. data/vendor/choosealicense.com/_licenses/lgpl-3.0.txt +1 -1
  46. metadata +39 -111
  47. data/Rakefile +0 -12
  48. data/test/fixtures/apache-2.0/LICENSE +0 -201
  49. data/test/fixtures/bower-with-readme/README.md +0 -1
  50. data/test/fixtures/bower-with-readme/bower.json +0 -3
  51. data/test/fixtures/bower/bower.json +0 -3
  52. data/test/fixtures/bsd-2-clause-without-title/bsd-2-clause.txt +0 -23
  53. data/test/fixtures/bsd-3-clause-without-title/bsd-3-clause.txt +0 -27
  54. data/test/fixtures/case-sensitive.git/HEAD +0 -1
  55. data/test/fixtures/case-sensitive.git/config +0 -6
  56. data/test/fixtures/case-sensitive.git/objects/01/7b4f1eebd1dcb735e950b1d01093e3e2bf85e9 +0 -0
  57. data/test/fixtures/case-sensitive.git/objects/2c/b878e0851c5cf53d7455d9018baa6755a38bd7 +0 -0
  58. data/test/fixtures/case-sensitive.git/objects/fb/ddf40ba5f30225af7cd9841afe374ca5800cb9 +0 -0
  59. data/test/fixtures/case-sensitive.git/refs/heads/master +0 -1
  60. data/test/fixtures/isc-without-title/isc.txt +0 -13
  61. data/test/fixtures/lgpl.git/HEAD +0 -1
  62. data/test/fixtures/lgpl.git/config +0 -5
  63. data/test/fixtures/lgpl.git/objects/1a/cd060ebbbeac294200008657d9502130f93465 +0 -2
  64. data/test/fixtures/lgpl.git/objects/4b/1f98c1e95b6d4dae0b0a160f554be97e5afece +0 -2
  65. data/test/fixtures/lgpl.git/objects/a4/cfa42bc8e1d432fa851c5c4e3f294f01e05fd3 +0 -0
  66. data/test/fixtures/lgpl.git/objects/b7/de6e186bd02935030f5d42867ea7043fb1c27c +0 -0
  67. data/test/fixtures/lgpl.git/objects/dd/d0e017b1bf39218a6ea4f2fadd29a7ea8ebe03 +0 -0
  68. data/test/fixtures/lgpl.git/objects/eb/d853e83a2d317422c52f3922f4c9c5bb4a10b7 +0 -0
  69. data/test/fixtures/lgpl.git/refs/heads/master +0 -1
  70. data/test/fixtures/licence.git/HEAD +0 -1
  71. data/test/fixtures/licence.git/config +0 -6
  72. data/test/fixtures/licence.git/objects/66/0c086dc25f9f3b96e7afd9dee8a11b4e614543 +0 -0
  73. data/test/fixtures/licence.git/objects/68/804815597f79aa323de3257a8fd7b76449943c +0 -0
  74. data/test/fixtures/licence.git/objects/dd/59aed84c5aa4dff7ceda11a1c045f831194067 +0 -0
  75. data/test/fixtures/licence.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  76. data/test/fixtures/licence.git/refs/heads/master +0 -1
  77. data/test/fixtures/license-folder.git/HEAD +0 -1
  78. data/test/fixtures/license-folder.git/config +0 -6
  79. data/test/fixtures/license-folder.git/objects/32/6d0761f0c54d54327ea9e127e02d9bae14d2c8 +0 -2
  80. data/test/fixtures/license-folder.git/objects/93/109217bbe2937fc3a8d8933fddd80ed6292481 +0 -0
  81. data/test/fixtures/license-folder.git/objects/c6/6e45436e4f3fda934dc7268bccbc59c37a67b4 +0 -0
  82. data/test/fixtures/license-folder.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  83. data/test/fixtures/license-folder.git/refs/heads/master +0 -1
  84. data/test/fixtures/licenses.git/HEAD +0 -1
  85. data/test/fixtures/licenses.git/config +0 -4
  86. data/test/fixtures/licenses.git/objects/51/a11d50f29a14774ded8f7b90ba9938dce78a92 +0 -3
  87. data/test/fixtures/licenses.git/objects/5e/df454e6517673d5e64a33cf284308b9c6b1075 +0 -0
  88. data/test/fixtures/licenses.git/objects/e1/b4dc13f4bf683ce8f2943e051c3e91e778d043 +0 -0
  89. data/test/fixtures/licenses.git/objects/info/packs +0 -2
  90. data/test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.idx +0 -0
  91. data/test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.pack +0 -0
  92. data/test/fixtures/licenses.git/packed-refs +0 -4
  93. data/test/fixtures/licenses.git/refs/heads/master +0 -1
  94. data/test/fixtures/mit-without-title-rewrapped/mit.txt +0 -19
  95. data/test/fixtures/mpl-without-hrs.git/HEAD +0 -1
  96. data/test/fixtures/mpl-without-hrs.git/config +0 -5
  97. data/test/fixtures/mpl-without-hrs.git/objects/45/26aa2d1d78ea20fb0faf59f2360a68fa897774 +0 -0
  98. data/test/fixtures/mpl-without-hrs.git/objects/ba/f5649b61fac4ed64ec2949fe5cd616b85a8298 +0 -0
  99. data/test/fixtures/mpl-without-hrs.git/objects/be/2cc4dfb609fb6c38f6365ec345bded3350dd63 +0 -0
  100. data/test/fixtures/mpl-without-hrs.git/refs/heads/master +0 -1
  101. data/test/fixtures/named-license-file-prefix.git/HEAD +0 -1
  102. data/test/fixtures/named-license-file-prefix.git/config +0 -6
  103. data/test/fixtures/named-license-file-prefix.git/objects/64/3983d3f82ecc2a7d8e4227946220ebffd477d2 +0 -4
  104. data/test/fixtures/named-license-file-prefix.git/objects/c9/b229e500e529fdbd4f50746ba207e91d0677b6 +0 -7
  105. data/test/fixtures/named-license-file-prefix.git/objects/d1/9223f355283b3ce0c51a2c527f685d0f403157 +0 -0
  106. data/test/fixtures/named-license-file-prefix.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  107. data/test/fixtures/named-license-file-prefix.git/refs/heads/master +0 -1
  108. data/test/fixtures/named-license-file-suffix.git/HEAD +0 -1
  109. data/test/fixtures/named-license-file-suffix.git/config +0 -6
  110. data/test/fixtures/named-license-file-suffix.git/objects/36/465372136f81a2089f486298ca77ef41611198 +0 -0
  111. data/test/fixtures/named-license-file-suffix.git/objects/4a/2a139e7fbd24eef5c5ef3d22f490e89405f6a3 +0 -3
  112. data/test/fixtures/named-license-file-suffix.git/objects/c9/b229e500e529fdbd4f50746ba207e91d0677b6 +0 -7
  113. data/test/fixtures/named-license-file-suffix.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  114. data/test/fixtures/named-license-file-suffix.git/refs/heads/master +0 -1
  115. data/test/fixtures/no-license.git/HEAD +0 -1
  116. data/test/fixtures/no-license.git/config +0 -6
  117. data/test/fixtures/no-license.git/objects/82/0c999cf27a6f71431646c404274c578f7a2869 +0 -0
  118. data/test/fixtures/no-license.git/objects/e1/d9b2a3d41c2ea74a520e66da2b5c63b2f6202f +0 -0
  119. data/test/fixtures/no-license.git/objects/ff/1592f44259635df9feda5e02853964b26f9e4d +0 -0
  120. data/test/fixtures/no-license.git/refs/heads/master +0 -1
  121. data/test/fixtures/npm-non-spdx/package.json +0 -3
  122. data/test/fixtures/npm.git/HEAD +0 -1
  123. data/test/fixtures/npm.git/config +0 -4
  124. data/test/fixtures/npm.git/objects/info/packs +0 -2
  125. data/test/fixtures/npm.git/objects/pack/pack-03c0879445cabcc37f91d97c7955465adef26f4a.idx +0 -0
  126. data/test/fixtures/npm.git/objects/pack/pack-03c0879445cabcc37f91d97c7955465adef26f4a.pack +0 -0
  127. data/test/fixtures/npm.git/packed-refs +0 -2
  128. data/test/fixtures/npm/package.json +0 -3
  129. data/test/functions.rb +0 -73
  130. data/test/helper.rb +0 -16
  131. data/test/licensee/matchers/test_copyright_matcher.rb +0 -59
  132. data/test/licensee/matchers/test_dice_matcher.rb +0 -60
  133. data/test/licensee/matchers/test_exact_matcher.rb +0 -25
  134. data/test/licensee/matchers/test_gemspec_matcher.rb +0 -11
  135. data/test/licensee/matchers/test_npm_bower_matcher.rb +0 -27
  136. data/test/licensee/matchers/test_package_matcher.rb +0 -27
  137. data/test/licensee/project_files/test_license_file.rb +0 -73
  138. data/test/licensee/project_files/test_package_info.rb +0 -19
  139. data/test/licensee/project_files/test_readme.rb +0 -47
  140. data/test/licensee/test_content_helper.rb +0 -81
  141. data/test/licensee/test_license.rb +0 -182
  142. data/test/licensee/test_project.rb +0 -134
  143. data/test/licensee/test_project_file.rb +0 -24
  144. data/test/test_licensee.rb +0 -40
  145. data/test/test_licensee_bin.rb +0 -37
  146. data/test/test_licensee_vendor.rb +0 -33
File without changes
@@ -1,4 +1,6 @@
1
- Copyright (c) 2015 Ben Balter
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Ben Balter
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,8 @@
1
- The MIT License (MIT)
1
+ # Readme fixture
2
2
 
3
- Copyright (c) 2015 Ben Balter
3
+ ## License
4
+
5
+ Copyright (c) 2016 Ben Balter
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
8
  of this software and associated documentation files (the "Software"), to deal
@@ -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,23 @@
1
+ # Readme fixture
2
+
3
+ ## License
4
+
5
+ Copyright (c) 2016 Ben Balter
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1,121 @@
1
+ RSpec.describe 'integration test' do
2
+ [Licensee::FSProject, Licensee::GitProject].each do |project_type|
3
+ context "with a #{project_type} project" do
4
+ let(:filename) { 'LICENSE' }
5
+ let(:license) { Licensee::License.find('mit') }
6
+ let(:content) { license.content }
7
+ let(:license_path) { File.expand_path(filename, project_path) }
8
+ let(:arguments) { {} }
9
+
10
+ subject { project_type.new(project_path, arguments) }
11
+
12
+ context 'fixtures' do
13
+ let(:fixture) { 'mit' }
14
+ let(:project_path) { fixture_path(fixture) }
15
+ let(:git_path) { File.expand_path('.git', project_path) }
16
+
17
+ if project_type == Licensee::GitProject
18
+ before { git_init(project_path) }
19
+ after { FileUtils.rm_rf(git_path) }
20
+ end
21
+
22
+ context 'with a folder named license' do
23
+ let(:fixture) { 'license-folder' }
24
+
25
+ it "doesn't match" do
26
+ expect(subject.license).to be_nil
27
+ end
28
+ end
29
+
30
+ context 'with LICENSE.lesser' do
31
+ let(:license) { Licensee::License.find('lgpl-3.0') }
32
+ let(:fixture) { 'lgpl' }
33
+
34
+ it 'matches to LGPL' do
35
+ expect(subject.license).to eql(license)
36
+ expect(subject.license_file.path).to eql('COPYING.lesser')
37
+ end
38
+ end
39
+
40
+ context 'MPL with HRs removed' do
41
+ let(:license) { Licensee::License.find('mpl-2.0') }
42
+ let(:fixture) { 'mpl-without-hrs' }
43
+
44
+ it 'matches to MPL' do
45
+ expect(subject.license).to eql(license)
46
+ end
47
+ end
48
+ end
49
+
50
+ context 'with the license file stubbed' do
51
+ let(:project_path) { Dir.mktmpdir }
52
+
53
+ before do
54
+ File.write(license_path, content)
55
+ git_init(project_path) if project_type == Licensee::GitProject
56
+ end
57
+
58
+ after { FileUtils.rm_rf(project_path) }
59
+
60
+ [
61
+ 'LICENSE.md', 'LICENSE.txt', 'LICENSE.md', 'LiCeNSe.Txt',
62
+ 'LICENSE-MIT', 'MIT-LICENSE', 'licence', 'unlicense'
63
+ ].each do |filename|
64
+ context "with a #{filename} file" do
65
+ let(:filename) { filename }
66
+
67
+ it 'matches the license file' do
68
+ expect(subject.license).to eql(license)
69
+ expect(subject.license_file.path).to eql(filename)
70
+ end
71
+ end
72
+ end
73
+
74
+ context 'an unlicensed project' do
75
+ let(:content) { '' }
76
+
77
+ it "doesn't match" do
78
+ expect(subject.license).to be_nil
79
+ expect(subject.license_file.path).to eql('LICENSE')
80
+ end
81
+ end
82
+
83
+ context 'a package.json file' do
84
+ let(:content) { '{"license": "mit"}' }
85
+ let(:filename) { 'package.json' }
86
+ let(:license) { Licensee::License.find('mit') }
87
+ let(:arguments) { { detect_packages: true } }
88
+
89
+ it 'matches' do
90
+ expect(subject.license).to eql(license)
91
+ expect(subject.package_file.path).to eql(filename)
92
+ end
93
+ end
94
+
95
+ context 'a README file' do
96
+ let(:content) { "## License\n#{license.content}" }
97
+ let(:filename) { 'README' }
98
+ let(:license) { Licensee::License.find('mit') }
99
+ let(:arguments) { { detect_readme: true } }
100
+
101
+ it 'matches' do
102
+ expect(subject.license).to eql(license)
103
+ expect(subject.readme_file.path).to eql(filename)
104
+ end
105
+ end
106
+
107
+ context 'a DESCRIPTION file' do
108
+ let(:content) { "Package: test\nLicense: MIT + file LICENSE" }
109
+ let(:filename) { 'DESCRIPTION' }
110
+ let(:license) { Licensee::License.find('mit') }
111
+ let(:arguments) { { detect_packages: true } }
112
+
113
+ it 'matches' do
114
+ expect(subject.license).to eql(license)
115
+ expect(subject.package_file.path).to eql(filename)
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end