jekyll-git-updated 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jekyll-git-updated.rb +23 -0
  3. metadata +68 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8323842d2f46a8f20100fb2bed6f1071aa5e465e67a05870b959ebb72aa7bead
4
+ data.tar.gz: 1a82b34af94b7da647a43ce09052d398cd874bd0acbeebfa3d3a0fa711977519
5
+ SHA512:
6
+ metadata.gz: 0c710ce060b6b3f8b172d9be6143b945f8f63fac22661877d28f39bd38eb48f728d5c860e69f0de22319886e7933c25ad693e6118898883896cf032f6bb37da2
7
+ data.tar.gz: b2b5df2e3dd0ebabc1eff47e7c867bea6814596f13db9abe180359dc50731dca0aed60338aa027d88512d03630936766643be5ed13e25fb2c119c927a883f845
@@ -0,0 +1,23 @@
1
+ require "fileutils"
2
+ require "find"
3
+
4
+ class JekyllPlugin
5
+ def initialize(post, hash)
6
+ @post = post
7
+ @hash = hash
8
+
9
+ @path = post.path
10
+ end
11
+
12
+ def setGitUpdated()
13
+ if @post.data['title'] and File.file?(@path)
14
+ @post.data['git-updated'] = `git log -n 1 --pretty=format:%ci "#{@path}"`[0...-6]
15
+ end
16
+ end
17
+
18
+ module Jekyll
19
+ Hooks.register [:documents, :pages], :pre_render do |post, hash|
20
+ plugin = JekyllPlugin.new(post, hash)
21
+ plugin.setGitUpdated()
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-git-updated
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Angus Johnston
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-10-30 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.7'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.7'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ description:
34
+ email:
35
+ - admin+rubygems@codeanimu.net
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - lib/jekyll-git-updated.rb
41
+ homepage: https://github.com/DakuTree/jekyll-git-updated
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://github.com/DakuTree/jekyll-git-updated
46
+ source_code_uri: https://github.com/DakuTree/jekyll-git-updated
47
+ changelog_uri: https://github.com/DakuTree/jekyll-git-updated/blob/master/CHANGELOG.md
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.0.3
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: This automatically adds a git commit timestamp of the post/page to the `git-updated`
67
+ frontmatter key.
68
+ test_files: []