licensee 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/licensee +1 -1
- data/lib/licensee/license_file.rb +3 -2
- data/lib/licensee/project.rb +12 -4
- data/lib/licensee/version.rb +1 -1
- data/test/test_licensee_bin.rb +1 -0
- data/test/test_licensee_copyright_matcher.rb +7 -0
- data/test/test_licensee_license_file.rb +5 -1
- data/test/test_licensee_project.rb +11 -1
- data/vendor/choosealicense.com/_licenses/agpl-3.0.txt +1 -0
- data/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +1 -0
- data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +2 -1
- data/vendor/choosealicense.com/_licenses/cc0-1.0.txt +1 -0
- data/vendor/choosealicense.com/_licenses/gpl-2.0.txt +1 -0
- data/vendor/choosealicense.com/_licenses/gpl-3.0.txt +1 -0
- data/vendor/choosealicense.com/_licenses/lgpl-2.1.txt +1 -0
- data/vendor/choosealicense.com/_licenses/lgpl-3.0.txt +3 -2
- 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: 046dcbf68cab0fbba5bd8624102a73c11fbe2c4e
|
4
|
+
data.tar.gz: 2b569387243ebeed517c5b873b8f4529149ba62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fe55bf7698ecc52aaa2de8dd77f85cb8ad9357e29abeeb8a3237a1b258fcb1ca172d7329027d0a6f045e2c869029af20fe342ac91011199e9ccdf5423c05af5
|
7
|
+
data.tar.gz: a4f92f1e13d453c7819c52dc591243edde132ec41c9f743c397b06902be2a40019776558ce03b935a3998682962e63af6f902bd4496032d8f79b740fb002d8fd
|
data/bin/licensee
CHANGED
@@ -7,7 +7,7 @@ project = Licensee::Project.new(path)
|
|
7
7
|
license = project.license_file
|
8
8
|
|
9
9
|
if license
|
10
|
-
puts "License file: #{
|
10
|
+
puts "License file: #{license.path}"
|
11
11
|
puts "License: #{license.match ? license.match.meta['title'] : 'no license'}"
|
12
12
|
puts "Confidence: #{license.confidence}%"
|
13
13
|
puts "Method: #{license.matcher.class}"
|
data/lib/licensee/project.rb
CHANGED
@@ -37,7 +37,7 @@ class Licensee
|
|
37
37
|
|
38
38
|
# Returns an instance of Licensee::LicenseFile if there's a license file detected
|
39
39
|
def license_file
|
40
|
-
@license_file ||= LicenseFile.new(
|
40
|
+
@license_file ||= LicenseFile.new(license_blob, :path => license_path) if license_blob
|
41
41
|
end
|
42
42
|
|
43
43
|
# Returns the matching Licensee::License instance if a license can be detected
|
@@ -57,12 +57,20 @@ class Licensee
|
|
57
57
|
|
58
58
|
# Detects the license file, if any
|
59
59
|
# Returns the blob hash as detected in the tree
|
60
|
-
def
|
60
|
+
def license_hash
|
61
61
|
# Prefer an exact match to one of our known file names
|
62
|
-
|
62
|
+
license_hash = tree.find { |blob| LICENSE_FILENAMES.include? blob[:name].downcase }
|
63
63
|
|
64
64
|
# Fall back to the first file in the project root that has the word license in it
|
65
|
-
|
65
|
+
license_hash || tree.find { |blob| blob[:name] =~ /licen(s|c)e/i }
|
66
|
+
end
|
67
|
+
|
68
|
+
def license_blob
|
69
|
+
@repository.lookup(license_hash[:oid]) if license_hash
|
70
|
+
end
|
71
|
+
|
72
|
+
def license_path
|
73
|
+
license_hash[:name] if license_hash
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
data/lib/licensee/version.rb
CHANGED
data/test/test_licensee_bin.rb
CHANGED
@@ -6,6 +6,7 @@ class TestLicenseeBin < Minitest::Test
|
|
6
6
|
Dir.chdir root
|
7
7
|
stdout,stderr,status = Open3.capture3("#{root}/bin/licensee")
|
8
8
|
assert stdout.include?("License: MIT"), "expected #{stdout} to include `License: MIT`"
|
9
|
+
assert stdout.include?("License file: LICENSE.md"), "expected #{stdout} to include `License file: LICENSE.md`"
|
9
10
|
assert_equal 0, status
|
10
11
|
end
|
11
12
|
end
|
@@ -36,4 +36,11 @@ class TestLicenseeCopyrightMatcher < Minitest::Test
|
|
36
36
|
file = Licensee::LicenseFile.new(blob)
|
37
37
|
assert_equal nil, Licensee::CopyrightMatcher.match(file)
|
38
38
|
end
|
39
|
+
|
40
|
+
should "handle UTF-8 encoded copyright notices" do
|
41
|
+
text = "Copyright (c) 2010-2014 Simon Hürlimann"
|
42
|
+
blob = FakeBlob.new(text)
|
43
|
+
file = Licensee::LicenseFile.new(blob)
|
44
|
+
assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key
|
45
|
+
end
|
39
46
|
end
|
@@ -5,7 +5,7 @@ class TestLicenseeLicenseFile < Minitest::Test
|
|
5
5
|
def setup
|
6
6
|
@repo = Rugged::Repository.new(fixture_path("licenses.git"))
|
7
7
|
blob = 'bcb552d06d9cf1cd4c048a6d3bf716849c2216cc'
|
8
|
-
@file = Licensee::LicenseFile.new(@repo.lookup(blob))
|
8
|
+
@file = Licensee::LicenseFile.new(@repo.lookup(blob), :path => "LICENSE")
|
9
9
|
@gpl = Licensee::Licenses.find "GPL-3.0"
|
10
10
|
@mit = Licensee::Licenses.find "MIT"
|
11
11
|
end
|
@@ -18,6 +18,10 @@ class TestLicenseeLicenseFile < Minitest::Test
|
|
18
18
|
assert_equal "mit", @file.match.key
|
19
19
|
end
|
20
20
|
|
21
|
+
should "know the path" do
|
22
|
+
assert_equal "LICENSE", @file.path
|
23
|
+
end
|
24
|
+
|
21
25
|
should "diff the file" do
|
22
26
|
expected = "-Copyright (c) [year] [fullname]\n+Copyright (c) 2014 Ben Balter"
|
23
27
|
assert @file.diff.include?(expected)
|
@@ -36,9 +36,19 @@ class TestLicenseeProject < Minitest::Test
|
|
36
36
|
assert_equal "mit", project.license.key
|
37
37
|
end
|
38
38
|
|
39
|
+
should "return the license hash" do
|
40
|
+
project = make_project "licenses.git", as_git
|
41
|
+
assert_equal "LICENSE", project.send(:license_hash)[:name]
|
42
|
+
end
|
43
|
+
|
39
44
|
should "return the license blob" do
|
40
45
|
project = make_project "licenses.git", as_git
|
41
|
-
assert_equal
|
46
|
+
assert_equal 1077, project.send(:license_blob).size
|
47
|
+
end
|
48
|
+
|
49
|
+
should "return the license path" do
|
50
|
+
project = make_project "licenses.git", as_git
|
51
|
+
assert_equal "LICENSE", project.send(:license_path)
|
42
52
|
end
|
43
53
|
|
44
54
|
should "detect an atypically cased license file" do
|
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
layout: license
|
3
3
|
title: BSD 3-clause "New" or "Revised" License
|
4
|
+
nickname: New BSD
|
4
5
|
category: BSD
|
5
6
|
tab-slug: bsd-3
|
6
7
|
hide-from-license-list: true
|
@@ -8,7 +9,7 @@ permalink: /licenses/bsd-3-clause/
|
|
8
9
|
|
9
10
|
description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. Both have very minute differences to the MIT license. The three clause variant prohibits others from using the name of the project or its contributors to promote derivative works without written consent.
|
10
11
|
|
11
|
-
how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders. Replace
|
12
|
+
how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders. Replace [project] with the project organization, if any, that sponsors this work.
|
12
13
|
|
13
14
|
source: http://opensource.org/licenses/BSD-3-Clause
|
14
15
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
layout: license
|
3
3
|
title: GNU Lesser General Public License v3.0
|
4
|
+
nickname: GNU LGPL v3.0
|
4
5
|
category: LGPL
|
5
6
|
tab-slug: lgpl-v3
|
6
7
|
hide-from-license-list: true
|
@@ -10,9 +11,9 @@ permalink: /licenses/lgpl-3.0/
|
|
10
11
|
|
11
12
|
description: Version 3 of the LGPL is an additional set of permissions to the <a href="/licenses/GPL-3.0">GPL v3 license</a> that requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction.
|
12
13
|
|
13
|
-
how: This license is an additional set of permissions to the <a href="/licenses/gpl-3.0">GPL v3</a> license. Follow the instructions to apply the GPL v3
|
14
|
+
how: This license is an additional set of permissions to the <a href="/licenses/gpl-3.0">GPL v3</a> license. Follow the instructions to apply the GPL v3. Then either paste this text to the bottom of the created file OR add a separate file (typically named COPYING.lesser or LICENSE.lesser) in the root of your source code and copy the text.
|
14
15
|
|
15
|
-
note: The Free Software Foundation recommends taking the additional step of adding a boilerplate notice to the top of each file. The boilerplate can be found at the end of the license.
|
16
|
+
note: The Free Software Foundation recommends taking the additional step of adding a boilerplate notice to the top of each file. The boilerplate can be found at the end of the <a href="/licenses/gpl-3.0">GPL v3 license</a>. Insert the word “Lesser” before “General” in all three places in the boilerplate notice to make sure that you refer to the LGPL v3 and not the GPL v3.
|
16
17
|
|
17
18
|
required:
|
18
19
|
- include-copyright
|
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.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|