mirror of https://github.com/licensee/licensee.git
Merge branch 'master' into manufacture-source
This commit is contained in:
commit
4733b64549
|
@ -13,6 +13,8 @@ module Licensee
|
||||||
VERSION_REGEX = /\Aversion.*$/i
|
VERSION_REGEX = /\Aversion.*$/i
|
||||||
MARKUP_REGEX = /[#_*=~\[\]()`|>]+/
|
MARKUP_REGEX = /[#_*=~\[\]()`|>]+/
|
||||||
DEVELOPED_BY_REGEX = /\Adeveloped by:.*?\n\n/im
|
DEVELOPED_BY_REGEX = /\Adeveloped by:.*?\n\n/im
|
||||||
|
QUOTE_BEGIN_REGEX = /[`'"‘“]/
|
||||||
|
QUOTE_END_REGEX = /['"’”]/
|
||||||
|
|
||||||
# A set of each word in the license, without duplicates
|
# A set of each word in the license, without duplicates
|
||||||
def wordset
|
def wordset
|
||||||
|
@ -80,9 +82,10 @@ module Licensee
|
||||||
string = strip_all_rights_reserved(string)
|
string = strip_all_rights_reserved(string)
|
||||||
string = strip_developed_by(string)
|
string = strip_developed_by(string)
|
||||||
string, _partition, _instructions = string.partition(END_OF_TERMS_REGEX)
|
string, _partition, _instructions = string.partition(END_OF_TERMS_REGEX)
|
||||||
string = strip_markup(string)
|
string = normalize_lists(string)
|
||||||
string = normalize_quotes(string)
|
string = normalize_quotes(string)
|
||||||
string = normalize_https(string)
|
string = normalize_https(string)
|
||||||
|
string = strip_markup(string)
|
||||||
strip_whitespace(string)
|
strip_whitespace(string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -173,15 +176,20 @@ module Licensee
|
||||||
string.gsub(regex, ' ').squeeze(' ').strip
|
string.gsub(regex, ' ').squeeze(' ').strip
|
||||||
end
|
end
|
||||||
|
|
||||||
# Replace all single quotes with double quotes
|
# Replace all enclosing quotes with double quotes
|
||||||
# Single versus double quotes don't alter the meaning, and it's easier to
|
# Single versus double quotes don't alter the meaning, and it's easier to
|
||||||
# strip double quotes if we still want to allow possessives
|
# strip double quotes if we still want to allow possessives
|
||||||
def normalize_quotes(string)
|
def normalize_quotes(string)
|
||||||
string.gsub(/\s'([\w -]*?\w)'/, ' "\1"')
|
string.gsub(/#{QUOTE_BEGIN_REGEX}+([\w -]*?\w)#{QUOTE_END_REGEX}+/,
|
||||||
|
'"\1"')
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize_https(string)
|
def normalize_https(string)
|
||||||
string.gsub(/http:/, 'https:')
|
string.gsub(/http:/, 'https:')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def normalize_lists(string)
|
||||||
|
string.gsub(/^\s*(\d\.|\*)/, '-')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Licensee
|
module Licensee
|
||||||
VERSION = '9.9.1'.freeze
|
VERSION = '9.9.2'.freeze
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2018, Ben Balter
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2018, Ben Balter
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -186,6 +186,15 @@ RSpec.describe 'integration test' do
|
||||||
expect(subject.license).to eql(license)
|
expect(subject.license).to eql(license)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'BSD-3-Clause numbered and bulleted' do
|
||||||
|
let(:license) { Licensee::License.find('bsd-3-clause') }
|
||||||
|
let(:fixture) { 'bsd-3-lists' }
|
||||||
|
|
||||||
|
it 'determines the project is BSD-3-Clause' do
|
||||||
|
expect(subject.license).to eql(license)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with the license file stubbed' do
|
context 'with the license file stubbed' do
|
||||||
|
|
|
@ -22,12 +22,12 @@ RSpec.describe Licensee::Matchers::Dice do
|
||||||
|
|
||||||
it 'sorts licenses by similarity' do
|
it 'sorts licenses by similarity' do
|
||||||
expect(subject.licenses_by_similiarity[0]).to eql([gpl, 100.0])
|
expect(subject.licenses_by_similiarity[0]).to eql([gpl, 100.0])
|
||||||
expect(subject.licenses_by_similiarity[1]).to eql([agpl, 95.73361082206036])
|
expect(subject.licenses_by_similiarity[1]).to eql([agpl, 95.76581285938317])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a list of licenses above the confidence threshold' do
|
it 'returns a list of licenses above the confidence threshold' do
|
||||||
expect(subject.licenses_by_similiarity[0]).to eql([gpl, 100.0])
|
expect(subject.licenses_by_similiarity[0]).to eql([gpl, 100.0])
|
||||||
expect(subject.licenses_by_similiarity[1]).to eql([agpl, 95.73361082206036])
|
expect(subject.licenses_by_similiarity[1]).to eql([agpl, 95.76581285938317])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns the match confidence' do
|
it 'returns the match confidence' do
|
||||||
|
|
|
@ -8,7 +8,7 @@ description: This commercially-friendly copyleft license provides the ability to
|
||||||
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.
|
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.
|
||||||
|
|
||||||
using:
|
using:
|
||||||
- Eclipse Che: https://github.com/eclipse/che/blob/master/LICENSE
|
- Eclipse hawkBit: https://github.com/eclipse/hawkbit/blob/master/LICENSE
|
||||||
- JUnit: https://github.com/junit-team/junit4/blob/master/LICENSE-junit.txt
|
- JUnit: https://github.com/junit-team/junit4/blob/master/LICENSE-junit.txt
|
||||||
- openHAB: https://github.com/openhab/openhab-distro/blob/master/LICENSE
|
- openHAB: https://github.com/openhab/openhab-distro/blob/master/LICENSE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue