1
0
mirror of https://github.com/github/choosealicense.com synced 2024-07-03 00:49:11 +02:00

Merge branch 'gh-pages' of https://github.com/github/choosealicense.com into https-test

This commit is contained in:
Mike Linksvayer 2019-01-02 12:33:29 -08:00
commit 04306c7740
14 changed files with 189 additions and 17 deletions

View File

@ -5,7 +5,7 @@ script: "./script/cibuild"
#environment
language: ruby
rvm:
- 2.5.1
- 2.5.3
addons:
apt:

View File

@ -17,6 +17,7 @@ task :test do
enforce_https: true,
validation: { ignore_script_embeds: true },
url_swap: { %r{https://choosealicense.com} => '' },
hydra: { max_concurrency: 10 },
check_img_http: true).run
end

View File

@ -21,6 +21,16 @@
<script src="/assets/vendor/clipboard/dist/clipboard.min.js"></script>
<script>
window.annotations = {{ site.data.rules | jsonify }};
{% if page.collection == "licenses" %}
window.licenses = [
{% for license in site.licenses %}
{
"title": "{{ license.title | escape }}",
"spdx_id": "{{ license.spdx-id | escape }}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
];
{% endif %}
</script>
<script src="/assets/js/app.js"></script>
{% endif %}

View File

@ -1,30 +1,42 @@
<div class="sidebar">
<a href="#" data-clipboard-target="#license-text" data-proofer-ignore="true" class="js-clipboard-button button">Copy license text to clipboard</a>
<h3 id="suggest-this-license">Suggest this license</h3>
<div class="repository-suggestion">
<p>Make a pull request to suggest this license for a project that is <a href="/no-permission/">not licensed</a>. Please be polite: see if a license has already been suggested, try to suggest a license fitting for the project's <a href="/community/">community</a>, and keep your communication with project maintainers friendly.</p>
<div class="input-wrapper">
<input type="text" data-license-id="{{ page.spdx-id }}" placeholder="Enter GitHub repository URL" id="repository-url" title="status" />
<div class="status-indicator"></div>
</div>
</div>
<div class="how-to-apply">
<h3>How to apply this license</h3>
<p>
{{ page.how | markdownify | remove: '<p>' | remove: '</p>' }}
</p>
<div class="note">
<h4>Optional steps</h4>
{% if page.note %}
<p class="note">
<strong>Note: </strong> {{ page.note | markdownify | remove: '<p>' | remove: '</p>' }}
<p>
{{ page.note | markdownify | remove: '<p>' | remove: '</p>' }}
</p>
{% endif %}
{% assign xgpl = false %}
{% if page.spdx-id contains 'GPL' %}{% assign xgpl = true %}{% endif %}
<p class="note"><strong>Optional: </strong> Add <strong><code>{{ page.spdx-id }}{% if xgpl %}-or-later{% endif %}</code></strong>{% if xgpl %} (or <strong><code>{{ page.spdx-id }}-only</code></strong> to disallow future versions){% endif %} to your project's package description, if applicable (e.g., <a href="https://docs.npmjs.com/files/package.json#license">Node.js</a>, <a href="https://guides.rubygems.org/specification-reference/#license=">Ruby</a>, and <a href="https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata">Rust</a>). This will ensure the license is displayed in package directories.</p>
<p>Add <strong><code>{{ page.spdx-id }}{% if xgpl %}-or-later{% endif %}</code></strong>{% if xgpl %} (or <strong><code>{{ page.spdx-id }}-only</code></strong> to disallow future versions){% endif %} to your project's package description, if applicable (e.g., <a href="https://docs.npmjs.com/files/package.json#license">Node.js</a>, <a href="https://guides.rubygems.org/specification-reference/#license=">Ruby</a>, and <a href="https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata">Rust</a>). This will ensure the license is displayed in package directories.</p>
{% if page.spdx-id contains 'GPL-2' %}
<p>If you would like your project to adopt the GPL-3.0's cure provision, add the <a href="https://github.com/gplcc/gplcc/blob/master/Project/COMMITMENT">text</a> of the <a href="https://gplcc.github.io/gplcc/">GPL Cooperation Commitment</a> to a file named <code>COMMITMENT</code> in the same directory as your {{ page.spdx-id }} license file.</p>
{% endif %}
</div>
</div>
{% if page.source %}
<div class="source">
<a href="https://spdx.org/licenses/{{ page.spdx-id }}.html">
<span class="license-sprite"></span>
Source
</a>
</div>
{% endif %}
{% if page.using %}
<div class="projects-with-license">

View File

@ -8,7 +8,7 @@ hidden: false
description: Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.
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 in the root of your source code, typically named COPYING (a GNU convention), LICENSE or LICENSE.txt. Then copy the text of the license into that file.
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.

View File

@ -7,7 +7,7 @@ hidden: false
description: Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications under the same license or the GNU GPLv3. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work through interfaces provided by the licensed work may be distributed under different terms and without source code for the larger work.
how: This license is an additional set of permissions to the <a href="/licenses/gpl-3.0">GNU GPLv3</a> license. Follow the instructions to apply the GNU GPLv3. Then add a separate file named COPYING.LESSER in the root of your source code and copy the text.
how: This license is an additional set of permissions to the <a href="/licenses/gpl-3.0">GNU GPLv3</a> license. Follow the instructions to apply the GNU GPLv3, in the root of your source code. Then add another file named COPYING.LESSER and copy the text.
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">GNU GPLv3 license</a>. Insert the word “Lesser” before “General” in all three places in the boilerplate notice to make sure that you refer to the GNU LGPLv3 and not the GNU GPLv3.

View File

@ -7,7 +7,7 @@ description: A very short, BSD-style license, used specifically for PostgreSQL.
how: To use it, say that it is The PostgreSQL License, and then substitute the copyright year and name of the copyright holder into the body of the license. Then put the license into a prominent file ("COPYRIGHT", "LICENSE" or "COPYING" are common names for this file) in your software distribution.
using:
- pgBadger: https://github.com/dalibo/pgbadger/blob/master/LICENSE
- pgBadger: https://github.com/darold/pgbadger/blob/master/LICENSE
- pgAdmin: https://github.com/postgres/pgadmin4/blob/master/LICENSE
- .NET Access to PostgreSQL: https://github.com/npgsql/npgsql/blob/dev/LICENSE
@ -26,7 +26,7 @@ limitations:
---
PostgreSQL Licence
PostgreSQL License
Copyright (c) [year], [fullname]

View File

@ -294,6 +294,43 @@ strong {
width: 100%;
}
.sidebar input#repository-url {
width: 100%;
padding: 5px 20px 5px 10px;
box-sizing: border-box;
margin-right: 12px;
}
.input-wrapper {
position: relative;
}
.input-wrapper .status-indicator {
position: absolute;
right: 5px;
top: 6px;
height: 8px;
width: 8px;
border-radius: 50%;
background: #fff;
animation: none;
border: 4px solid #ddd;
}
.input-wrapper .status-indicator.fetching {
border-right-color: transparent;
animation: rotate 0.8s infinite linear;
}
.input-wrapper .status-indicator.error {
border: 4px solid #c6403d;
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.note {
color: #687072;
}
@ -386,7 +423,9 @@ strong {
.qtip-conditions,
.qtip-permissions,
.qtip-limitations {
.qtip-limitations,
.qtip-fetching,
.qtip-error {
font-size: 12px;
line-height: 1.3;
}
@ -402,23 +441,27 @@ strong {
color: #fff;
}
.qtip-fetching,
.qtip-permissions {
background-color: #d8f4d7;
border-color: #3dc637;
color: #298625;
}
.qtip-fetching .qtip-titlebar,
.qtip-permissions .qtip-titlebar {
background-color: #3dc637;
color: #fff;
}
.qtip-error,
.qtip-limitations {
background-color: #f4d9d8;
border-color: #c6403d;
color: #812a28;
}
.qtip-error .qtip-titlebar,
.qtip-limitations .qtip-titlebar {
background-color: #c6403d;
color: #fff;

View File

@ -31,6 +31,7 @@ class Choosealicense
constructor: ->
@initTooltips()
@initClipboard()
@initLicenseSuggestion()
# Init tooltip action
initTooltips: ->
@ -70,6 +71,111 @@ class Choosealicense
# Post-copy user feedback callback
clipboardComplete: (client, args) ->
@textContent = "Copied!"
# Initializes the repository suggestion feature
initLicenseSuggestion: ->
inputEl = $("#repository-url")
licenseId = inputEl.attr("data-license-id")
statusIndicator = $(".status-indicator")
new LicenseSuggestion(inputEl, licenseId, statusIndicator)
class LicenseSuggestion
constructor: (@inputEl, @licenseId, @statusIndicator) ->
@setupTooltips()
@bindEventHandlers()
# Initializes tooltips on the input element
setupTooltips: =>
@inputEl.qtip
content:
text: false
title:
text: "message"
show: false
hide: false
position:
my: "top center"
at: "bottom center"
style:
classes: "qtip-shadow"
# Main event handlers for user input
bindEventHandlers: =>
@inputEl.on "input", (event) =>
@setStatus ""
.on "keyup", (event) =>
if event.keyCode == 13 and event.target.value
# Validate the user input first
try
repositoryFullName = @parseUserInput event.target.value
catch
@setStatus "Error", "Invalid URL."
return
@setStatus "Fetching"
@fetchInfoFromGithubAPI repositoryFullName, (err, repositoryInfo=null) =>
if (err)
@setStatus "Error", err.message
return
if repositoryInfo.license # The repository already has a license
license = repositoryInfo.license
@setStatus "Error", @repositoryLicense repositoryFullName, license
else # The repository is not licensed
licenseUrl = encodeURIComponent "https://github.com/#{repositoryFullName}/community/license/new?template=#{@licenseId}"
# Provide the chance to the user log-in, since the URL to suggest a license is restricted
window.location.href = "https://github.com/login?return_to=#{licenseUrl}"
@setStatus ""
@inputEl.val("")
# Try to extract the repository full name from the user input
parseUserInput: (userInput) ->
repository = /https?:\/\/github\.com\/(.*?)\/(.+)(\.git)?$/.exec userInput
[_, username, project] = repository
project = project
.split /\/|\.git/
.filter (str) -> str
.slice 0, 1
.join ""
return username + '/' + project
# Displays an indicator and tooltips to the user about the current status
setStatus: (status="", message="") =>
statusClass = status.toLowerCase()
displayQtip = (status, message) =>
@inputEl.qtip("api")
.set("content.text", message)
.set("content.title", status)
.set("style.classes", "qtip-shadow qtip-#{statusClass}")
.show()
switch status
when "Fetching"
@statusIndicator.removeClass('error').addClass(statusClass)
when "Error"
@statusIndicator.removeClass('fetching').addClass(statusClass)
displayQtip status, message
else
@inputEl.qtip("api").hide()
@statusIndicator.removeClass('fetching error')
# Fetches information about a repository from the Github API
fetchInfoFromGithubAPI: (repositoryFullName, callback) ->
$.getJSON "https://api.github.com/repos/"+repositoryFullName, (info) ->
callback null, info
.fail (e) ->
if e.status == 404
callback new Error "Repository <b>#{repositoryFullName}</b> not found."
else
callback new Error "Network error when trying to get information about <b>#{repositoryFullName}</b>."
# Generates a message showing that a repository is already licensed
repositoryLicense: (repositoryFullName, license) ->
foundLicense = window.licenses.find (lic) -> lic.spdx_id == license.spdx_id
if foundLicense # Links the license to its page on this site
"The repository <b> #{repositoryFullName}</b> is already licensed under the
<a href='/licenses/#{foundLicense.spdx_id.toLowerCase()}'><b>#{foundLicense.title}</b></a>."
else
"The repository <b> #{repositoryFullName}</b> is already licensed."
$ ->
new Choosealicense()

View File

@ -18,6 +18,7 @@ Some communities have strong preferences for particular licenses. If you want to
* [GNU](https://www.gnu.org/licenses/license-recommendations.html) recommends [GNU GPLv3](/licenses/gpl-3.0/) for most programs
* [NPM packages](https://libraries.io/search?platforms=NPM) overwhelmingly use the [MIT](/licenses/mit/) or the very similar [ISC](/licenses/isc) licenses
* [OpenBSD](https://www.openbsd.org/policy.html) prefers the [ISC License](/licenses/isc/)
* [Rust](https://rust-lang-nursery.github.io/api-guidelines/necessities.html#crate-and-its-dependencies-have-a-permissive-license-c-permissive) crates are overwhelmingly licensed under both [MIT](/licenses/mit/) and [Apache License 2.0](/licenses/apache-2.0/)
* [WordPress](https://wordpress.org/about/license/) plugins and themes must be [GNU GPLv2](/licenses/gpl-2.0/) (or later)
Communities come in all shapes and sizes, and more than one might be pertinent (e.g., [your company](https://opensource.guide/legal/#what-does-my-companys-legal-team-need-to-know)). The examples above are *very* well established. If the community you see your project as a part of doesn't have set-in-stone licensing traditions, or you don't see your project as part of any particular community, that's just fine: [make your own choice of an open source license](/).

View File

@ -8,7 +8,7 @@ title: No License
description: "You're under no obligation to choose a license and it's your right not to include one with your code or project. But please note that opting out of open source licenses doesn't mean you're opting out of copyright law."
---
When you make a creative work (which includes code), the work is under exclusive copyright by default. Unless you include a license that specifies otherwise, nobody else can use, copy, distribute, or modify your work without being at risk of take-downs, shake-downs, or litigation. Once the work has other contributors (each a copyright holder), “nobody” starts including you.
When you make a creative work (which includes code), the work is under exclusive copyright by default. Unless you include a license that specifies otherwise, nobody else can copy, distribute, or modify your work without being at risk of take-downs, shake-downs, or litigation. Once the work has other contributors (each a copyright holder), “nobody” starts including you.
Even in the absence of a license file, you may grant some rights in cases where you publish your source code to a site that requires accepting terms of service. For example, if you publish your source code in a public repository on GitHub, you have accepted the [Terms of Service](https://help.github.com/articles/github-terms-of-service), by which you allow others to view and fork your repository. Others may not need your permission if [limitations and exceptions to copyright](https://en.wikipedia.org/wiki/Limitations_and_exceptions_to_copyright) apply to their particular situation. Neither site terms nor jurisdiction-specific copyright limitations are sufficient for the kinds of collaboration that people usually seek on a public code host, such as experimentation, modification, and sharing as fostered by an open source license.
@ -22,7 +22,7 @@ If you find software that doesn't have a license, that generally means you have
Your options:
**Ask the maintainers nicely to add a license.** Unless the software includes strong indications to the contrary, lack of a license is probably an oversight. If the software is hosted on a site like GitHub, open an issue requesting a license and include a link to this site, or if you're bold and it's fairly obvious what license is most appropriate, open a pull request to add a license.
**Ask the maintainers nicely to add a license.** Unless the software includes strong indications to the contrary, lack of a license is probably an oversight. If the software is hosted on a site like GitHub, open an issue requesting a license and include a link to this site. If you're bold and it's fairly obvious what license is most appropriate, open a pull request to add a license see "suggest this license" in the sidebar of the page for each license on this site (e.g., [MIT](/licenses/mit/#suggest-this-license)).
**Don't use the software.** Find or create an alternative that is under an open source license.

View File

@ -3,7 +3,7 @@
set -e
echo "bundling installin'"
gem install bundler --version 1.16.2
gem install bundler
bundle install
echo

View File

@ -11,9 +11,7 @@ require 'colored'
require 'fuzzy_match'
# Display usage instructions
if ARGV.count != 1
puts File.open(__FILE__).read.scan(/^# .*/)[0...3].join("\n").gsub(/^# /, '')
end
puts File.open(__FILE__).read.scan(/^# .*/)[0...3].join("\n").gsub(/^# /, '') if ARGV.count != 1
class TrueClass
def to_s

View File

@ -106,6 +106,7 @@ def fsf_approved_licenses
licenses = {}
object['licenses'].each_value do |meta|
next unless (meta.include? 'identifiers') && (meta['identifiers'].include? 'spdx') && (meta.include? 'tags') && (meta['tags'].include? 'libre')
meta['identifiers']['spdx'].each do |identifier|
licenses[identifier.downcase] = meta['name']
end