jekyll-git-hash 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.0pdd.yml +9 -0
- data/.github/workflows/rake.yml +24 -0
- data/.gitignore +4 -0
- data/.pdd +7 -0
- data/.rubocop.yml +23 -0
- data/.rultor.yml +20 -0
- data/Gemfile +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +62 -0
- data/jekyll-git-hash.gemspec +44 -0
- data/lib/jekyll-git-hash.rb +47 -0
- data/renovate.json +10 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0853535b5875d9f98666e3bf9a245318f8654c56f32f5519fc4199ff7dc97bcd'
|
4
|
+
data.tar.gz: 94f23b7d966ef780a41396acb25744c918fe0eadd0747b955b1d42b1c58ddc57
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61ec5946a9cb7c7b6765f8d4be58be3dc8539d9cdd1e45707ae88b3140e81c0d28d6c1440167dcdbffabbe9f5fdffdad8267c4f479411c7c8bddcf80898b81fb
|
7
|
+
data.tar.gz: 64f15f3d2b727e16f5605d3c1baf68d0cc3fd1b52487e51bc81f2406a127a08f384ca315c2078c10f7b28708983f2f630246f57796363a3a6877cc91dcaf602b
|
data/.0pdd.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: rake
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
name: test
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
os: [ubuntu-20.04, macos-12, windows-2022]
|
16
|
+
ruby: [2.7, 3.1]
|
17
|
+
runs-on: ${{ matrix.os }}
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v3
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- run: bundle update
|
24
|
+
- run: bundle exec rake
|
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'bin/**/*'
|
4
|
+
- 'assets/**/*'
|
5
|
+
DisplayCopNames: true
|
6
|
+
TargetRubyVersion: '2.6'
|
7
|
+
NewCops: enable
|
8
|
+
SuggestExtensions: false
|
9
|
+
|
10
|
+
Lint/RescueException:
|
11
|
+
Enabled: false
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Max: 50
|
14
|
+
Metrics/ClassLength:
|
15
|
+
Max: 150
|
16
|
+
Metrics/AbcSize:
|
17
|
+
Max: 60
|
18
|
+
Metrics/BlockLength:
|
19
|
+
Max: 50
|
20
|
+
Layout/MultilineMethodCallIndentation:
|
21
|
+
Enabled: false
|
22
|
+
Naming/FileName:
|
23
|
+
Enabled: false
|
data/.rultor.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
docker:
|
2
|
+
image: yegor256/rultor-image:1.21.0
|
3
|
+
assets:
|
4
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
|
+
install: |
|
6
|
+
pdd -f /dev/null
|
7
|
+
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
8
|
+
release:
|
9
|
+
script: |-
|
10
|
+
bundle exec rake
|
11
|
+
rm -rf *.gem
|
12
|
+
sed -i "s/0\.0\.0/${tag}/g" jekyll-git-hash.gemspec
|
13
|
+
git add jekyll-git-hash.gemspec
|
14
|
+
git commit -m "version set to ${tag}"
|
15
|
+
gem build jekyll-git-hash.gemspec
|
16
|
+
chmod 0600 ../rubygems.yml
|
17
|
+
gem push *.gem --config-file ../rubygems.yml
|
18
|
+
merge:
|
19
|
+
script: |-
|
20
|
+
bundle exec rake
|
data/Gemfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2014-2023 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
source 'https://rubygems.org'
|
26
|
+
gemspec
|
27
|
+
|
28
|
+
gem 'rake', '13.0.6', require: false
|
29
|
+
gem 'rubocop', '1.51.0', require: false
|
30
|
+
gem 'rubocop-rspec', '2.22.0', require: false
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2014-2023 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
[](https://github.com/yegor256/jekyll-git-hash/actions/workflows/rake.yml)
|
2
|
+
[](http://badge.fury.io/rb/jekyll-git-hash)
|
3
|
+
|
4
|
+
Install it first:
|
5
|
+
|
6
|
+
```
|
7
|
+
gem install jekyll-git-hash
|
8
|
+
```
|
9
|
+
|
10
|
+
With Jekyll 2, simply add the gem to your `_config.yml` gems list:
|
11
|
+
|
12
|
+
```yaml
|
13
|
+
gems: ['jekyll-git-hash', ... your other plugins]
|
14
|
+
```
|
15
|
+
|
16
|
+
Or for previous versions,
|
17
|
+
create a plugin file within your Jekyll project's `_plugins` directory:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# _plugins/jekyll-git-hash.rb
|
21
|
+
require 'jekyll-git-hash'
|
22
|
+
```
|
23
|
+
|
24
|
+
Highly recommend to use Bundler. If you're using it, add this line
|
25
|
+
to your `Gemfile`:
|
26
|
+
|
27
|
+
```
|
28
|
+
gem "jekyll-git-hash"
|
29
|
+
```
|
30
|
+
|
31
|
+
The plugin is compatible with
|
32
|
+
[Jekyll 3.9.3](https://jekyllrb.com/news/2023/01/29/jekyll-3-9-3-released/) and
|
33
|
+
[Jekyll 4.3.2](https://jekyllrb.com/news/2023/01/20/jekyll-4-3-2-released/).
|
34
|
+
|
35
|
+
Use `{{ site.data['hash']}}` inside your liquid template.
|
36
|
+
|
37
|
+
When the site is being generated by Jekyll, the
|
38
|
+
plugin retrieves Git hash of the source code and
|
39
|
+
exposes it as a item in `site.data`. This feature
|
40
|
+
is very helpful when you want your static resources (CSS, JS, etc.)
|
41
|
+
be reloaded by end users every time you deploy a new
|
42
|
+
version of the site.
|
43
|
+
|
44
|
+
For example, in your `default.html`:
|
45
|
+
|
46
|
+
```html
|
47
|
+
<link rel="stylesheet" href="/css/layout.css?{{ site.data['hash'] }}"/>
|
48
|
+
```
|
49
|
+
|
50
|
+
The URL will be generated with a suffix at the end. This
|
51
|
+
suffix doesn't change the URL (`layout.css` will still
|
52
|
+
be accesible by the browser), but it makes the URL unique
|
53
|
+
for the browser when you deploy a new Git revision. All browsers
|
54
|
+
will reload this CSS.
|
data/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2014-2023 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'rake'
|
27
|
+
require 'rdoc'
|
28
|
+
require 'rake/clean'
|
29
|
+
|
30
|
+
def name
|
31
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
32
|
+
end
|
33
|
+
|
34
|
+
def version
|
35
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
36
|
+
end
|
37
|
+
|
38
|
+
task default: %i[clean rubocop copyright]
|
39
|
+
|
40
|
+
require 'rdoc/task'
|
41
|
+
desc 'Build RDoc documentation'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
|
+
rdoc.title = "#{name} #{version}"
|
45
|
+
rdoc.rdoc_files.include('README*')
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
+
end
|
48
|
+
|
49
|
+
require 'rubocop/rake_task'
|
50
|
+
desc 'Run RuboCop on all directories'
|
51
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
52
|
+
task.fail_on_error = true
|
53
|
+
task.requires << 'rubocop-rspec'
|
54
|
+
end
|
55
|
+
|
56
|
+
task :copyright do
|
57
|
+
sh "grep -q -r '2014-#{Date.today.strftime('%Y')}' \
|
58
|
+
--include '*.rb' \
|
59
|
+
--include '*.txt' \
|
60
|
+
--include 'Rakefile' \
|
61
|
+
."
|
62
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2014-2023 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'English'
|
26
|
+
|
27
|
+
Gem::Specification.new do |s|
|
28
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
29
|
+
s.required_ruby_version = '>= 2.6'
|
30
|
+
s.name = 'jekyll-git-hash'
|
31
|
+
s.version = '0.1.0'
|
32
|
+
s.license = 'MIT'
|
33
|
+
s.summary = 'Jekyll Git Hash'
|
34
|
+
s.description = 'Adds Git hash to the properties of the Jekyll site'
|
35
|
+
s.authors = ['Yegor Bugayenko']
|
36
|
+
s.email = 'yegor256@gmail.com'
|
37
|
+
s.homepage = 'https://github.com/yegor256/jekyll-git-hash'
|
38
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
39
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
40
|
+
s.rdoc_options = ['--charset=UTF-8']
|
41
|
+
s.extra_rdoc_files = %w[README.md LICENSE.txt]
|
42
|
+
s.add_runtime_dependency 'jekyll', '>=3.9.2'
|
43
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
44
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2014-2023 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
# Jekyll plugin for generating Git hash
|
26
|
+
#
|
27
|
+
# Place this file in the _plugins directory and
|
28
|
+
# use {{ site.data['hash'] }} in your Liquid templates
|
29
|
+
#
|
30
|
+
# Author: Yegor Bugayenko <yegor@tpc2.com>
|
31
|
+
# Source: http://github.com/yegor256/jekyll-git-hash
|
32
|
+
#
|
33
|
+
# Distributed under the MIT license
|
34
|
+
# Copyright Yegor Bugayenko, 2014
|
35
|
+
|
36
|
+
# Main Jekyll module
|
37
|
+
module Jekyll
|
38
|
+
# Our class generator
|
39
|
+
class GitHashGenerator < Generator
|
40
|
+
priority :high
|
41
|
+
safe true
|
42
|
+
def generate(site)
|
43
|
+
hash = `git rev-parse --short HEAD`.strip
|
44
|
+
site.data['hash'] = hash
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/renovate.json
ADDED
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-git-hash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-07-08 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.9.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.9.2
|
27
|
+
description: Adds Git hash to the properties of the Jekyll site
|
28
|
+
email: yegor256@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.md
|
33
|
+
- LICENSE.txt
|
34
|
+
files:
|
35
|
+
- ".0pdd.yml"
|
36
|
+
- ".github/workflows/rake.yml"
|
37
|
+
- ".gitignore"
|
38
|
+
- ".pdd"
|
39
|
+
- ".rubocop.yml"
|
40
|
+
- ".rultor.yml"
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- jekyll-git-hash.gemspec
|
46
|
+
- lib/jekyll-git-hash.rb
|
47
|
+
- renovate.json
|
48
|
+
homepage: https://github.com/yegor256/jekyll-git-hash
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata:
|
52
|
+
rubygems_mfa_required: 'true'
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- "--charset=UTF-8"
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.6'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubygems_version: 3.2.15
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Jekyll Git Hash
|
73
|
+
test_files: []
|