jekyll-last-modified-at 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e6831aedf55b3c70becc35b679f774c69b6057482c7cb56da41f907f1f0dffa
4
- data.tar.gz: b8d86118dc3c07cd7b6f72464daccfb389f78e2269de86f83d9edee318998c27
3
+ metadata.gz: efc8ef3c72d1cb8f8c8eb2bc630002d8180cdf3705cd9ebe2bb96712ea57a893
4
+ data.tar.gz: b65fee77d1cbb5a87862c3aa858ec50a723f55611548c207eef5cf0a8d2b9acf
5
5
  SHA512:
6
- metadata.gz: c7782f9a82e4ec0c54e89e3a3f234b5f2a8f6d7cd93455c7db53e20e3e4a77eff380cb0f9bd544f6e791e3b00c351530e3625b0640db2856112be740b885272c
7
- data.tar.gz: ee62f0c449b3393cf5a4b32c8c4926140faea4e41880e88c5fef9f9904aac5b2e50c231752fb0608de2214a023fbff148715920b844d47e3252997f57efd783f
6
+ metadata.gz: f052707a11ed1f27287af0e12794d5f4f24b35072540ee228468f9f614efc72a16d3fa566564b2e18f739bb3d4ed2b8cb830f2e92225dfcd45a8f40734c6ffdc
7
+ data.tar.gz: a40107e15328175a544e4f7a42a58dae88f799a9a100697965d8d2ac5fa23cee49940804bb89c2f5c25f5de3911f2af7f42b99f9f689478e356619fc50bda327
@@ -9,7 +9,7 @@ module Jekyll
9
9
  def initialize(site_source, page_path, format = nil)
10
10
  @site_source = site_source
11
11
  @page_path = page_path
12
- @format = format || '%d-%b-%y'
12
+ @format = format || "%d-%b-%y"
13
13
  end
14
14
 
15
15
  def git
@@ -28,7 +28,7 @@ module Jekyll
28
28
  end
29
29
 
30
30
  def last_modified_at_time
31
- raise Errno::ENOENT, "#{absolute_path_to_article} does not exist!" unless File.exist? absolute_path_to_article
31
+ raise Errno::ENOENT, "#{absolute_path_to_article} does not exist!" unless File.exist?(absolute_path_to_article)
32
32
 
33
33
  Time.at(last_modified_at_unix.to_i)
34
34
  end
@@ -36,15 +36,15 @@ module Jekyll
36
36
  def last_modified_at_unix
37
37
  if git.git_repo?
38
38
  last_commit_date = Executor.sh(
39
- 'git',
40
- '--git-dir',
39
+ "git",
40
+ "--git-dir",
41
41
  git.top_level_directory,
42
- 'log',
43
- '-n',
44
- '1',
42
+ "log",
43
+ "-n",
44
+ "1",
45
45
  '--format="%ct"',
46
- '--',
47
- relative_path_from_git_dir
46
+ "--",
47
+ relative_path_from_git_dir,
48
48
  )[/\d+/]
49
49
  # last_commit_date can be nil iff the file was not committed.
50
50
  last_commit_date.nil? || last_commit_date.empty? ? mtime(absolute_path_to_article) : last_commit_date
@@ -68,12 +68,12 @@ module Jekyll
68
68
  end
69
69
 
70
70
  def relative_path_from_git_dir
71
- return nil unless git.git_repo?
71
+ return unless git.git_repo?
72
72
 
73
73
  @relative_path_from_git_dir ||= Pathname.new(absolute_path_to_article)
74
- .relative_path_from(
75
- Pathname.new(File.dirname(git.top_level_directory))
76
- ).to_s
74
+ .relative_path_from(
75
+ Pathname.new(File.dirname(git.top_level_directory)),
76
+ ).to_s
77
77
  end
78
78
 
79
79
  def mtime(file)
@@ -1,34 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'posix/spawn'
3
+ require "open3"
4
4
 
5
5
  module Jekyll
6
6
  module LastModifiedAt
7
7
  module Executor
8
- extend POSIX::Spawn
9
-
10
- def self.sh(*args)
11
- r, w = IO.pipe
12
- e, eo = IO.pipe
13
- pid = spawn(*args,
14
- :out => w, r => :close,
15
- :err => eo, e => :close)
16
-
17
- if pid.positive?
18
- w.close
19
- eo.close
20
- out = r.read
21
- err = e.read
22
- ::Process.waitpid(pid)
23
- "#{out} #{err}".strip if out
24
- end
25
- ensure
26
- [r, w, e, eo].each do |io|
27
- begin
28
- io.close
29
- rescue StandardError
30
- nil
31
- end
8
+ class << self
9
+ def sh(*args)
10
+ stdout_str, stderr_str, status = Open3.capture3(*args)
11
+ "#{stdout_str} #{stderr_str}".strip if status.success?
32
12
  end
33
13
  end
34
14
  end
@@ -11,14 +11,14 @@ module Jekyll
11
11
  end
12
12
 
13
13
  def top_level_directory
14
- return nil unless git_repo?
14
+ return unless git_repo?
15
15
 
16
16
  @top_level_directory ||= begin
17
17
  Dir.chdir(@site_source) do
18
- @top_level_directory = File.join(Executor.sh('git', 'rev-parse', '--show-toplevel'), '.git')
18
+ @top_level_directory = File.join(Executor.sh("git", "rev-parse", "--show-toplevel"), ".git")
19
19
  end
