jekyll-uj-powertools 1.1.0 → 1.1.2
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/lib/jekyll-uj-powertools/version.rb +1 -1
- data/lib/jekyll-uj-powertools.rb +16 -23
- data/spec/jekyll-uj-powertools_spec.rb +14 -0
- 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: 03ac621e688b959799d869bb123f7f13c8cdf34f19c4235a15662b1d4f2923e4
|
4
|
+
data.tar.gz: 9872019926ed7145e16a93bce782221d844b38b4ce0ef6efcf131e522d345746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3c8dd260b55fb2e205a5deae79a3ac51d43881953c9f0530a52542f138dd75b4309c22aa6da08743bfe76cc4c17faf0fcaac4b5d00a455cfd6507685bb96600
|
7
|
+
data.tar.gz: d82e22aa4b14dfb2709d6a9805418497c2ecd6479af8c1ba41e8dc00e8f72188a1b5f1fa490666a9a83220bea44eb47122474227e73a392b87efb37363380dc2
|
data/lib/jekyll-uj-powertools.rb
CHANGED
@@ -2,6 +2,9 @@ require "jekyll"
|
|
2
2
|
|
3
3
|
module Jekyll
|
4
4
|
module UJPowertools
|
5
|
+
# Initialize a timestamp that will remain consistent across calls
|
6
|
+
@cache_timestamp = Time.now.to_i.to_s
|
7
|
+
|
5
8
|
# Strip ads from the input
|
6
9
|
def uj_strip_ads(input)
|
7
10
|
input
|
@@ -43,34 +46,24 @@ module Jekyll
|
|
43
46
|
rand(input)
|
44
47
|
end
|
45
48
|
|
49
|
+
# Cache buster
|
50
|
+
# def uj_cache(input)
|
51
|
+
# Time.now.to_i.to_s
|
52
|
+
# end
|
53
|
+
def uj_cache(input)
|
54
|
+
Jekyll::UJPowertools.cache_timestamp
|
55
|
+
end
|
56
|
+
|
46
57
|
# Title case
|
47
58
|
def uj_title_case(input)
|
48
59
|
input.split(' ').map(&:capitalize).join(' ')
|
49
60
|
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# class InjectData < Generator
|
53
|
-
# safe true
|
54
|
-
# priority :low
|
55
61
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# next unless page.data['layout'] # Skip pages without layouts
|
62
|
-
|
63
|
-
# # Find the layout file by its name
|
64
|
-
# layout_name = page.data['layout']
|
65
|
-
# layout = site.layouts[layout_name]
|
66
|
-
|
67
|
-
# if layout && layout.data
|
68
|
-
# # Merge layout front matter into page's "layout_data"
|
69
|
-
# page.data['layout_data'] = layout.data
|
70
|
-
# end
|
71
|
-
# end
|
72
|
-
# end
|
73
|
-
# end
|
62
|
+
# Accessor for the consistent timestamp
|
63
|
+
def self.cache_timestamp
|
64
|
+
@cache_timestamp
|
65
|
+
end
|
66
|
+
end
|
74
67
|
|
75
68
|
class InjectData < Generator
|
76
69
|
safe true
|
@@ -58,4 +58,18 @@ RSpec.describe Jekyll::UJPowertools do
|
|
58
58
|
expect(dummy.uj_random(10)).to eq(8)
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
# Test Cache Buster method
|
63
|
+
describe '.uj_cache' do
|
64
|
+
it 'returns the current timestamp as a string' do
|
65
|
+
expect(dummy.uj_cache('unused')).to eq(Time.now.to_i.to_s)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Test Title Case method
|
70
|
+
describe '.uj_title_case' do
|
71
|
+
it 'capitalizes the first letter of each word' do
|
72
|
+
expect(dummy.uj_title_case('this is a title')).to eq('This Is A Title')
|
73
|
+
end
|
74
|
+
end
|
61
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-uj-powertools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ITW Creative Works
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|