jekyll-last-modified 1.0.3 → 1.0.5
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 +4 -4
- data/jekyll-last-modified.gemspec +2 -2
- data/lib/jekyll/last_modified.rb +12 -8
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 143348a5570bace6dd2dbeac85f664cfc0598aeb3bf92ee6a529dbaf41a95d17
|
|
4
|
+
data.tar.gz: 63b642021d85d6d2a354305d00aa7df5bb4b68768f17ddc8ed847d26fe3423ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66f9afaa75fe06d94d7c193847cdb74cb52ec98c2394916115aa10f594e10d5140a4dcc9a680ad3d11281b0e77da1d4ff405d6a9e7957caa2c7edb693f60ea14
|
|
7
|
+
data.tar.gz: 890fe98ed9457563c38a6147f77115d8b66ef1b7b704234543d78c02af8f8a0ba2e2e691f2e115141e686f479f46d166143396115b0ebfdd83c6e06a28aec988
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "jekyll-last-modified"
|
|
7
|
-
spec.version = '1.0.
|
|
7
|
+
spec.version = '1.0.5'
|
|
8
8
|
spec.authors = ["iBug"]
|
|
9
9
|
spec.email = ["i@ibugone.com"]
|
|
10
10
|
spec.summary = %q{Set page date from Git database}
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
|
|
20
20
|
spec.add_dependency "jekyll", '>= 3.5'
|
|
21
21
|
|
|
22
|
-
spec.add_development_dependency "bundler", "
|
|
22
|
+
spec.add_development_dependency "bundler", ">= 1.6"
|
|
23
23
|
spec.add_development_dependency "shoulda"
|
|
24
24
|
spec.add_development_dependency "mocha"
|
|
25
25
|
end
|
data/lib/jekyll/last_modified.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Jekyll
|
|
|
23
23
|
end
|
|
24
24
|
page.data['git'] = data['pages_data'][path]
|
|
25
25
|
unless page.data['git'].nil?
|
|
26
|
-
page.data['last_modified_at']
|
|
26
|
+
page.data['last_modified_at'] ||= page.data['git']['last_commit']['commit_date']
|
|
27
27
|
if page.data['date'] == site.time
|
|
28
28
|
page.data['date'] = page.data['git']['first_commit']['commit_date']
|
|
29
29
|
end
|
|
@@ -33,7 +33,7 @@ module Jekyll
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def load_git_metadata(site)
|
|
36
|
-
current_sha = %x{ git rev-parse HEAD }.strip
|
|
36
|
+
current_sha = normalize_git_output(%x{ git rev-parse HEAD }).strip
|
|
37
37
|
|
|
38
38
|
cache_dir = File.join site.source, '.git-metadata'
|
|
39
39
|
FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
|
|
@@ -87,7 +87,7 @@ module Jekyll
|
|
|
87
87
|
results = []
|
|
88
88
|
cmd = 'git shortlog -se HEAD'
|
|
89
89
|
cmd << " -- #{file}" if file
|
|
90
|
-
result = %x{ #{cmd} }
|
|
90
|
+
result = normalize_git_output(%x{ #{cmd} })
|
|
91
91
|
result.lines.each do |line|
|
|
92
92
|
commits, name, email = line.scan(/(.*)\t(.*)<(.*)>/).first.map(&:strip)
|
|
93
93
|
results << { 'commits' => commits.to_i, 'name' => name, 'email' => email }
|
|
@@ -98,7 +98,7 @@ module Jekyll
|
|
|
98
98
|
def lines(file = nil)
|
|
99
99
|
cmd = "git log --numstat --format=%h"
|
|
100
100
|
cmd << " -- #{file}" if file
|
|
101
|
-
result = %x{ #{cmd} }
|
|
101
|
+
result = normalize_git_output(%x{ #{cmd} })
|
|
102
102
|
results = result.scan(/(.*)\n\n((?:.*\t.*\t.*\n)*)/)
|
|
103
103
|
results.map do |line|
|
|
104
104
|
files = line[1].scan(/(.*)\t(.*)\t(.*)\n/)
|
|
@@ -111,7 +111,7 @@ module Jekyll
|
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
def commit(sha)
|
|
114
|
-
result = %x{ git show --format=fuller --name-only #{sha} }
|
|
114
|
+
result = normalize_git_output(%x{ git show --format=fuller --name-only #{sha} })
|
|
115
115
|
long_sha, author_name, author_email, author_date, commit_name, commit_email, commit_date, message, changed_files = result.scan(/commit (.*)\nAuthor:(.*)<(.*)>\nAuthorDate:(.*)\nCommit:(.*)<(.*)>\nCommitDate:(.*)\n\n((?:^\s{4}[^\r\n]*\n)*)\n(.*)/m).first.map(&:strip)
|
|
116
116
|
message.gsub! /^\s{4}/, ''
|
|
117
117
|
{
|
|
@@ -131,15 +131,15 @@ module Jekyll
|
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def tracked_files
|
|
134
|
-
@tracked_files ||= %x{ git ls-tree --full-tree -r --name-only HEAD }.split("\n")
|
|
134
|
+
@tracked_files ||= normalize_git_output(%x{ git ls-tree --full-tree -r --name-only HEAD }).split("\n")
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def project_name
|
|
138
|
-
File.basename(%x{ git rev-parse --show-toplevel }.strip)
|
|
138
|
+
File.basename(normalize_git_output(%x{ git rev-parse --show-toplevel }).strip)
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
def files_count
|
|
142
|
-
%x{ git ls-tree -r HEAD }.lines.count
|
|
142
|
+
normalize_git_output(%x{ git ls-tree -r HEAD }).lines.count
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
def git_installed?
|
|
@@ -149,6 +149,10 @@ module Jekyll
|
|
|
149
149
|
|
|
150
150
|
private
|
|
151
151
|
|
|
152
|
+
def normalize_git_output(output)
|
|
153
|
+
output.force_encoding(Encoding::UTF_8).scrub
|
|
154
|
+
end
|
|
155
|
+
|
|
152
156
|
def jekyll_items(site)
|
|
153
157
|
site.pages + site.collections.values.map(&:docs).flatten
|
|
154
158
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-last-modified
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- iBug
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: jekyll
|
|
@@ -28,14 +27,14 @@ dependencies:
|
|
|
28
27
|
name: bundler
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
32
|
version: '1.6'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - "
|
|
37
|
+
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '1.6'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
@@ -85,7 +84,6 @@ homepage: https://github.com/iBug/jekyll-last-modified
|
|
|
85
84
|
licenses:
|
|
86
85
|
- MIT
|
|
87
86
|
metadata: {}
|
|
88
|
-
post_install_message:
|
|
89
87
|
rdoc_options: []
|
|
90
88
|
require_paths:
|
|
91
89
|
- lib
|
|
@@ -100,8 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
100
98
|
- !ruby/object:Gem::Version
|
|
101
99
|
version: '0'
|
|
102
100
|
requirements: []
|
|
103
|
-
rubygems_version: 3.
|
|
104
|
-
signing_key:
|
|
101
|
+
rubygems_version: 3.6.7
|
|
105
102
|
specification_version: 4
|
|
106
103
|
summary: Set page date from Git database
|
|
107
104
|
test_files: []
|