Skip to content

Commit

Permalink
Use SPDX license identifiers for license in shard.yml (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoheitmannruiz authored Dec 18, 2024
1 parent c75da04 commit 34f1c21
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
10 changes: 8 additions & 2 deletions docs/shard.yml.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,14 @@ libraries:
----

*license*::
An http://opensource.org/[OSI license] name or an URL to a license file
(string, recommended).
An https://spdx.github.io/spdx-spec/v3.0.1/annexes/spdx-license-expressions/[SPDX license expression]
or an URL to a license file (string, recommended).
+
The OSI publishes https://opensource.org/licenses-old/category[a list] of open
source licenses and their corresponding SPDX identifiers.
+
Examples: _Apache-2.0_, _GPL-3.0-or-later_, _Apache-2.0 OR MIT_,
_Apache-2.0 WITH Swift-exception_, _https://example.com/LICENSE_.

*repository*::
The URL of the project's canonical repository (string, recommended).
Expand Down
2 changes: 1 addition & 1 deletion docs/shard.yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"license": {
"type": "string",
"title": "license",
"description": "An OSI license name or an URL to a license file"
"description": "An SPDX license expression or an URL to a license file."
},
"repository": {
"type": "string",
Expand Down
22 changes: 15 additions & 7 deletions man/shard.yml.5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/shards.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/unit/spec_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Shards
it "parse license" do
spec = Spec.from_yaml("name: shards\nversion: 0.1.0\nlicense: BSD-2-Clause")
spec.license.should eq("BSD-2-Clause")
spec.license_url.should eq("http://opensource.org/licenses/BSD-2-Clause")
spec.license_url.should eq("https://spdx.org/licenses/BSD-2-Clause")

spec = Spec.from_yaml("name: shards\nversion: 0.1.0\nlicense: http://example.com/LICENSE")
spec.license.should eq("http://example.com/LICENSE")
Expand Down
2 changes: 1 addition & 1 deletion src/spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ module Shards
if license =~ %r(https?://)
license
else
"http://opensource.org/licenses/#{license}"
"https://spdx.org/licenses/#{license}"
end
end
end
Expand Down

0 comments on commit 34f1c21

Please sign in to comment.