20
- rescue StandardError
21
- ''
20
+ rescue StandardError
21
+ ""
22
22
  end
23
23
  end
24
24
 
@@ -27,10 +27,10 @@ module Jekyll
27
27
 
28
28
  @is_git_repo = begin
29
29
  Dir.chdir(@site_source) do
30
- Executor.sh('git', 'rev-parse', '--is-inside-work-tree').eql? 'true'
30
+ Executor.sh("git", "rev-parse", "--is-inside-work-tree").eql?("true")
31
31
  end
32
- rescue StandardError
33
- false
32
+ rescue StandardError
33
+ false
34
34
  end
35
35
  end
36
36
  end
@@ -3,17 +3,22 @@
3
3
  module Jekyll
4
4
  module LastModifiedAt
5
5
  module Hook
6
- def self.add_determinator_proc
7
- proc { |item|
8
- format = item.site.config.dig('last-modified-at', 'date-format')
9
- item.data['last_modified_at'] = Determinator.new(item.site.source, item.path,
10
- format)
11
- }
6
+ class << self
7
+ def add_determinator_proc
8
+ proc { |item|
9
+ format = item.site.config.dig("last-modified-at", "date-format")
10
+ item.data["last_modified_at"] = Determinator.new(
11
+ item.site.source,
12
+ item.path,
13
+ format,
14
+ )
15
+ }
16
+ end
12
17
  end
13
18
 
14
- Jekyll::Hooks.register :posts, :post_init, &Hook.add_determinator_proc
15
- Jekyll::Hooks.register :pages, :post_init, &Hook.add_determinator_proc
16
- Jekyll::Hooks.register :documents, :post_init, &Hook.add_determinator_proc
19
+ Jekyll::Hooks.register(:posts, :post_init, &Hook.add_determinator_proc)
20
+ Jekyll::Hooks.register(:pages, :post_init, &Hook.add_determinator_proc)
21
+ Jekyll::Hooks.register(:documents, :post_init, &Hook.add_determinator_proc)
17
22
  end
18
23
  end
19
24
  end
@@ -10,13 +10,13 @@ module Jekyll
10
10
 
11
11
  def render(context)
12
12
  site = context.registers[:site]
13
- format = @format || site.config.dig('last-modified-at', 'date-format')
14
- article_file = context.environments.first['page']['path']
13
+ format = @format || site.config.dig("last-modified-at", "date-format")
14
+ article_file = context.environments.first["page"]["path"]
15
15
  Determinator.new(site.source, article_file, format)
16
- .formatted_last_modified_date
16
+ .formatted_last_modified_date
17
17
  end
18
18
  end
19
19
  end
20
20
  end
21
21
 
22
- Liquid::Template.register_tag('last_modified_at', Jekyll::LastModifiedAt::Tag)
22
+ Liquid::Template.register_tag("last_modified_at", Jekyll::LastModifiedAt::Tag)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module LastModifiedAt
5
- VERSION = '1.3.0'
5
+ VERSION = "1.3.2"
6
6
  end
7
7
  end
@@ -2,15 +2,15 @@
2
2
 
3
3
  module Jekyll
4
4
  module LastModifiedAt
5
- require 'jekyll-last-modified-at/tag'
6
- require 'jekyll-last-modified-at/hook'
5
+ require "jekyll-last-modified-at/tag"
6
+ require "jekyll-last-modified-at/hook"
7
7
 
8
- autoload :VERSION, 'jekyll-last-modified-at/version'
9
- autoload :Executor, 'jekyll-last-modified-at/executor'
10
- autoload :Determinator, 'jekyll-last-modified-at/determinator'
11
- autoload :Git, 'jekyll-last-modified-at/git'
8
+ autoload :VERSION, "jekyll-last-modified-at/version"
9
+ autoload :Executor, "jekyll-last-modified-at/executor"
10
+ autoload :Determinator, "jekyll-last-modified-at/determinator"
11
+ autoload :Git, "jekyll-last-modified-at/git"
12
12
 
13
- PATH_CACHE = {} # rubocop:disable Style/MutableConstant
14
- REPO_CACHE = {} # rubocop:disable Style/MutableConstant
13
+ PATH_CACHE = {}
14
+ REPO_CACHE = {}
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-last-modified-at
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-30 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,20 +30,7 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
33
- - !ruby/object:Gem::Dependency
34
- name: posix-spawn
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 0.3.9
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 0.3.9
33
+ force_ruby_platform: false
47
34
  - !ruby/object:Gem::Dependency
48
35
  name: rake
49
36
  requirement: !ruby/object:Gem::Requirement
@@ -86,20 +73,6 @@ dependencies:
86
73
  - - ">="
87
74
  - !ruby/object:Gem::Version
88
75
  version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: rubocop-performance
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
76
  - !ruby/object:Gem::Dependency
104
77
  name: rubocop-standard
105
78
  requirement: !ruby/object:Gem::Requirement
@@ -160,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
133
  - !ruby/object:Gem::Version
161
134
  version: '0'
162
135
  requirements: []
163
- rubygems_version: 3.1.2
136
+ rubygems_version: 3.4.6
164
137
  signing_key:
165
138
  specification_version: 4
166
139
  summary: A liquid tag for Jekyll to indicate the last time a file was modified.