licensee 9.14.1 → 9.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/bin/licensee +1 -1
- data/lib/licensee.rb +1 -1
- data/lib/licensee/commands/detect.rb +2 -4
- data/lib/licensee/commands/diff.rb +1 -3
- data/lib/licensee/content_helper.rb +23 -27
- data/lib/licensee/hash_helper.rb +1 -1
- data/lib/licensee/license.rb +28 -14
- data/lib/licensee/matchers/copyright.rb +2 -7
- data/lib/licensee/matchers/cran.rb +1 -1
- data/lib/licensee/matchers/dice.rb +1 -1
- data/lib/licensee/project_files/license_file.rb +29 -22
- data/lib/licensee/project_files/project_file.rb +2 -4
- data/lib/licensee/project_files/readme_file.rb +1 -1
- data/lib/licensee/projects/fs_project.rb +1 -3
- data/lib/licensee/projects/git_project.rb +6 -4
- data/lib/licensee/projects/project.rb +11 -10
- data/lib/licensee/version.rb +1 -1
- data/licensee.gemspec +5 -4
- data/spec/fixture_spec.rb +2 -2
- data/spec/fixtures/bsd-3-authorowner/LICENSE +27 -0
- data/spec/fixtures/cc-by-sa-mdlinks/License.md +173 -0
- data/spec/fixtures/cc-by-sa-nocclicensor/License.md +425 -0
- data/spec/fixtures/detect.json +5 -5
- data/spec/fixtures/eupl-cal2017/LICENSE.txt +274 -0
- data/spec/fixtures/fixtures.yml +45 -25
- data/spec/fixtures/license-hashes.json +39 -38
- data/spec/fixtures/pixar-modified-apache/LICENSE.txt +174 -0
- data/spec/integration_spec.rb +46 -6
- data/spec/licensee/commands/detect_spec.rb +2 -2
- data/spec/licensee/content_helper_spec.rb +14 -13
- data/spec/licensee/license_spec.rb +5 -5
- data/spec/licensee/matchers/dice_matcher_spec.rb +2 -2
- data/spec/licensee/project_files/license_file_spec.rb +8 -2
- data/spec/licensee/project_spec.rb +1 -3
- data/spec/licensee_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- data/spec/vendored_license_spec.rb +1 -1
- data/vendor/choosealicense.com/_licenses/apache-2.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/eupl-1.2.txt +75 -58
- data/vendor/choosealicense.com/_licenses/mit-0.txt +45 -0
- data/vendor/choosealicense.com/_licenses/odbl-1.0.txt +1 -1
- data/vendor/choosealicense.com/_licenses/unlicense.txt +1 -1
- data/vendor/license-list-XML/src/0BSD.xml +21 -0
- data/vendor/license-list-XML/src/AFL-3.0.xml +212 -0
- data/vendor/license-list-XML/src/AGPL-3.0.xml +852 -0
- data/vendor/license-list-XML/src/Apache-2.0.xml +223 -0
- data/vendor/license-list-XML/src/Artistic-2.0.xml +238 -0
- data/vendor/license-list-XML/src/BSD-2-Clause.xml +42 -0
- data/vendor/license-list-XML/src/BSD-3-Clause-Clear.xml +59 -0
- data/vendor/license-list-XML/src/BSD-3-Clause.xml +46 -0
- data/vendor/license-list-XML/src/BSD-4-Clause.xml +59 -0
- data/vendor/license-list-XML/src/BSL-1.0.xml +30 -0
- data/vendor/license-list-XML/src/CC-BY-4.0.xml +444 -0
- data/vendor/license-list-XML/src/CC-BY-SA-4.0.xml +475 -0
- data/vendor/license-list-XML/src/CC0-1.0.xml +153 -0
- data/vendor/license-list-XML/src/CECILL-2.1.xml +669 -0
- data/vendor/license-list-XML/src/ECL-2.0.xml +242 -0
- data/vendor/license-list-XML/src/EPL-1.0.xml +255 -0
- data/vendor/license-list-XML/src/EPL-2.0.xml +639 -0
- data/vendor/license-list-XML/src/EUPL-1.1.xml +337 -0
- data/vendor/license-list-XML/src/EUPL-1.2.xml +502 -0
- data/vendor/license-list-XML/src/GPL-2.0.xml +474 -0
- data/vendor/license-list-XML/src/GPL-3.0.xml +858 -0
- data/vendor/license-list-XML/src/ISC.xml +29 -0
- data/vendor/license-list-XML/src/LGPL-2.1.xml +662 -0
- data/vendor/license-list-XML/src/LGPL-3.0.xml +260 -0
- data/vendor/license-list-XML/src/LPPL-1.3c.xml +380 -0
- data/vendor/license-list-XML/src/MIT-0.xml +40 -0
- data/vendor/license-list-XML/src/MIT.xml +32 -0
- data/vendor/license-list-XML/src/MPL-2.0.xml +438 -0
- data/vendor/license-list-XML/src/MS-PL.xml +89 -0
- data/vendor/license-list-XML/src/MS-RL.xml +97 -0
- data/vendor/license-list-XML/src/NCSA.xml +60 -0
- data/vendor/license-list-XML/src/ODbL-1.0.xml +660 -0
- data/vendor/license-list-XML/src/OFL-1.1.xml +94 -0
- data/vendor/license-list-XML/src/OSL-3.0.xml +209 -0
- data/vendor/license-list-XML/src/PostgreSQL.xml +32 -0
- data/vendor/license-list-XML/src/UPL-1.0.xml +46 -0
- data/vendor/license-list-XML/src/Unlicense.xml +27 -0
- data/vendor/license-list-XML/src/Vim.xml +124 -0
- data/vendor/license-list-XML/src/WTFPL.xml +30 -0
- data/vendor/license-list-XML/src/Zlib.xml +38 -0
- metadata +73 -13
@@ -1,41 +1,42 @@
|
|
1
1
|
{
|
2
|
-
"0bsd": "
|
3
|
-
"afl-3.0": "
|
4
|
-
"agpl-3.0": "
|
5
|
-
"apache-2.0": "
|
6
|
-
"artistic-2.0": "
|
7
|
-
"bsd-2-clause": "
|
8
|
-
"bsd-3-clause": "
|
9
|
-
"bsd-3-clause-clear": "
|
10
|
-
"bsd-4-clause": "
|
11
|
-
"bsl-1.0": "
|
12
|
-
"cc-by-4.0": "
|
13
|
-
"cc-by-sa-4.0": "
|
14
|
-
"cc0-1.0": "
|
15
|
-
"cecill-2.1": "
|
16
|
-
"ecl-2.0": "
|
17
|
-
"epl-1.0": "
|
18
|
-
"epl-2.0": "
|
19
|
-
"eupl-1.1": "
|
20
|
-
"eupl-1.2": "
|
21
|
-
"gpl-2.0": "
|
22
|
-
"gpl-3.0": "
|
23
|
-
"isc": "
|
24
|
-
"lgpl-2.1": "
|
25
|
-
"lgpl-3.0": "
|
26
|
-
"lppl-1.3c": "
|
27
|
-
"mit": "
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"ms-
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
2
|
+
"0bsd": "c8c3d65fb228583b10cc531f5ddb3cf4fc095508",
|
3
|
+
"afl-3.0": "dbc79db278e7bef9cff16168ac32d4e281542eeb",
|
4
|
+
"agpl-3.0": "10486392ac9e730ec8f77bd1233edfc2d47dd23c",
|
5
|
+
"apache-2.0": "bec905d850e7f5dc2e2db78a950d4a9db560a0b8",
|
6
|
+
"artistic-2.0": "707698f0c53ab48d54b7fd2dc4a6f40533e8ebb3",
|
7
|
+
"bsd-2-clause": "a307ca750c21f262c95d2bce55e69c05e6c3dee9",
|
8
|
+
"bsd-3-clause": "a961b19cc6921d510e29a13b0ba1a826fcffe41c",
|
9
|
+
"bsd-3-clause-clear": "0fcdb12c4060ce8f406e17bc67787e50a9b36a61",
|
10
|
+
"bsd-4-clause": "3b2917580b2b6f13efaaea37546b8b7a53716a30",
|
11
|
+
"bsl-1.0": "27e28f20b57048cf04be07e1532b6fb501a0753b",
|
12
|
+
"cc-by-4.0": "b2089be110aca4cf4a562a88f0ecfd082ce32167",
|
13
|
+
"cc-by-sa-4.0": "20e2ae68f7dd2125beb70f732cd52d376687597f",
|
14
|
+
"cc0-1.0": "94c8187ec82b2b4a69fb990f80833fbe6e3c95e7",
|
15
|
+
"cecill-2.1": "edb804827a40bcdcf3e82b6bab3bd1f5b923ac74",
|
16
|
+
"ecl-2.0": "296976ce9e84ba380866e4519b68a779c2059b3a",
|
17
|
+
"epl-1.0": "5e3cb10996b4ba2821d04d5c99a912c924b3bdcb",
|
18
|
+
"epl-2.0": "e2f3e266432478d9248422228a75a404cce1c43c",
|
19
|
+
"eupl-1.1": "b35810b4113910f5f85af75f24e2538ba64c8876",
|
20
|
+
"eupl-1.2": "2098182069695981c6dc71093888f6204c7bbdae",
|
21
|
+
"gpl-2.0": "32108116603c30687d8d0d2f77f140fb6ecea082",
|
22
|
+
"gpl-3.0": "7d4cdf499d39e2e1ce27b2878e22872f0f5a74dd",
|
23
|
+
"isc": "7fcb74e2084b361556b8285d6f800495d0d5e36a",
|
24
|
+
"lgpl-2.1": "82420393a49840ea66ed4df4c550a2ff3955e70e",
|
25
|
+
"lgpl-3.0": "2f434698bab479f8f6c5043f2796767287f40495",
|
26
|
+
"lppl-1.3c": "cd1336cb08b1b97bcbe32119cdd8f518d8b340a3",
|
27
|
+
"mit": "4c2c763d64bbc7ef2e58b0ec6d06d90cee9755c9",
|
28
|
+
"mit-0": "b19f2d3e3e0cbba6ccd5808dd7be60a19172824b",
|
29
|
+
"mpl-2.0": "820048a1dbef5dfac65547bd9eb935beb76b2257",
|
30
|
+
"ms-pl": "1a7eb02101924998c296c8ede182005d2f77ae4a",
|
31
|
+
"ms-rl": "9f0c4c8be853cf1836a619cd0abaf0e0235d76ad",
|
32
|
+
"ncsa": "0d481a7ff9345e19cfdd9b7fea46caea1ebd08ee",
|
33
|
+
"odbl-1.0": "72a4e9321a871bca3c5dd0f06ffe498d340e8d76",
|
34
|
+
"ofl-1.1": "f92ca13e3976f94f20b49a007f7592631b4f8e96",
|
35
|
+
"osl-3.0": "bdde11f936b834bd06451d1ad8aad790d4a7c72c",
|
36
|
+
"postgresql": "6bddd8a2425baa88ee240b1c54b532d6208028bd",
|
37
|
+
"unlicense": "859a7d829d402dd6e047293d87979dacc1b88f37",
|
38
|
+
"upl-1.0": "f9a6bb39f54539ff3084ee4d754fc30cbba34d40",
|
39
|
+
"vim": "10e72ceebb7ab0a34ff1ed90241953b3756fd938",
|
39
40
|
"wtfpl": "f8544c074f203d86cdcb24082fedfb2cf2fe411a",
|
40
|
-
"zlib": "
|
41
|
+
"zlib": "d75cdaa2dd3ceb3f0db609005a32f825b37d1a8c"
|
41
42
|
}
|
@@ -0,0 +1,174 @@
|
|
1
|
+
|
2
|
+
Modified Apache 2.0 License
|
3
|
+
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor
|
140
|
+
and its affiliates, except as required to comply with Section 4(c) of
|
141
|
+
the License and to reproduce the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
data/spec/integration_spec.rb
CHANGED
@@ -40,9 +40,7 @@ RSpec.describe 'integration test' do
|
|
40
40
|
|
41
41
|
before do
|
42
42
|
File.write(file_path, 'bar')
|
43
|
-
if project_type == Licensee::Projects::GitProject
|
44
|
-
git_init(project_path)
|
45
|
-
end
|
43
|
+
git_init(project_path) if project_type == Licensee::Projects::GitProject
|
46
44
|
end
|
47
45
|
|
48
46
|
after { FileUtils.rm_rf(project_path) }
|
@@ -107,6 +105,14 @@ RSpec.describe 'integration test' do
|
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
108
|
+
context 'with Pixar Modified Apache 2.0' do
|
109
|
+
let(:fixture) { 'pixar-modified-apache' }
|
110
|
+
|
111
|
+
it 'matches other' do
|
112
|
+
expect(subject.license).to eql(other_license)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
110
116
|
context 'with FCPL Modified MPL' do
|
111
117
|
let(:fixture) { 'fcpl-modified-mpl' }
|
112
118
|
|
@@ -197,6 +203,15 @@ RSpec.describe 'integration test' do
|
|
197
203
|
end
|
198
204
|
end
|
199
205
|
|
206
|
+
context 'EUPL as published on choosealicense.com 2017-2019' do
|
207
|
+
let(:license) { Licensee::License.find('eupl-1.2') }
|
208
|
+
let(:fixture) { 'eupl-cal2017' }
|
209
|
+
|
210
|
+
it 'returns eupl-1.2' do
|
211
|
+
expect(subject.license).to eql(license)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
200
215
|
context 'Unlicense without optional line' do
|
201
216
|
let(:license) { Licensee::License.find('unlicense') }
|
202
217
|
let(:fixture) { 'unlicense-noinfo' }
|
@@ -271,6 +286,15 @@ RSpec.describe 'integration test' do
|
|
271
286
|
end
|
272
287
|
end
|
273
288
|
|
289
|
+
context 'BSD-3-Clause author/owner variant' do
|
290
|
+
let(:license) { Licensee::License.find('bsd-3-clause') }
|
291
|
+
let(:fixture) { 'bsd-3-authorowner' }
|
292
|
+
|
293
|
+
it 'determines the project is BSD-3-Clause' do
|
294
|
+
expect(subject.license).to eql(license)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
274
298
|
context 'HTML license file' do
|
275
299
|
let(:license) { Licensee::License.find('epl-1.0') }
|
276
300
|
let(:fixture) { 'html' }
|
@@ -289,6 +313,24 @@ RSpec.describe 'integration test' do
|
|
289
313
|
end
|
290
314
|
end
|
291
315
|
|
316
|
+
context 'CC-BY-SA no CC licensor statement license file' do
|
317
|
+
let(:license) { Licensee::License.find('cc-by-sa-4.0') }
|
318
|
+
let(:fixture) { 'cc-by-sa-nocclicensor' }
|
319
|
+
|
320
|
+
it 'matches to CC-BY-SA' do
|
321
|
+
expect(subject.license).to eql(license)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
context 'CC-BY-SA markdown links file' do
|
326
|
+
let(:license) { Licensee::License.find('cc-by-sa-4.0') }
|
327
|
+
let(:fixture) { 'cc-by-sa-mdlinks' }
|
328
|
+
|
329
|
+
it 'matches to CC-BY-SA' do
|
330
|
+
expect(subject.license).to eql(license)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
292
334
|
context 'MIT with byte order mark' do
|
293
335
|
let(:license) { Licensee::License.find('mit') }
|
294
336
|
let(:fixture) { 'bom' }
|
@@ -304,9 +346,7 @@ RSpec.describe 'integration test' do
|
|
304
346
|
|
305
347
|
before do
|
306
348
|
File.write(license_path, content)
|
307
|
-
if project_type == Licensee::Projects::GitProject
|
308
|
-
git_init(project_path)
|
309
|
-
end
|
349
|
+
git_init(project_path) if project_type == Licensee::Projects::GitProject
|
310
350
|
end
|
311
351
|
|
312
352
|
after { FileUtils.rm_rf(project_path) }
|
@@ -19,7 +19,7 @@ RSpec.describe 'detect command' do
|
|
19
19
|
'Matched files' => 'LICENSE.md, licensee.gemspec',
|
20
20
|
'LICENSE.md' => {
|
21
21
|
'Content hash' => hash,
|
22
|
-
'Attribution' => 'Copyright (c) 2014-
|
22
|
+
'Attribution' => 'Copyright (c) 2014-2021 Ben Balter and Licensee contributors',
|
23
23
|
'Confidence' => '100.00%',
|
24
24
|
'Matcher' => 'Licensee::Matchers::Exact',
|
25
25
|
'License' => 'MIT'
|
@@ -70,7 +70,7 @@ RSpec.describe 'detect command' do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'returns the expected output' do
|
73
|
-
msg = '`licensee detect --json` output did not match expectations. '
|
73
|
+
msg = +'`licensee detect --json` output did not match expectations. '
|
74
74
|
msg << 'Run `script/dump-detect-json-fixture` and verify the output.'
|
75
75
|
expect(JSON.parse(stdout)).to eql(expected), msg
|
76
76
|
end
|
@@ -12,10 +12,14 @@ class ContentHelperTestHelper
|
|
12
12
|
def filename
|
13
13
|
@data[:filename]
|
14
14
|
end
|
15
|
+
|
16
|
+
def spdx_id
|
17
|
+
@data[:spdx_id]
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
RSpec.describe Licensee::ContentHelper do
|
18
|
-
subject { ContentHelperTestHelper.new(content, filename: filename) }
|
22
|
+
subject { ContentHelperTestHelper.new(content, filename: filename, spdx_id: spdx_id) }
|
19
23
|
|
20
24
|
let(:content) do
|
21
25
|
<<-LICENSE.gsub(/^\s*/, '')
|
@@ -37,6 +41,7 @@ RSpec.describe Licensee::ContentHelper do
|
|
37
41
|
LICENSE
|
38
42
|
end
|
39
43
|
let(:filename) { 'license.md' }
|
44
|
+
let(:spdx_id) { 'MIT' }
|
40
45
|
|
41
46
|
let(:mit) { Licensee::License.find('mit') }
|
42
47
|
let(:normalized_content) { subject.content_normalized }
|
@@ -44,7 +49,7 @@ RSpec.describe Licensee::ContentHelper do
|
|
44
49
|
it 'creates the wordset' do
|
45
50
|
wordset = Set.new(
|
46
51
|
%w[
|
47
|
-
the made up license this provided as is please respect
|
52
|
+
the made up license this provided as is' please respect
|
48
53
|
contributors' wishes when implementing license's software
|
49
54
|
]
|
50
55
|
)
|
@@ -61,12 +66,12 @@ RSpec.describe Licensee::ContentHelper do
|
|
61
66
|
end
|
62
67
|
|
63
68
|
it 'knows the similarity' do
|
64
|
-
expect(
|
65
|
-
expect(
|
69
|
+
expect(mit.similarity(subject)).to be_within(1).of(4)
|
70
|
+
expect(mit.similarity(mit)).to be(100.0)
|
66
71
|
end
|
67
72
|
|
68
73
|
it 'calculates the hash' do
|
69
|
-
content_hash = '
|
74
|
+
content_hash = '9b4bed43726cf39e17b11c2942f37be232f5709a'
|
70
75
|
expect(subject.content_hash).to eql(content_hash)
|
71
76
|
end
|
72
77
|
|
@@ -169,7 +174,7 @@ RSpec.describe Licensee::ContentHelper do
|
|
169
174
|
end
|
170
175
|
|
171
176
|
it 'normalizes quotes' do
|
172
|
-
expect(normalized_content).not_to match("
|
177
|
+
expect(normalized_content).not_to match('"as is"')
|
173
178
|
end
|
174
179
|
|
175
180
|
it 'preserves possessives' do
|
@@ -177,18 +182,14 @@ RSpec.describe Licensee::ContentHelper do
|
|
177
182
|
expect(normalized_content).to match("license's")
|
178
183
|
end
|
179
184
|
|
180
|
-
it 'preserves double quotes' do
|
181
|
-
expect(normalized_content).to match('"software"')
|
182
|
-
end
|
183
|
-
|
184
185
|
it 'strips the title' do
|
185
186
|
expect(normalized_content).not_to match('MIT')
|
186
187
|
end
|
187
188
|
|
188
189
|
it 'normalize the content' do
|
189
|
-
expected =
|
190
|
+
expected = +"the made up license. this license provided 'as is'. "
|
190
191
|
expected << "please respect the contributors' wishes when implementing "
|
191
|
-
expected << "the license's
|
192
|
+
expected << "the license's 'software'."
|
192
193
|
expect(normalized_content).to eql(expected)
|
193
194
|
end
|
194
195
|
end
|
@@ -230,7 +231,7 @@ RSpec.describe Licensee::ContentHelper do
|
|
230
231
|
let(:content) { "`a` 'b' \"c\" ‘d’ “e”" }
|
231
232
|
|
232
233
|
it 'normalizes quotes' do
|
233
|
-
expect(subject.content_normalized).to eql('
|
234
|
+
expect(subject.content_normalized).to eql("'a' 'b' 'c' 'd' 'e'")
|
234
235
|
end
|
235
236
|
end
|
236
237
|
|