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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49deda1c8fd804d1f221b26b8b2770a136681c4fdd0d295e5d33207e2f649184
4
- data.tar.gz: f63928489b58a6e4add3eb192f76b89e26699808ec3bcb0786563fb90fa24a96
3
+ metadata.gz: f39b0ac3cd92ee81abf584d99a3c7fd75661605f20777d7546353228ca50b9f5
4
+ data.tar.gz: f41f56482e2cc35db87baa0d6c13206ce255f00a184b6b6c1f9d7c841f44bd22
5
5
  SHA512:
6
- metadata.gz: e3b7381753f3c08e6c0b031de19612e5c0d000ccc4223f3a34dff7fe4e469ad42ffc1f28a7121f8daf8f28252a2a4dd1758142e2ae80a7be45b4a0876fc253b1
7
- data.tar.gz: e33a448a3d7c99e6508e16443073b237c03a207951cc8374b72e7cd8973a7190b77076a3eeeb79bbee665c00884d7285c28c9fa77ae35f15daea348e8ad9d15f
6
+ metadata.gz: c78bff5243a2b38c3e0443bca9459537c151678e2ad87083b346660eb84b7682156f53df572f9c49c6b330ca5f254b4e888c596e2a52dee83f68107f80834474
7
+ data.tar.gz: 12216708318c4d2c7e421ff9e0a8b967c54ad4492169aa9eed71e9b703738d165791136d26eb0fdf79f2cc557bf81fe5d01cc90f7d060b77b1996876c6672fc7
data/CHANGELOG.md CHANGED
@@ -1,2 +1,6 @@
1
+ ## 0.1.1 / 2022-04-05
2
+ * Added weeks_since
3
+ * Fixed parse error in seconds_since
4
+
1
5
  ## 0.1.0 / 2022-04-05
2
6
  * Initial version published
@@ -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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllTimeSinceVersion
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -5,7 +5,7 @@ require "time"
5
5
  require_relative "jekyll_time_since/version"
6
6
 
7
7
  module JekyllTimeSinceName
8
- PLUGIN_NAME = "block_tag_template"
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, Jekyll::TimeSince)
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
@@ -1,10 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "jekyll"
4
- require "fileutils"
5
- require "key_value_parser"
6
- require "shellwords"
7
-
8
4
  require_relative "../lib/jekyll_time_since"
9
5
 
10
6
  Jekyll.logger.log_level = :info
@@ -0,0 +1,3 @@
1
+ example_id | status | run_time |
2
+ ------------------------------------- | ------ | ------------ |
3
+ ./spec/jekyll_time_since_spec.rb[1:1] | passed | 7.26 seconds |
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.0
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