jekyll-last-modified 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jekyll-last-modified.gemspec +1 -1
- data/lib/jekyll/last_modified.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6656f3fb74ca2638d23f2815447eade593d2123dd060849db15ba5e37dc33c24
|
4
|
+
data.tar.gz: cf8c18f25a2573221dd698f5bdeaee733231f3760cd53b356f4bad06752f4b0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a980523ff16e0486bbe058cf66da46318863828316522c724f7dc858ba2a0ebe4811f07cec84ea16f780087d376a21805f6081971d2012dce8a49eefeb5b64af
|
7
|
+
data.tar.gz: 7354f360916f16802ed6d378f996eac0703d327fb68b9821e3d1f4f04873d38efad27688147231131c2f36af2490cb4cf60b70c304a5deba8b9d69f89ebe2718
|
@@ -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.2'
|
8
8
|
spec.authors = ["iBug"]
|
9
9
|
spec.email = ["i@ibugone.com"]
|
10
10
|
spec.summary = %q{Set page date from Git database}
|
data/lib/jekyll/last_modified.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rbconfig'
|
|
3
3
|
module Jekyll
|
4
4
|
module LastModified
|
5
5
|
class Generator < Jekyll::Generator
|
6
|
-
VERSION = '1.0.
|
6
|
+
VERSION = '1.0.2'
|
7
7
|
|
8
8
|
safe true
|
9
9
|
|
@@ -11,7 +11,7 @@ module Jekyll
|
|
11
11
|
raise "Git is not installed" unless git_installed?
|
12
12
|
|
13
13
|
Dir.chdir(site.source) do
|
14
|
-
base_path = site.config['collections_dir']
|
14
|
+
base_path = site.config['collections_dir'] || ''
|
15
15
|
data = load_git_metadata(site)
|
16
16
|
site.config['git'] = data['site_data']
|
17
17
|
jekyll_items(site).each do |page|
|
@@ -19,7 +19,7 @@ module Jekyll
|
|
19
19
|
path = page.path
|
20
20
|
else
|
21
21
|
path = page.relative_path
|
22
|
-
path = File.join base_path, path
|
22
|
+
path = File.join base_path, path unless base_path.empty?
|
23
23
|
end
|
24
24
|
page.data['git'] = data['pages_data'][path]
|
25
25
|
unless page.data['git'].nil?
|
@@ -35,22 +35,22 @@ module Jekyll
|
|
35
35
|
def load_git_metadata(site)
|
36
36
|
current_sha = %x{ git rev-parse HEAD }.strip
|
37
37
|
|
38
|
-
cache_dir = site.source
|
38
|
+
cache_dir = File.join site.source, '.git-metadata'
|
39
39
|
FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
|
40
|
-
cache_file = cache_dir
|
40
|
+
cache_file = File.join cache_dir, "#{current_sha}.json"
|
41
41
|
|
42
42
|
if File.exist?(cache_file)
|
43
43
|
return JSON.parse(IO.read(cache_file))
|
44
44
|
end
|
45
45
|
|
46
|
-
base_path = site.config['collections_dir']
|
46
|
+
base_path = site.config['collections_dir'] || ''
|
47
47
|
pages_data = {}
|
48
48
|
jekyll_items(site).each do |page|
|
49
49
|
if page.is_a?(Jekyll::Page)
|
50
50
|
path = page.path
|
51
51
|
else
|
52
52
|
path = page.relative_path
|
53
|
-
path = File.join base_path, path
|
53
|
+
path = File.join base_path, path unless base_path.empty?
|
54
54
|
end
|
55
55
|
pages_data[path] = page_data(path)
|
56
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iBug
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|