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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10374c51b616fe5028bf853d04ec65976c9152ffe86020486ba17103c1600292
4
- data.tar.gz: a214df205c9b2f0ca23876502f7f4499b7e0c3c359e767c03c88e62a31fe94d0
3
+ metadata.gz: 03ac621e688b959799d869bb123f7f13c8cdf34f19c4235a15662b1d4f2923e4
4
+ data.tar.gz: 9872019926ed7145e16a93bce782221d844b38b4ce0ef6efcf131e522d345746
5
5
  SHA512:
6
- metadata.gz: bab3e10426b8be1389f9e28e56c6b391958b50a045a7fbb041ce3665c8fd76c3ede964f8ad89a958cd8e97cd1642329dd5ea2b34f7be48b266614c886d6ffe8c
7
- data.tar.gz: b336684ae25165e157148ec5a6eedd6f07b0dd42b846573e1d6e7d14a9e5ab3eda888bfd171faef70258bcb97ae715db718e3d2bd2fbb6ce15b2fe344c75b18b
6
+ metadata.gz: c3c8dd260b55fb2e205a5deae79a3ac51d43881953c9f0530a52542f138dd75b4309c22aa6da08743bfe76cc4c17faf0fcaac4b5d00a455cfd6507685bb96600
7
+ data.tar.gz: d82e22aa4b14dfb2709d6a9805418497c2ecd6479af8c1ba41e8dc00e8f72188a1b5f1fa490666a9a83220bea44eb47122474227e73a392b87efb37363380dc2
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module UJPowertools
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
@@ -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
- # def generate(site)
57
- # site.pages.each do |page|
58
- # # Inject a random number into the page's data
59
- # page.data['random_number'] = rand(100) # Random number between 0 and 99
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2024-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll