mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 12:50:24 +01:00
Merge pull request #555 from github/test-using-examples
Test examples provided in 'using:' would be detected by licensee
This commit is contained in:
commit
7213ccf8ac
1
Gemfile
1
Gemfile
@ -16,6 +16,7 @@ end
|
|||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'html-proofer', '~> 3.0'
|
gem 'html-proofer', '~> 3.0'
|
||||||
|
gem 'licensee'
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'rspec'
|
gem 'rspec'
|
||||||
|
@ -12,7 +12,7 @@ note: The Apereo Foundation recommends taking the additional step of adding a bo
|
|||||||
using:
|
using:
|
||||||
- Sakai: https://github.com/sakaiproject/sakai/blob/master/LICENSE
|
- Sakai: https://github.com/sakaiproject/sakai/blob/master/LICENSE
|
||||||
- OAE: https://github.com/oaeproject/Hilary/blob/master/LICENSE
|
- OAE: https://github.com/oaeproject/Hilary/blob/master/LICENSE
|
||||||
- Opencast: https://bitbucket.org/opencast-community/opencast/src/905077ba5e6483f8c49869a1fc13bf9268790a79/LICENSE?at=develop
|
- Opencast: https://bitbucket.org/opencast-community/opencast/src/905077ba5e6483f8c49869a1fc13bf9268790a79/LICENSE
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
- commercial-use
|
- commercial-use
|
||||||
|
@ -13,8 +13,9 @@ how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of
|
|||||||
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.
|
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.
|
||||||
|
|
||||||
using:
|
using:
|
||||||
- Linux: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/COPYING
|
- AliSQL: https://github.com/alibaba/AliSQL/blob/master/COPYING
|
||||||
- WordPress: https://github.com/WordPress/WordPress/blob/master/license.txt
|
- Discourse: https://github.com/discourse/discourse/blob/master/LICENSE.txt
|
||||||
|
- Joomla!: https://github.com/joomla/joomla-cms/blob/staging/LICENSE.txt
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
- commercial-use
|
- commercial-use
|
||||||
|
@ -14,9 +14,9 @@ how: Create a text file (typically named LICENSE or LICENSE.txt) in the root of
|
|||||||
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.
|
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.
|
||||||
|
|
||||||
using:
|
using:
|
||||||
|
- Ansible: https://github.com/ansible/ansible/blob/devel/COPYING
|
||||||
- Bash: https://git.savannah.gnu.org/cgit/bash.git/tree/COPYING
|
- Bash: https://git.savannah.gnu.org/cgit/bash.git/tree/COPYING
|
||||||
- GIMP: https://git.gnome.org/browse/gimp/tree/COPYING
|
- GIMP: https://git.gnome.org/browse/gimp/tree/COPYING
|
||||||
- Privacy Badger: https://github.com/EFForg/privacybadgerfirefox/blob/master/LICENSE
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
- commercial-use
|
- commercial-use
|
||||||
|
@ -8,7 +8,7 @@ description: A permissive license lets people do anything with your code with pr
|
|||||||
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.
|
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.
|
||||||
|
|
||||||
using:
|
using:
|
||||||
- documentation.js: https://github.com/documentationjs/documentation/blob/master/LICENSE
|
- Helix: https://github.com/tildeio/helix/blob/master/LICENSE
|
||||||
- Node.js semver: https://github.com/npm/node-semver/blob/master/LICENSE
|
- Node.js semver: https://github.com/npm/node-semver/blob/master/LICENSE
|
||||||
- OpenStreetMap iD: https://github.com/openstreetmap/iD/blob/master/LICENSE.md
|
- OpenStreetMap iD: https://github.com/openstreetmap/iD/blob/master/LICENSE.md
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ description: A short and simple permissive license with conditions only requirin
|
|||||||
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.
|
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.
|
||||||
|
|
||||||
using:
|
using:
|
||||||
- jQuery: https://github.com/jquery/jquery/blob/master/LICENSE.txt
|
- Babel: https://github.com/babel/babel/blob/master/LICENSE
|
||||||
- .NET Core: https://github.com/dotnet/corefx/blob/master/LICENSE.TXT
|
- .NET Core: https://github.com/dotnet/corefx/blob/master/LICENSE.TXT
|
||||||
- Rails: https://github.com/rails/rails/blob/master/activerecord/MIT-LICENSE
|
- Rails: https://github.com/rails/rails/blob/master/MIT-LICENSE
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
- commercial-use
|
- commercial-use
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'licensee'
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'license meta' do
|
describe 'license meta' do
|
||||||
@ -19,6 +20,8 @@ describe 'license meta' do
|
|||||||
expect(missing).to be_empty
|
expect(missing).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
examples = raw_fields['using'] || []
|
||||||
|
|
||||||
it 'using contains 3 examples' do
|
it 'using contains 3 examples' do
|
||||||
legacy = [
|
legacy = [
|
||||||
'afl-3.0',
|
'afl-3.0',
|
||||||
@ -32,7 +35,6 @@ describe 'license meta' do
|
|||||||
'cc-by-4.0',
|
'cc-by-4.0',
|
||||||
'cc-by-sa-4.0',
|
'cc-by-sa-4.0',
|
||||||
'eupl-1.1',
|
'eupl-1.1',
|
||||||
'gpl-2.0',
|
|
||||||
'lgpl-2.1',
|
'lgpl-2.1',
|
||||||
'lgpl-3.0',
|
'lgpl-3.0',
|
||||||
'lppl-1.3c',
|
'lppl-1.3c',
|
||||||
@ -43,9 +45,45 @@ describe 'license meta' do
|
|||||||
'zlib'
|
'zlib'
|
||||||
]
|
]
|
||||||
skip 'added before 3 using examples required' if legacy.include?(license['slug'])
|
skip 'added before 3 using examples required' if legacy.include?(license['slug'])
|
||||||
examples = raw_fields['using'] || []
|
|
||||||
expect(examples.length).to eq(3)
|
expect(examples.length).to eq(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'licensee detects using examples' do
|
||||||
|
module Licensee
|
||||||
|
class License
|
||||||
|
class << self
|
||||||
|
def license_dir
|
||||||
|
dir = ::File.dirname(__FILE__)
|
||||||
|
::File.expand_path '../_licenses', dir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
slug = license['slug']
|
||||||
|
|
||||||
|
examples.each do |example|
|
||||||
|
example_url = example.values[0]
|
||||||
|
|
||||||
|
context "the #{example_url} URL" do
|
||||||
|
let(:content) { open(example_url).read }
|
||||||
|
let(:detected) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE').license }
|
||||||
|
|
||||||
|
if example_url.start_with?('https://github.com/')
|
||||||
|
example_url.gsub!(%r{\Ahttps://github.com/([\w-]+/[\w-]+)/blob/([\w-]+/\S+)\z}, 'https://raw.githubusercontent.com/\1/\2')
|
||||||
|
elsif example_url.start_with?('https://git.savannah.gnu.org/', 'https://git.gnome.org/')
|
||||||
|
example_url.gsub!(%r{/tree/}, '/plain/')
|
||||||
|
elsif example_url.start_with?('https://bitbucket.org/')
|
||||||
|
example_url.gsub!(%r{/src/}, '/raw/')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is a #{slug} license" do
|
||||||
|
skip 'NCSA and PostgreSQL licenses hard to detect' if %(ncsa postgresql).include?(slug)
|
||||||
|
expect(detected.key).to eq(slug)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'jekyll'
|
require 'jekyll'
|
||||||
require 'open-uri'
|
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user