mirror of https://github.com/licensee/licensee.git
Merge remote-tracking branch 'origin/master' into readme
* origin/master:
script/git-repo should shallow clone
move git project and fs project into their own files
Bump to 6.1.0
update vendored licenses
whitespace
normalize content before computing hash
expose license hash
Adding more info on how to call licensee. Also moved the command line usage above the library usage as it's a quicker way to get to use the code
fix for invalid byte sequence
expose licensee.project
allow License#all to be filtered by featured
update vendored licenses
update vendored licenses
💎 bump
update MPL text
This commit is contained in:
commit
b4dcebf1cd
|
@ -7,7 +7,7 @@ vendor/jquery
|
|||
vendor/normalize-css
|
||||
vendor/qtip2
|
||||
vendor/selectivizr
|
||||
vendor/zeroclipboard
|
||||
vendor/clipboard/
|
||||
vendor/eventEmitter
|
||||
vendor/eventie
|
||||
vendor/imagesloaded
|
||||
|
|
35
README.md
35
README.md
|
@ -19,7 +19,19 @@ _Special thanks to [@vmg](https://github.com/vmg) for his Git and algorithmic pr
|
|||
## Installation
|
||||
`gem install licensee` or add `gem 'licensee'` to your project's `Gemfile`.
|
||||
|
||||
## Usage
|
||||
## Command line usage
|
||||
1. `cd` into a project directory
|
||||
2. execute the `licensee` command
|
||||
|
||||
You'll get an output that looks like:
|
||||
|
||||
```
|
||||
License: MIT
|
||||
Confidence: 98.42%
|
||||
Matcher: Licensee::GitMatcher
|
||||
```
|
||||
|
||||
## License API
|
||||
|
||||
```ruby
|
||||
license = Licensee.license "/path/to/a/project"
|
||||
|
@ -41,16 +53,21 @@ license.meta["permitted"]
|
|||
=> ["commercial-use","modifications","distribution","sublicense","private-use"]
|
||||
```
|
||||
|
||||
## Command line usage
|
||||
1. `cd` into a project directory
|
||||
2. execute the `licensee` command
|
||||
## More API
|
||||
You can gather more information by working with the project object, and the top level Licensee class.
|
||||
|
||||
You'll get an output that looks like:
|
||||
```ruby
|
||||
Licensee::VERSION # The Licensee version
|
||||
Licensee.licenses # All the licenses Licensee knows about
|
||||
|
||||
```
|
||||
License: MIT
|
||||
Confidence: 98.42%
|
||||
Matcher: Licensee::GitMatcher
|
||||
project=Licensee.project "/path/to/a/project" # Get a Project (Git checkout or just local Filesystem) (post 6.0.0)
|
||||
|
||||
project.license # The matched license
|
||||
project.matched_file # Object for the particular file containing the apparent license
|
||||
project.matched_file.filename # Its filename
|
||||
project.matched_file.confidence # The confidence level in the license matching
|
||||
project.matched_file.content # The content of your license file
|
||||
project.license.content # The Open Source License text it matched against
|
||||
```
|
||||
|
||||
## What it looks at
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
require_relative "licensee/version"
|
||||
require_relative "licensee/content_helper"
|
||||
require_relative "licensee/license"
|
||||
require_relative "licensee/project"
|
||||
require_relative "licensee/project_file"
|
||||
|
||||
# Projects
|
||||
require_relative "licensee/project"
|
||||
require_relative "licensee/projects/git_project"
|
||||
require_relative "licensee/projects/fs_project"
|
||||
|
||||
# Project files
|
||||
require_relative "licensee/project_file"
|
||||
require_relative "licensee/project_files/license_file"
|
||||
require_relative "licensee/project_files/package_info"
|
||||
require_relative "licensee/project_files/readme"
|
||||
|
||||
# Matchers
|
||||
require_relative "licensee/matchers/exact_matcher"
|
||||
require_relative "licensee/matchers/copyright_matcher"
|
||||
require_relative "licensee/matchers/dice_matcher"
|
||||
|
@ -28,10 +38,14 @@ class Licensee
|
|||
|
||||
# Returns the license for a given path
|
||||
def license(path)
|
||||
Licensee.project(path).license
|
||||
end
|
||||
|
||||
def project(path)
|
||||
begin
|
||||
Licensee::GitProject.new(path).license
|
||||
Licensee::GitProject.new(path)
|
||||
rescue Licensee::GitProject::InvalidRepository
|
||||
Licensee::FSProject.new(path).license
|
||||
Licensee::FSProject.new(path)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
require 'set'
|
||||
require 'digest'
|
||||
|
||||
class Licensee
|
||||
module ContentHelper
|
||||
def create_word_set(content)
|
||||
|
||||
DIGEST = Digest::SHA1
|
||||
|
||||
def wordset
|
||||
@wordset ||= content_normalized.scan(/[\w']+/).to_set if content_normalized
|
||||
end
|
||||
|
||||
def hash
|
||||
@hash ||= DIGEST.hexdigest content_normalized
|
||||
end
|
||||
|
||||
def content_normalized
|
||||
return unless content
|
||||
content = content.dup
|
||||
content.downcase!
|
||||
content.gsub!(/^#{Matchers::Copyright::REGEX}$/i, '')
|
||||
content.scan(/[\w']+/).to_set
|
||||
@content_normalized ||= begin
|
||||
content_normalized = content.downcase.strip
|
||||
content_normalized.gsub!(/^#{Matchers::Copyright::REGEX}$/i, '')
|
||||
content_normalized.gsub("\n", " ").squeeze(" ")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,9 +6,18 @@ class Licensee
|
|||
class License
|
||||
|
||||
class << self
|
||||
|
||||
# All license objects defined via Licensee (via choosealicense.com)
|
||||
#
|
||||
# Options - :hidden - boolean, whether to return hidden licenses, defaults to false
|
||||
# Options - :featured - boolean, whether to return only (non)featured licenses, defaults to all
|
||||
#
|
||||
# Returns an Array of License objects.
|
||||
def all(options={})
|
||||
@all ||= keys.map { |key| self.new(key) }
|
||||
options[:hidden] ? @all : @all.reject { |l| l.hidden? }
|
||||
output = licenses.dup
|
||||
output.reject! { |l| l.hidden? } unless options[:hidden]
|
||||
output.select! { |l| l.featured? == options[:featured] } unless options[:featured].nil?
|
||||
output
|
||||
end
|
||||
|
||||
def keys
|
||||
|
@ -30,6 +39,12 @@ class Licensee
|
|||
def license_files
|
||||
@license_files ||= Dir.glob("#{license_dir}/*.txt")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def licenses
|
||||
@licenses ||= keys.map { |key| self.new(key) }
|
||||
end
|
||||
end
|
||||
|
||||
attr_reader :key
|
||||
|
@ -53,17 +68,6 @@ class Licensee
|
|||
@path ||= File.expand_path "#{@key}.txt", Licensee::License.license_dir
|
||||
end
|
||||
|
||||
# Raw content of license file, including YAML front matter
|
||||
def content
|
||||
@content ||= if File.exists?(path)
|
||||
File.open(path).read
|
||||
elsif key == "other" # A pseudo-license with no content
|
||||
nil
|
||||
else
|
||||
raise Licensee::InvalidLicense, "'#{key}' is not a valid license key"
|
||||
end
|
||||
end
|
||||
|
||||
# License metadata from YAML front matter
|
||||
def meta
|
||||
@meta ||= if parts && parts[1]
|
||||
|
@ -100,15 +104,12 @@ class Licensee
|
|||
end
|
||||
|
||||
# The license body (e.g., contents - frontmatter)
|
||||
def body
|
||||
@body ||= parts[2] if parts && parts[2]
|
||||
end
|
||||
alias_method :to_s, :body
|
||||
alias_method :text, :body
|
||||
|
||||
def wordset
|
||||
@wordset ||= create_word_set(body)
|
||||
def content
|
||||
@content ||= parts[2] if parts && parts[2]
|
||||
end
|
||||
alias_method :to_s, :content
|
||||
alias_method :text, :content
|
||||
alias_method :body, :content
|
||||
|
||||
def inspect
|
||||
"#<Licensee::License key=\"#{key}\" name=\"#{name}\">"
|
||||
|
@ -123,8 +124,20 @@ class Licensee
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
# Raw content of license file, including YAML front matter
|
||||
def raw_content
|
||||
@raw_content ||= if File.exists?(path)
|
||||
File.open(path).read
|
||||
elsif key == "other" # A pseudo-license with no content
|
||||
nil
|
||||
else
|
||||
raise Licensee::InvalidLicense, "'#{key}' is not a valid license key"
|
||||
end
|
||||
end
|
||||
|
||||
def parts
|
||||
@parts ||= content.match(/\A(---\n.*\n---\n+)?(.*)/m).to_a if content
|
||||
@parts ||= raw_content.match(/\A(---\n.*\n---\n+)?(.*)/m).to_a if raw_content
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,85 +58,4 @@ class Licensee
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
public
|
||||
|
||||
# Git-based project
|
||||
#
|
||||
# analyze a given git repository for license information
|
||||
class GitProject < Project
|
||||
attr_reader :repository, :revision
|
||||
|
||||
class InvalidRepository < ArgumentError; end
|
||||
|
||||
def initialize(repo, revision: nil, **args)
|
||||
if repo.kind_of? Rugged::Repository
|
||||
@repository = repo
|
||||
else
|
||||
@repository = Rugged::Repository.new(repo)
|
||||
end
|
||||
|
||||
@revision = revision
|
||||
super(**args)
|
||||
rescue Rugged::RepositoryError
|
||||
raise InvalidRepository
|
||||
end
|
||||
|
||||
private
|
||||
def commit
|
||||
@commit ||= revision ? repository.lookup(revision) : repository.last_commit
|
||||
end
|
||||
|
||||
MAX_LICENSE_SIZE = 64 * 1024
|
||||
|
||||
def load_blob_data(oid)
|
||||
data, _ = Rugged::Blob.to_buffer(repository, oid, MAX_LICENSE_SIZE)
|
||||
data
|
||||
end
|
||||
|
||||
def find_file
|
||||
files = commit.tree.map do |entry|
|
||||
next unless entry[:type] == :blob
|
||||
if (score = yield entry[:name]) > 0
|
||||
{ :name => entry[:name], :oid => entry[:oid], :score => score }
|
||||
end
|
||||
end.compact
|
||||
|
||||
return if files.empty?
|
||||
files.sort! { |a, b| b[:score] <=> a[:score] }
|
||||
|
||||
f = files.first
|
||||
[load_blob_data(f[:oid]), f[:name]]
|
||||
end
|
||||
end
|
||||
|
||||
# Filesystem-based project
|
||||
#
|
||||
# Analyze a folder on the filesystem for license information
|
||||
class FSProject < Project
|
||||
attr_reader :path
|
||||
|
||||
def initialize(path, **args)
|
||||
@path = path
|
||||
super(**args)
|
||||
end
|
||||
|
||||
private
|
||||
def find_file
|
||||
files = []
|
||||
|
||||
Dir.foreach(path) do |file|
|
||||
next unless ::File.file?(::File.join(path, file))
|
||||
if (score = yield file) > 0
|
||||
files.push({ :name => file, :score => score })
|
||||
end
|
||||
end
|
||||
|
||||
return if files.empty?
|
||||
files.sort! { |a, b| b[:score] <=> a[:score] }
|
||||
|
||||
f = files.first
|
||||
[::File.read(::File.join(path, f[:name])), f[:name]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# encoding=utf-8
|
||||
class Licensee
|
||||
class Project
|
||||
private
|
||||
|
||||
class File
|
||||
attr_reader :content, :filename
|
||||
|
||||
def initialize(content, filename = nil)
|
||||
@content = content
|
||||
@content.force_encoding(Encoding::UTF_8)
|
||||
@content.encode!(Encoding::UTF_8, :invalid => :replace, :undef => :replace, :replace => "")
|
||||
@filename = filename
|
||||
end
|
||||
|
||||
|
@ -27,73 +27,5 @@ class Licensee
|
|||
alias_method :match, :license
|
||||
alias_method :path, :filename
|
||||
end
|
||||
|
||||
public
|
||||
class LicenseFile < File
|
||||
include Licensee::ContentHelper
|
||||
|
||||
def possible_matchers
|
||||
[Matchers::Copyright, Matchers::Exact, Matchers::Dice]
|
||||
end
|
||||
|
||||
def wordset
|
||||
@wordset ||= create_word_set(content)
|
||||
end
|
||||
|
||||
def attribution
|
||||
matches = /^#{Matchers::Copyright::REGEX}$/i.match(content)
|
||||
matches[0].strip if matches
|
||||
end
|
||||
|
||||
def self.name_score(filename)
|
||||
return 1.0 if filename =~ /\A(un)?licen[sc]e\z/i
|
||||
return 0.9 if filename =~ /\A(un)?licen[sc]e\.(md|markdown|txt)\z/i
|
||||
return 0.8 if filename =~ /\Acopy(ing|right)(\.[^.]+)?\z/i
|
||||
return 0.7 if filename =~ /\A(un)?licen[sc]e\.[^.]+\z/i
|
||||
return 0.5 if filename =~ /licen[sc]e/i
|
||||
return 0.0
|
||||
end
|
||||
end
|
||||
|
||||
class Readme < LicenseFile
|
||||
SCORES = {
|
||||
/\AREADME\z/i => 1.0,
|
||||
/\AREADME\.(md|markdown|txt)\z/i => 0.9
|
||||
}
|
||||
|
||||
CONTENT_REGEX = /^#+ Licen[sc]e$(.*?)(?=#+|\z)/im
|
||||
|
||||
def self.name_score(filename)
|
||||
SCORES.each do |pattern, score|
|
||||
return score if pattern =~ filename
|
||||
end
|
||||
return 0.0
|
||||
end
|
||||
|
||||
def self.license_content(content)
|
||||
match = CONTENT_REGEX.match(content)
|
||||
match[1].strip if match
|
||||
end
|
||||
end
|
||||
|
||||
class PackageInfo < File
|
||||
def possible_matchers
|
||||
case ::File.extname(filename)
|
||||
when ".gemspec"
|
||||
[Matchers::Gemspec]
|
||||
when ".json"
|
||||
[Matchers::NpmBower]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def self.name_score(filename)
|
||||
return 1.0 if ::File.extname(filename) == ".gemspec"
|
||||
return 1.0 if filename == "package.json"
|
||||
return 0.75 if filename == "bower.json"
|
||||
return 0.0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
class Licensee
|
||||
class Project
|
||||
class LicenseFile < Licensee::Project::File
|
||||
include Licensee::ContentHelper
|
||||
|
||||
def possible_matchers
|
||||
[Matchers::Copyright, Matchers::Exact, Matchers::Dice]
|
||||
end
|
||||
|
||||
def attribution
|
||||
matches = /^#{Matchers::Copyright::REGEX}$/i.match(content)
|
||||
matches[0].strip if matches
|
||||
end
|
||||
|
||||
def self.name_score(filename)
|
||||
return 1.0 if filename =~ /\A(un)?licen[sc]e\z/i
|
||||
return 0.9 if filename =~ /\A(un)?licen[sc]e\.(md|markdown|txt)\z/i
|
||||
return 0.8 if filename =~ /\Acopy(ing|right)(\.[^.]+)?\z/i
|
||||
return 0.7 if filename =~ /\A(un)?licen[sc]e\.[^.]+\z/i
|
||||
return 0.5 if filename =~ /licen[sc]e/i
|
||||
return 0.0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
class Licensee
|
||||
class Project
|
||||
class PackageInfo < Licensee::Project::File
|
||||
def possible_matchers
|
||||
case ::File.extname(filename)
|
||||
when ".gemspec"
|
||||
[Matchers::Gemspec]
|
||||
when ".json"
|
||||
[Matchers::NpmBower]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def self.name_score(filename)
|
||||
return 1.0 if ::File.extname(filename) == ".gemspec"
|
||||
return 1.0 if filename == "package.json"
|
||||
return 0.75 if filename == "bower.json"
|
||||
return 0.0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
class Licensee
|
||||
class Project
|
||||
class Readme < LicenseFile
|
||||
SCORES = {
|
||||
/\AREADME\z/i => 1.0,
|
||||
/\AREADME\.(md|markdown|txt)\z/i => 0.9
|
||||
}
|
||||
|
||||
CONTENT_REGEX = /^#+ Licen[sc]e$(.*?)(?=#+|\z)/im
|
||||
|
||||
def self.name_score(filename)
|
||||
SCORES.each do |pattern, score|
|
||||
return score if pattern =~ filename
|
||||
end
|
||||
return 0.0
|
||||
end
|
||||
|
||||
def self.license_content(content)
|
||||
match = CONTENT_REGEX.match(content)
|
||||
match[1].strip if match
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
# Filesystem-based project
|
||||
#
|
||||
# Analyze a folder on the filesystem for license information
|
||||
class Licensee
|
||||
class FSProject < Project
|
||||
attr_reader :path
|
||||
|
||||
def initialize(path, **args)
|
||||
@path = path
|
||||
super(**args)
|
||||
end
|
||||
|
||||
private
|
||||
def find_file
|
||||
files = []
|
||||
|
||||
Dir.foreach(path) do |file|
|
||||
next unless ::File.file?(::File.join(path, file))
|
||||
if (score = yield file) > 0
|
||||
files.push({ :name => file, :score => score })
|
||||
end
|
||||
end
|
||||
|
||||
return if files.empty?
|
||||
files.sort! { |a, b| b[:score] <=> a[:score] }
|
||||
|
||||
f = files.first
|
||||
[::File.read(::File.join(path, f[:name])), f[:name]]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,50 @@
|
|||
# Git-based project
|
||||
#
|
||||
# analyze a given git repository for license information
|
||||
class Licensee
|
||||
class GitProject < Licensee::Project
|
||||
attr_reader :repository, :revision
|
||||
|
||||
class InvalidRepository < ArgumentError; end
|
||||
|
||||
def initialize(repo, revision: nil, **args)
|
||||
if repo.kind_of? Rugged::Repository
|
||||
@repository = repo
|
||||
else
|
||||
@repository = Rugged::Repository.new(repo)
|
||||
end
|
||||
|
||||
@revision = revision
|
||||
super(**args)
|
||||
rescue Rugged::RepositoryError
|
||||
raise InvalidRepository
|
||||
end
|
||||
|
||||
private
|
||||
def commit
|
||||
@commit ||= revision ? repository.lookup(revision) : repository.last_commit
|
||||
end
|
||||
|
||||
MAX_LICENSE_SIZE = 64 * 1024
|
||||
|
||||
def load_blob_data(oid)
|
||||
data, _ = Rugged::Blob.to_buffer(repository, oid, MAX_LICENSE_SIZE)
|
||||
data
|
||||
end
|
||||
|
||||
def find_file
|
||||
files = commit.tree.map do |entry|
|
||||
next unless entry[:type] == :blob
|
||||
if (score = yield entry[:name]) > 0
|
||||
{ :name => entry[:name], :oid => entry[:oid], :score => score }
|
||||
end
|
||||
end.compact
|
||||
|
||||
return if files.empty?
|
||||
files.sort! { |a, b| b[:score] <=> a[:score] }
|
||||
|
||||
f = files.first
|
||||
[load_blob_data(f[:oid]), f[:name]]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
class Licensee
|
||||
VERSION = "6.0.0b1"
|
||||
VERSION = "6.1.0"
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ repo=$1
|
|||
name=$(basename $repo)
|
||||
dir="./tmp/$name"
|
||||
|
||||
git clone -q "$repo" "$dir"
|
||||
git clone --depth 1 --quiet "$repo" "$dir"
|
||||
bundle exec bin/licensee "$dir"
|
||||
|
||||
rm -Rf "$dir"
|
||||
|
|
|
@ -12,6 +12,10 @@ class TestLicensee < Minitest::Test
|
|||
assert_equal "mit", Licensee.license(fixture_path("licenses.git")).key
|
||||
end
|
||||
|
||||
should "init a project" do
|
||||
assert_equal Licensee::GitProject, Licensee.project(fixture_path("licenses.git")).class
|
||||
end
|
||||
|
||||
context "confidence threshold" do
|
||||
should "return the confidence threshold" do
|
||||
assert_equal 90, Licensee.confidence_threshold
|
||||
|
|
|
@ -14,7 +14,7 @@ class TestLicenseeLicense < Minitest::Test
|
|||
should "read the license body if it contains `---`" do
|
||||
license = Licensee::License.new "MIT"
|
||||
content = "---\nfoo: bar\n---\nSome license\n---------\nsome text\n"
|
||||
license.instance_variable_set(:@content, content)
|
||||
license.instance_variable_set(:@raw_content, content)
|
||||
assert_equal "Some license\n---------\nsome text\n", license.body
|
||||
end
|
||||
|
||||
|
@ -103,6 +103,10 @@ class TestLicenseeLicense < Minitest::Test
|
|||
refute license.featured?
|
||||
end
|
||||
|
||||
should "know the license hash" do
|
||||
assert_equal "fb278496ea4663dfcf41ed672eb7e56eb70de798", @license.hash
|
||||
end
|
||||
|
||||
describe "name without version" do
|
||||
should "strip the version from the license name" do
|
||||
expected = "GNU Affero General Public License"
|
||||
|
@ -128,7 +132,6 @@ class TestLicenseeLicense < Minitest::Test
|
|||
should "load the licenses" do
|
||||
assert_equal Array, Licensee::License.all.class
|
||||
assert_equal 15, Licensee::License.all.size
|
||||
assert_equal 24, Licensee::License.all(:hidden => true).size
|
||||
assert_equal Licensee::License, Licensee::License.all.first.class
|
||||
end
|
||||
|
||||
|
@ -137,5 +140,13 @@ class TestLicenseeLicense < Minitest::Test
|
|||
assert_equal "mit", Licensee::License.find("MIT").key
|
||||
assert_equal "mit", Licensee::License["mit"].key
|
||||
end
|
||||
|
||||
should "filter the licenses" do
|
||||
assert_equal 24, Licensee::License.all(:hidden => true).size
|
||||
assert_equal 3, Licensee::License.all(:featured => true).size
|
||||
assert_equal 12, Licensee::License.all(:featured => false).size
|
||||
assert_equal 21, Licensee::License.all(:featured => false, :hidden => true).size
|
||||
assert_equal 12, Licensee::License.all(:featured => false, :hidden => false).size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
require 'helper'
|
||||
|
||||
class TestLicenseeLicenseFile < Minitest::Test
|
||||
def setup
|
||||
@repo = Rugged::Repository.new(fixture_path("licenses.git"))
|
||||
blob, _ = Rugged::Blob.to_buffer(@repo, 'bcb552d06d9cf1cd4c048a6d3bf716849c2216cc')
|
||||
@file = Licensee::Project::LicenseFile.new(blob)
|
||||
end
|
||||
|
||||
context "content" do
|
||||
should "parse the attribution" do
|
||||
assert_equal "Copyright (c) 2014 Ben Balter", @file.attribution
|
||||
end
|
||||
|
||||
should "not choke on non-UTF-8 licenses" do
|
||||
text = "\x91License\x93".force_encoding('windows-1251')
|
||||
file = Licensee::Project::LicenseFile.new(text)
|
||||
assert_equal nil, file.attribution
|
||||
end
|
||||
|
||||
should "create the wordset" do
|
||||
assert_equal 93, @file.wordset.count
|
||||
assert_equal "the", @file.wordset.first
|
||||
end
|
||||
|
||||
should "create the hash" do
|
||||
assert_equal "fb278496ea4663dfcf41ed672eb7e56eb70de798", @file.hash
|
||||
end
|
||||
end
|
||||
|
||||
context "license filename scoring" do
|
||||
EXPECTATIONS = {
|
||||
"license" => 1.0,
|
||||
"LICENCE" => 1.0,
|
||||
"unLICENSE" => 1.0,
|
||||
"unlicence" => 1.0,
|
||||
"license.md" => 0.9,
|
||||
"LICENSE.md" => 0.9,
|
||||
"license.txt" => 0.9,
|
||||
"COPYING" => 0.8,
|
||||
"copyRIGHT" => 0.8,
|
||||
"COPYRIGHT.txt" => 0.8,
|
||||
"LICENSE.php" => 0.7,
|
||||
"LICENSE-MIT" => 0.5,
|
||||
"MIT-LICENSE.txt" => 0.5,
|
||||
"mit-license-foo.md" => 0.5,
|
||||
"README.txt" => 0.0
|
||||
}
|
||||
|
||||
EXPECTATIONS.each do |filename, expected|
|
||||
should "score a license named `#{filename}` as `#{expected}`" do
|
||||
assert_equal expected, Licensee::Project::LicenseFile.name_score(filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
require 'helper'
|
||||
|
||||
class TestLicenseePackageInfo < Minitest::Test
|
||||
context "license filename scoring" do
|
||||
EXPECTATIONS = {
|
||||
"licensee.gemspec" => 1.0,
|
||||
"package.json" => 1.0,
|
||||
"bower.json" => 0.75,
|
||||
"README.md" => 0.0
|
||||
}
|
||||
|
||||
EXPECTATIONS.each do |filename, expected|
|
||||
should "score a license named `#{filename}` as `#{expected}`" do
|
||||
assert_equal expected, Licensee::Project::PackageInfo.name_score(filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -21,84 +21,4 @@ class TestLicenseeProjectFile < Minitest::Test
|
|||
should "calculate confidence" do
|
||||
assert_equal 100, @file.confidence
|
||||
end
|
||||
|
||||
should "parse the attribution" do
|
||||
assert_equal "Copyright (c) 2014 Ben Balter", @file.attribution
|
||||
end
|
||||
|
||||
context "license filename scoring" do
|
||||
EXPECTATIONS = {
|
||||
"license" => 1.0,
|
||||
"LICENCE" => 1.0,
|
||||
"unLICENSE" => 1.0,
|
||||
"unlicence" => 1.0,
|
||||
"license.md" => 0.9,
|
||||
"LICENSE.md" => 0.9,
|
||||
"license.txt" => 0.9,
|
||||
"COPYING" => 0.8,
|
||||
"copyRIGHT" => 0.8,
|
||||
"COPYRIGHT.txt" => 0.8,
|
||||
"LICENSE.php" => 0.7,
|
||||
"LICENSE-MIT" => 0.5,
|
||||
"MIT-LICENSE.txt" => 0.5,
|
||||
"mit-license-foo.md" => 0.5,
|
||||
"README.txt" => 0.0
|
||||
}
|
||||
|
||||
EXPECTATIONS.each do |filename, expected|
|
||||
should "score a license named `#{filename}` as `#{expected}`" do
|
||||
assert_equal expected, Licensee::Project::LicenseFile.name_score(filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "readme filename scoring" do
|
||||
EXPECTATIONS = {
|
||||
"readme" => 1.0,
|
||||
"README" => 1.0,
|
||||
"readme.md" => 0.9,
|
||||
"README.md" => 0.9,
|
||||
"readme.txt" => 0.9,
|
||||
"LICENSE" => 0.0
|
||||
}
|
||||
|
||||
EXPECTATIONS.each do |filename, expected|
|
||||
should "score a readme named `#{filename}` as `#{expected}`" do
|
||||
assert_equal expected, Licensee::Project::Readme.name_score(filename)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "readme content" do
|
||||
should "be blank if not license text" do
|
||||
content = Licensee::Project::Readme.license_content("There is no License in this README")
|
||||
assert_equal nil, content
|
||||
end
|
||||
|
||||
should "get content after h1" do
|
||||
content = Licensee::Project::Readme.license_content("# License\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "get content after h2" do
|
||||
content = Licensee::Project::Readme.license_content("## License\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "be case-insensitive" do
|
||||
content = Licensee::Project::Readme.license_content("## LICENSE\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "be british" do
|
||||
content = Licensee::Project::Readme.license_content("## Licence\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "not include trailing content" do
|
||||
content = Licensee::Project::Readme.license_content("## License\n\nhello world\n\n# Contributing")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
require 'helper'
|
||||
|
||||
class TestLicenseeReadme < Minitest::Test
|
||||
context "readme filename scoring" do
|
||||
EXPECTATIONS = {
|
||||
"readme" => 1.0,
|
||||
"README" => 1.0,
|
||||
"readme.md" => 0.9,
|
||||
"README.md" => 0.9,
|
||||
"readme.txt" => 0.9,
|
||||
"LICENSE" => 0.0
|
||||
}
|
||||
|
||||
EXPECTATIONS.each do |filename, expected|
|
||||
should "score a readme named `#{filename}` as `#{expected}`" do
|
||||
assert_equal expected, Licensee::Project::Readme.name_score(filename)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "readme content" do
|
||||
should "be blank if not license text" do
|
||||
content = Licensee::Project::Readme.license_content("There is no License in this README")
|
||||
assert_equal nil, content
|
||||
end
|
||||
|
||||
should "get content after h1" do
|
||||
content = Licensee::Project::Readme.license_content("# License\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "get content after h2" do
|
||||
content = Licensee::Project::Readme.license_content("## License\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "be case-insensitive" do
|
||||
content = Licensee::Project::Readme.license_content("## LICENSE\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "be british" do
|
||||
content = Licensee::Project::Readme.license_content("## Licence\n\nhello world")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
|
||||
should "not include trailing content" do
|
||||
content = Licensee::Project::Readme.license_content("## License\n\nhello world\n\n# Contributing")
|
||||
assert_equal "hello world", content
|
||||
end
|
||||
end
|
||||
end
|
|
@ -17,7 +17,7 @@ permitted:
|
|||
- distribution
|
||||
- sublicense
|
||||
- private-use
|
||||
- patent-grant
|
||||
- patent-use
|
||||
|
||||
forbidden:
|
||||
- trademark-use
|
||||
|
|
|
@ -3,7 +3,7 @@ title: GNU Affero General Public License v3.0
|
|||
nickname: GNU Affero GPL v3.0
|
||||
tab-slug: agpl-v3
|
||||
redirect_from: /licenses/agpl/
|
||||
category: GPL
|
||||
family: GPL
|
||||
variant: true
|
||||
source: http://www.gnu.org/licenses/agpl-3.0.txt
|
||||
|
||||
|
@ -23,7 +23,7 @@ permitted:
|
|||
- commercial-use
|
||||
- modifications
|
||||
- distribution
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -20,7 +20,7 @@ permitted:
|
|||
- modifications
|
||||
- distribution
|
||||
- sublicense
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -3,7 +3,7 @@ title: BSD 2-clause "Simplified" License
|
|||
nickname: Simplified BSD
|
||||
tab-slug: bsd
|
||||
redirect_from: /licenses/bsd/
|
||||
category: BSD
|
||||
family: BSD
|
||||
variant: true
|
||||
source: http://opensource.org/licenses/BSD-2-Clause
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ title: BSD 3-clause Clear License
|
|||
nickname: Clear BSD
|
||||
hidden: true
|
||||
|
||||
category: BSD
|
||||
family: BSD
|
||||
tab-slug: bsd-3-clear
|
||||
variant: true
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: BSD 3-clause "New" or "Revised" License
|
||||
nickname: New BSD
|
||||
tab-slug: bsd-3
|
||||
category: BSD
|
||||
family: BSD
|
||||
variant: true
|
||||
source: http://opensource.org/licenses/BSD-3-Clause
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ title: Creative Commons Zero v1.0 Universal
|
|||
nickname: CC0 1.0 Universal
|
||||
tab-slug: cc0
|
||||
redirect_from: /licenses/cc0/
|
||||
category: Public Domain Dedication
|
||||
family: Public Domain Dedication
|
||||
variant: true
|
||||
source: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ 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.
|
||||
|
||||
using:
|
||||
The Eclipse Foundation: "http://www.eclipse.org"
|
||||
OpenDaylight: "http://www.opendaylight.org/"
|
||||
Clojure: "http://clojure.org/"
|
||||
JUnit: "http://junit.org/"
|
||||
Ruby: "https://github.com/jruby/jruby"
|
||||
Mondrian: "http://en.wikipedia.org/wiki/Mondrian_OLAP_server"
|
||||
- The Eclipse Foundation: "http://www.eclipse.org"
|
||||
- OpenDaylight: "http://www.opendaylight.org/"
|
||||
- Clojure: "http://clojure.org/"
|
||||
- JUnit: "http://junit.org/"
|
||||
- Ruby: "https://github.com/jruby/jruby"
|
||||
- Mondrian: "http://en.wikipedia.org/wiki/Mondrian_OLAP_server"
|
||||
|
||||
required:
|
||||
- disclose-source
|
||||
|
@ -24,7 +24,7 @@ permitted:
|
|||
- distribution
|
||||
- modifications
|
||||
- sublicense
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -3,8 +3,8 @@ title: GNU General Public License v2.0
|
|||
nickname: GNU GPL v2.0
|
||||
tab-slug: gpl-v2
|
||||
redirect_from: /licenses/gpl-v2/
|
||||
category: GPL
|
||||
featured: true
|
||||
family: GPL
|
||||
variant: true
|
||||
source: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
|
||||
description: GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license. There are multiple variants of the GPL, each with different requirements.
|
||||
|
@ -22,7 +22,7 @@ permitted:
|
|||
- commercial-use
|
||||
- modifications
|
||||
- distribution
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -3,8 +3,8 @@ title: GNU General Public License v3.0
|
|||
nickname: GNU GPL v3.0
|
||||
tab-slug: gpl-v3
|
||||
redirect_from: /licenses/gpl-v3/
|
||||
category: GPL
|
||||
variant: true
|
||||
family: GPL
|
||||
featured: true
|
||||
source: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
description: GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license.
|
||||
|
@ -22,12 +22,11 @@ permitted:
|
|||
- commercial-use
|
||||
- modifications
|
||||
- distribution
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
- no-liability
|
||||
- no-sublicense
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: ISC License
|
||||
tab-slug: isc
|
||||
category: BSD
|
||||
family: BSD
|
||||
source: http://opensource.org/licenses/isc-license
|
||||
|
||||
description: A permissive license lets people do anything with your code with proper attribution and without warranty. The ISC license is functionally equivalent to the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/mit">MIT</a> licenses, removing some language that is no longer necessary.
|
||||
|
|
|
@ -3,7 +3,8 @@ title: GNU Lesser General Public License v2.1
|
|||
nickname: GNU LGPL v2.1
|
||||
tab-slug: lgpl-v2_1
|
||||
redirect_from: /licenses/lgpl-v2.1/
|
||||
category: LGPL
|
||||
family: LGPL
|
||||
variant: true
|
||||
source: http://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
description: Primarily used for software libraries, LGPL requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction. There are two commonly used versions of the LGPL.
|
||||
|
@ -22,7 +23,7 @@ permitted:
|
|||
- modifications
|
||||
- distribution
|
||||
- sublicense
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -3,11 +3,10 @@ title: GNU Lesser General Public License v3.0
|
|||
nickname: GNU LGPL v3.0
|
||||
tab-slug: lgpl-v3
|
||||
redirect_from: /licenses/lgpl-v3/
|
||||
category: LGPL
|
||||
variant: true
|
||||
family: LGPL
|
||||
source: http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -23,7 +22,7 @@ permitted:
|
|||
- modifications
|
||||
- distribution
|
||||
- sublicense
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Mozilla Public License 2.0
|
||||
redirect_from: /licenses/mozilla/
|
||||
source: http://www.mozilla.org/MPL/2.0/
|
||||
source: https://www.mozilla.org/media/MPL/2.0/index.txt
|
||||
|
||||
description: The Mozilla Public License (MPL 2.0) is maintained by the Mozilla foundation. This license attempts to be a compromise between the permissive BSD license and the reciprocal GPL license.
|
||||
|
||||
|
@ -16,7 +16,7 @@ permitted:
|
|||
- modifications
|
||||
- distribution
|
||||
- sublicense
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
@ -25,365 +25,376 @@ forbidden:
|
|||
|
||||
---
|
||||
|
||||
Mozilla Public License, version 2.0
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
|
||||
means each individual or legal entity that creates, contributes to the
|
||||
creation of, or owns Covered Software.
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
|
||||
means the combination of the Contributions of others (if any) used by a
|
||||
Contributor and that particular Contributor's Contribution.
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
|
||||
means Covered Software of a particular Contributor.
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
|
||||
means Source Code Form to which the initial Contributor has attached the
|
||||
notice in Exhibit A, the Executable Form of such Source Code Form, and
|
||||
Modifications of such Source Code Form, in each case including portions
|
||||
thereof.
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
means
|
||||
|
||||
a. that the initial Contributor has attached the notice described in
|
||||
Exhibit B to the Covered Software; or
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
b. that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the terms of
|
||||
a Secondary License.
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
|
||||
means any form of the work other than Source Code Form.
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
|
||||
means a work that combines Covered Software with other material, in a
|
||||
separate file or files, that is not Covered Software.
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
|
||||
means this document.
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
|
||||
means having the right to grant, to the maximum extent possible, whether
|
||||
at the time of the initial grant or subsequently, any and all of the
|
||||
rights conveyed by this License.
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
means any of the following:
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
a. any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered Software; or
|
||||
|
||||
b. any new file in Source Code Form that contains any Covered Software.
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the License,
|
||||
by the making, using, selling, offering for sale, having made, import,
|
||||
or transfer of either its Contributions or its Contributor Version.
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
|
||||
means either the GNU General Public License, Version 2.0, the GNU Lesser
|
||||
General Public License, Version 2.1, the GNU Affero General Public
|
||||
License, Version 3.0, or any later versions of those licenses.
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
|
||||
means the form of the work preferred for making modifications.
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that controls, is
|
||||
controlled by, or is under common control with You. For purposes of this
|
||||
definition, "control" means (a) the power, direct or indirect, to cause
|
||||
the direction or management of such entity, whether by contract or
|
||||
otherwise, or (b) ownership of more than fifty percent (50%) of the
|
||||
outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
a. under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
b. under Patent Claims of such Contributor to make, use, sell, offer for
|
||||
sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
a. for any code that a Contributor has removed from Covered Software; or
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
b. for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
c. under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights to
|
||||
grant the rights to its Contributions conveyed by this License.
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
|
||||
Section 2.1.
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
a. such Covered Software must also be made available in Source Code Form,
|
||||
as described in Section 3.1, and You must inform recipients of the
|
||||
Executable Form how they can obtain a copy of such Source Code Form by
|
||||
reasonable means in a timely manner, at a charge no more than the cost
|
||||
of distribution to the recipient; and
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
b. You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter the
|
||||
recipients' rights in the Source Code Form under this License.
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty, or
|
||||
limitations of liability) contained within the Source Code Form of the
|
||||
Covered Software, except that You may alter any license notices to the
|
||||
extent required to remedy known factual inaccuracies.
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this License
|
||||
with respect to some or all of the Covered Software due to statute,
|
||||
judicial order, or regulation then You must: (a) comply with the terms of
|
||||
this License to the maximum extent possible; and (b) describe the
|
||||
limitations and the code they affect. Such description must be placed in a
|
||||
text file included with all distributions of the Covered Software under
|
||||
this License. Except to the extent prohibited by statute or regulation,
|
||||
such description must be sufficiently detailed for a recipient of ordinary
|
||||
skill to be able to understand it.
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically if You
|
||||
fail to comply with any of its terms. However, if You become compliant,
|
||||
then the rights granted under this License from a particular Contributor
|
||||
are reinstated (a) provisionally, unless and until such Contributor
|
||||
explicitly and finally terminates Your grants, and (b) on an ongoing
|
||||
basis, if such Contributor fails to notify You of the non-compliance by
|
||||
some reasonable means prior to 60 days after You have come back into
|
||||
compliance. Moreover, Your grants from a particular Contributor are
|
||||
reinstated on an ongoing basis if such Contributor notifies You of the
|
||||
non-compliance by some reasonable means, this is the first time You have
|
||||
received notice of non-compliance with this License from such
|
||||
Contributor, and You become compliant prior to 30 days after Your receipt
|
||||
of the notice.
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
|
||||
license agreements (excluding distributors and resellers) which have been
|
||||
validly granted by You or Your distributors under this License prior to
|
||||
termination shall survive termination.
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
6. Disclaimer of Warranty
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
Covered Software is provided under this License on an "as is" basis,
|
||||
without warranty of any kind, either expressed, implied, or statutory,
|
||||
including, without limitation, warranties that the Covered Software is free
|
||||
of defects, merchantable, fit for a particular purpose or non-infringing.
|
||||
The entire risk as to the quality and performance of the Covered Software
|
||||
is with You. Should any Covered Software prove defective in any respect,
|
||||
You (not any Contributor) assume the cost of any necessary servicing,
|
||||
repair, or correction. This disclaimer of warranty constitutes an essential
|
||||
part of this License. No use of any Covered Software is authorized under
|
||||
this License except under this disclaimer.
|
||||
|
||||
7. Limitation of Liability
|
||||
|
||||
Under no circumstances and under no legal theory, whether tort (including
|
||||
negligence), contract, or otherwise, shall any Contributor, or anyone who
|
||||
distributes Covered Software as permitted above, be liable to You for any
|
||||
direct, indirect, special, incidental, or consequential damages of any
|
||||
character including, without limitation, damages for lost profits, loss of
|
||||
goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses, even if such party shall have been
|
||||
informed of the possibility of such damages. This limitation of liability
|
||||
shall not apply to liability for death or personal injury resulting from
|
||||
such party's negligence to the extent applicable law prohibits such
|
||||
limitation. Some jurisdictions do not allow the exclusion or limitation of
|
||||
incidental or consequential damages, so this exclusion and limitation may
|
||||
not apply to You.
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the courts
|
||||
of a jurisdiction where the defendant maintains its principal place of
|
||||
business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions. Nothing
|
||||
in this Section shall prevent a party's ability to bring cross-claims or
|
||||
counter-claims.
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides that
|
||||
the language of a contract shall be construed against the drafter shall not
|
||||
be used to construe this License against a Contributor.
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses If You choose to distribute Source Code Form that is
|
||||
Incompatible With Secondary Licenses under the terms of this version of
|
||||
the License, the notice described in Exhibit B of this License must be
|
||||
attached.
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular file,
|
||||
then You may include the notice in a location (such as a LICENSE file in a
|
||||
relevant directory) where a recipient would be likely to look for such a
|
||||
notice.
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible
|
||||
With Secondary Licenses", as defined by
|
||||
the Mozilla Public License, v. 2.0.
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
|
|
@ -15,7 +15,7 @@ permitted:
|
|||
- commercial-use
|
||||
- modifications
|
||||
- distribution
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -15,7 +15,7 @@ permitted:
|
|||
- commercial-use
|
||||
- modifications
|
||||
- distribution
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
|
||||
forbidden:
|
||||
|
|
|
@ -10,11 +10,11 @@ how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of
|
|||
note: OSL 3.0's author has <a href="http://rosenlaw.com/OSL3.0-explained.htm">provided an explanation</a> behind the creation of the license.
|
||||
|
||||
using:
|
||||
Magento Community Edition: "http://magento.com/"
|
||||
Parsimony: "https://github.com/parsimony/parsimony"
|
||||
PrestaShop: "https://www.prestashop.com"
|
||||
Mulgara: "http://mulgara.org"
|
||||
AbanteCart: "http://www.abantecart.com/"
|
||||
- Magento Community Edition: "http://magento.com/"
|
||||
- Parsimony: "https://github.com/parsimony/parsimony"
|
||||
- PrestaShop: "https://www.prestashop.com"
|
||||
- Mulgara: "http://mulgara.org"
|
||||
- AbanteCart: "http://www.abantecart.com/"
|
||||
|
||||
required:
|
||||
- include-copyright
|
||||
|
@ -24,7 +24,7 @@ permitted:
|
|||
- commercial-use
|
||||
- distribution
|
||||
- modifications
|
||||
- patent-grant
|
||||
- patent-use
|
||||
- private-use
|
||||
- sublicense
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: The Unlicense
|
||||
tab-slug: unlicense
|
||||
category: Public Domain Dedication
|
||||
family: Public Domain Dedication
|
||||
source: http://unlicense.org/UNLICENSE
|
||||
|
||||
description: Because copyright is automatic in most countries, <a href="http://unlicense.org">the Unlicense</a> is a template to waive copyright interest in software you've written and dedicate it to the public domain. Use the Unlicense to opt out of copyright entirely. It also includes the no-warranty statement from the MIT/X11 license.
|
||||
|
|
Loading…
Reference in New Issue