jekyll-spdx_licenses 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/Gemfile +6 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jekyll-spdx_licenses.gemspec +43 -0
- data/lib/jekyll/spdx_licenses.rb +8 -0
- data/lib/jekyll/spdx_licenses/spdx_link_tag.rb +18 -0
- data/lib/jekyll/spdx_licenses/spdx_name_tag.rb +18 -0
- data/lib/jekyll/spdx_licenses/version.rb +5 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 407a1f772dd9175916ef4e22c0b39ebb03ae8a4ad5184d976f995a9db8335c8a
|
4
|
+
data.tar.gz: ca6e22730bb57c305e9e923aaefa2358226af6c17aedde31c083cc1de033af1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '08162ca53d30ab6729f137b4769f56dcd6cce87b5087b8ebfaab720ace3938aec0cc31d6bd2f6a124da883f1b6c028c754fdc2ca29feba41bf1ad7c1561c6727'
|
7
|
+
data.tar.gz: 3421c00ff3d16d17b5d93e78001dcdce83761abd04735686e371d56e44453b9b9c7ef4d0e03cc8e23723ee46a464b9c6113a89f842e5e6e9f3a8b0a2c9bb3cfe
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Jekyll::SpdxLicenses
|
2
|
+
|
3
|
+
Liquid Tag to be used with Jekyll, which allows you to reference [SPDX](https://spdx.org/) licenses within your posts/projects.
|
4
|
+
|
5
|
+
To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'jekyll-spdx_licenses'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install jekyll-spdx_licenses
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
To convert a SPDX license ID to its full name:
|
26
|
+
|
27
|
+
```
|
28
|
+
{% spdx_name Apache-2.0 %}
|
29
|
+
=> Apache License 2.0
|
30
|
+
```
|
31
|
+
|
32
|
+
To convert the SPDX license ID to a link:
|
33
|
+
|
34
|
+
```
|
35
|
+
{% spdx_link Apache-2.0 %}
|
36
|
+
=> <a href="https://spdx.org/licenses/Apache-2.0">Apache License 2.0</a>
|
37
|
+
```
|
38
|
+
|
39
|
+
## Development
|
40
|
+
|
41
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
42
|
+
|
43
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://gitlab.com/jamietanna/jekyll-spdx_licenses
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jekyll/spdx_licenses"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "jekyll/spdx_licenses/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-spdx_licenses"
|
8
|
+
spec.version = Jekyll::SpdxLicenses::VERSION
|
9
|
+
spec.authors = ["Jamie Tanna"]
|
10
|
+
spec.email = ["rubygems@jamietanna.co.uk"]
|
11
|
+
|
12
|
+
spec.summary = 'Liquid Tag to be used with Jekyll, which allows you to reference SPDX licenses within your posts/projects.'
|
13
|
+
spec.description = 'Liquid Tag to be used with Jekyll, which allows you to reference SPDX licenses within your posts/projects.'
|
14
|
+
spec.homepage = 'https://gitlab.com/jamietanna/jekyll-spdx_licenses'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org/'
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = 'https://gitlab.com/jamietanna/jekyll-spdx_licenses'
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
+
"public gem pushes."
|
26
|
+
end
|
27
|
+
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
|
+
end
|
33
|
+
spec.bindir = "exe"
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
|
+
spec.require_paths = ["lib"]
|
36
|
+
|
37
|
+
spec.add_dependency 'jekyll', '~> 3.8'
|
38
|
+
spec.add_dependency 'spdx-licenses', '~> 1.2'
|
39
|
+
|
40
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'liquid'
|
2
|
+
require 'spdx-licenses'
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
module SpdxLicenses
|
6
|
+
class SpdxLinkTag < Liquid::Tag
|
7
|
+
def initialize(tag_name, license_id, tokens)
|
8
|
+
super
|
9
|
+
raise 'License ID not valid according to SPDX licenses' unless ::SpdxLicenses.exist?(license_id)
|
10
|
+
@license = ::SpdxLicenses.lookup(license_id)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render(content)
|
14
|
+
"<a href=\"https://spdx.org/licenses/#{@license.id}.html\">#{@license.name}</a>"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'liquid'
|
2
|
+
require 'spdx-licenses'
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
module SpdxLicenses
|
6
|
+
class SpdxNameTag < Liquid::Tag
|
7
|
+
def initialize(tag_name, license_id, tokens)
|
8
|
+
super
|
9
|
+
raise 'License ID not valid according to SPDX licenses' unless ::SpdxLicenses.exist?(license_id)
|
10
|
+
@license = ::SpdxLicenses.lookup(license_id)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render(content)
|
14
|
+
@license.name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-spdx_licenses
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jamie Tanna
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: spdx-licenses
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: Liquid Tag to be used with Jekyll, which allows you to reference SPDX
|
84
|
+
licenses within your posts/projects.
|
85
|
+
email:
|
86
|
+
- rubygems@jamietanna.co.uk
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- Gemfile
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
97
|
+
- bin/setup
|
98
|
+
- jekyll-spdx_licenses.gemspec
|
99
|
+
- lib/jekyll/spdx_licenses.rb
|
100
|
+
- lib/jekyll/spdx_licenses/spdx_link_tag.rb
|
101
|
+
- lib/jekyll/spdx_licenses/spdx_name_tag.rb
|
102
|
+
- lib/jekyll/spdx_licenses/version.rb
|
103
|
+
homepage: https://gitlab.com/jamietanna/jekyll-spdx_licenses
|
104
|
+
licenses: []
|
105
|
+
metadata:
|
106
|
+
allowed_push_host: https://rubygems.org/
|
107
|
+
homepage_uri: https://gitlab.com/jamietanna/jekyll-spdx_licenses
|
108
|
+
source_code_uri: https://gitlab.com/jamietanna/jekyll-spdx_licenses
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.7.7
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Liquid Tag to be used with Jekyll, which allows you to reference SPDX licenses
|
129
|
+
within your posts/projects.
|
130
|
+
test_files: []
|