licensee 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/licensee/license.rb +4 -2
- data/lib/licensee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eaaff5a763689349aefc891e2c2af17e2a3ca15
|
4
|
+
data.tar.gz: 7f2f905878854668bb0d0d498a11c47dc0fb07f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd90d60d7f3fa5bb96babd6ce60f3134d12e0cf1394303ccef2feeca39e4041fa3ace76b75c49138a482ef278d6994b18813c09331632ae3e4ffa3c210b6ae81
|
7
|
+
data.tar.gz: cd7e6da8e836830b0cc751f5b346b2eedebb312084cd1323036a6e3cd302513d6ce1ba01eec376d830e00fb2cdc4c8b50e0422e6a02f3ca8368b8a840eb7c8b4
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ First, we look to see if the license is an exact match. Licenses like GPL don't
|
|
18
18
|
|
19
19
|
Next, we look to Git's internal change calculation method, which is fast, but is done on a line-by-line basis, so if the license is wrapped differently, or has extra words inserted, it's not going to match the license.
|
20
20
|
|
21
|
-
Finally, if we still can't match the license, we use a fancy math thing called the [Levenshtein distance
|
21
|
+
Finally, if we still can't match the license, we use a fancy math thing called the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance), which while slow, is really good at calculating the similarity between two a known license and an unknown license. By calculating the percent changed from the known license, you can tell, e.g., that a given license is 98% similar to the MIT license, that 2% likely representing the copyright line being properly adapted to the project.
|
22
22
|
|
23
23
|
Licensee will even diff the distributed license with the original, so you can see exactly what, if anything's been changed.
|
24
24
|
|
data/lib/licensee/license.rb
CHANGED
@@ -19,6 +19,8 @@ class Licensee
|
|
19
19
|
# Raw content of license file, including YAML front matter
|
20
20
|
def content
|
21
21
|
@content ||= File.open(path).read
|
22
|
+
rescue
|
23
|
+
""
|
22
24
|
end
|
23
25
|
|
24
26
|
# License metadata from YAML front matter
|
@@ -39,14 +41,14 @@ class Licensee
|
|
39
41
|
|
40
42
|
# The license body (e.g., contents - frontmatter)
|
41
43
|
def body
|
42
|
-
@body ||= parts[2]
|
44
|
+
@body ||= parts[2] if parts[2]
|
43
45
|
end
|
44
46
|
alias_method :to_s, :body
|
45
47
|
alias_method :text, :body
|
46
48
|
|
47
49
|
# License body with all whitespace replaced with a single space
|
48
50
|
def body_normalized
|
49
|
-
@content_normalized ||= body.downcase.gsub(/\s+/, " ").strip
|
51
|
+
@content_normalized ||= body.to_s.downcase.gsub(/\s+/, " ").strip
|
50
52
|
end
|
51
53
|
|
52
54
|
# Git-computed hash signature for the license file
|
data/lib/licensee/version.rb
CHANGED
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.1.
|
4
|
+
version: 4.1.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: 2014-11-
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|