jekyll_time_since 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/jekyll_time_since.gemspec +0 -5
- data/lib/jekyll_time_since/version.rb +1 -1
- data/lib/jekyll_time_since.rb +7 -2
- data/spec/jekyll_time_since_spec.rb +9 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/status_persistence.txt +3 -0
- metadata +2 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f39b0ac3cd92ee81abf584d99a3c7fd75661605f20777d7546353228ca50b9f5
|
4
|
+
data.tar.gz: f41f56482e2cc35db87baa0d6c13206ce255f00a184b6b6c1f9d7c841f44bd22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c78bff5243a2b38c3e0443bca9459537c151678e2ad87083b346660eb84b7682156f53df572f9c49c6b330ca5f254b4e888c596e2a52dee83f68107f80834474
|
7
|
+
data.tar.gz: 12216708318c4d2c7e421ff9e0a8b967c54ad4492169aa9eed71e9b703738d165791136d26eb0fdf79f2cc557bf81fe5d01cc90f7d060b77b1996876c6672fc7
|
data/CHANGELOG.md
CHANGED
data/jekyll_time_since.gemspec
CHANGED
@@ -34,11 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
|
35
35
|
spec.add_dependency "jekyll", ">= 3.5.0"
|
36
36
|
spec.add_dependency "jekyll_plugin_logger"
|
37
|
-
spec.add_dependency "key-value-parser"
|
38
|
-
spec.add_dependency "git"
|
39
|
-
spec.add_dependency "os"
|
40
|
-
spec.add_dependency "shellwords"
|
41
|
-
spec.add_dependency "tty-prompt"
|
42
37
|
|
43
38
|
spec.add_development_dependency "debase"
|
44
39
|
# spec.add_development_dependency "rubocop-jekyll"
|
data/lib/jekyll_time_since.rb
CHANGED
@@ -5,7 +5,7 @@ require "time"
|
|
5
5
|
require_relative "jekyll_time_since/version"
|
6
6
|
|
7
7
|
module JekyllTimeSinceName
|
8
|
-
PLUGIN_NAME = "
|
8
|
+
PLUGIN_NAME = "jekyll_time_since"
|
9
9
|
end
|
10
10
|
|
11
11
|
# These tags all work in a similar manner; they accept one parameter,
|
@@ -90,6 +90,10 @@ module TimeSince
|
|
90
90
|
((date2 - date1).to_f / 365 * 12).round
|
91
91
|
end
|
92
92
|
|
93
|
+
def weeks_since(string)
|
94
|
+
days_since(string) / 7
|
95
|
+
end
|
96
|
+
|
93
97
|
def days_since(string)
|
94
98
|
hours_since(string) / 24
|
95
99
|
end
|
@@ -103,9 +107,10 @@ module TimeSince
|
|
103
107
|
end
|
104
108
|
|
105
109
|
def seconds_since(string)
|
110
|
+
string += "-01-01" unless string.include?("-")
|
106
111
|
(Time.new - Time.parse(string)).to_i
|
107
112
|
end
|
108
113
|
end
|
109
114
|
|
110
115
|
PluginMetaLogger.instance.info { "Loaded #{JekyllTimeSinceName::PLUGIN_NAME} v#{JekyllTimeSinceVersion::VERSION} plugin." }
|
111
|
-
Liquid::Template.register_tag(JekyllTimeSinceName::PLUGIN_NAME,
|
116
|
+
Liquid::Template.register_tag(JekyllTimeSinceName::PLUGIN_NAME, TimeSince)
|
@@ -3,7 +3,15 @@
|
|
3
3
|
require_relative "../lib/jekyll_time_since"
|
4
4
|
|
5
5
|
RSpec.describe(TimeSince) do
|
6
|
+
include TimeSince
|
6
7
|
it "Computes years" do
|
7
|
-
|
8
|
+
years_since("1956")
|
9
|
+
years_since("1956-10-15")
|
10
|
+
|
11
|
+
months_since("1956")
|
12
|
+
months_since("1956-10-15")
|
13
|
+
|
14
|
+
weeks_since("1956")
|
15
|
+
weeks_since("1956-10-15")
|
8
16
|
end
|
9
17
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_time_since
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Slinn
|
@@ -38,76 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: key-value-parser
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: git
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: os
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: shellwords
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: tty-prompt
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
41
|
- !ruby/object:Gem::Dependency
|
112
42
|
name: debase
|
113
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +86,7 @@ files:
|
|
156
86
|
- lib/jekyll_time_since/version.rb
|
157
87
|
- spec/jekyll_time_since_spec.rb
|
158
88
|
- spec/spec_helper.rb
|
89
|
+
- spec/status_persistence.txt
|
159
90
|
homepage: https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html
|
160
91
|
licenses:
|
161
92
|
- MIT
|