Skip to content

Commit f0756c3

Browse files
authored
Update all the things (#18)
* Just leanred that I've had a typo in this repo... also updating everything to be latest stuff * Downgrade Timecop until we require Crystal 1.19 as a minimum
1 parent 10254ab commit f0756c3

File tree

11 files changed

+50
-34
lines changed

11 files changed

+50
-34
lines changed

.ameba.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This configuration file was generated by `ameba --gen-config`
2+
# on 2026-03-11 00:06:56 UTC using Ameba version 1.6.4.
3+
# The point is for the user to remove these configuration records
4+
# one by one as the reported problems are removed from the code base.
5+
6+
# Problems found: 2
7+
# Run `ameba --only Lint/UselessAssign` for details
8+
Lint/UselessAssign:
9+
Description: Disallows useless variable assignments
10+
ExcludeTypeDeclarations: false
11+
Excluded:
12+
- src/lucky_cache.cr
13+
Enabled: true
14+
Severity: Warning

.github/workflows/ci.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
continue-on-error: false
1515
steps:
1616
- name: Download source
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v6
1818
- name: Install Crystal
1919
uses: crystal-lang/install-crystal@v1
2020
- name: Install shards
@@ -27,15 +27,17 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
os: [ubuntu-latest, windows-latest]
31-
crystal_version: [latest]
32-
include:
33-
- os: ubuntu-latest
34-
crystal_version: 1.4.0
30+
os:
31+
- ubuntu-latest
32+
- macos-latest
33+
- windows-latest
34+
crystal_version:
35+
- 1.16.3
36+
- latest
3537
runs-on: ${{ matrix.os }}
3638
continue-on-error: false
3739
steps:
38-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v6
3941
- uses: crystal-lang/install-crystal@v1
4042
with:
4143
crystal: ${{ matrix.crystal_version }}

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v6
1212
with:
1313
persist-credentials: false
1414
- uses: crystal-lang/install-crystal@v1
@@ -17,7 +17,7 @@ jobs:
1717
- name: "Generate docs"
1818
run: crystal docs
1919
- name: Deploy to GitHub Pages
20-
uses: peaceiris/actions-gh-pages@v3
20+
uses: peaceiris/actions-gh-pages@v4
2121
with:
2222
github_token: ${{ secrets.GITHUB_TOKEN }}
2323
publish_dir: ./docs

shard.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 0.1.1
44
authors:
55
- Jeremy Woertink <jeremywoertink@gmail.com>
66

7-
crystal: ">= 1.4.0"
7+
crystal: ">= 1.16.0"
88

99
license: MIT
1010

@@ -13,12 +13,12 @@ dependencies:
1313
github: wyhaines/splay_tree_map.cr
1414
habitat:
1515
github: luckyframework/habitat
16-
version: ~> 0.4.7
16+
version: ~> 0.4.9
1717

1818
development_dependencies:
1919
timecop:
2020
github: crystal-community/timecop.cr
21-
branch: master
21+
version: ~> 0.5.0
2222
ameba:
2323
github: crystal-ameba/ameba
24-
version: ~> 1.0.0
24+
version: ~> 1.6.4

spec/stores/memory_store_spec.cr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
require "../spec_helper"
22

33
class User
4-
include LuckyCache::Cachable
4+
include LuckyCache::Cacheable
55
property email : String
66

77
def initialize(@email : String)
88
end
99
end
1010

1111
class Post
12-
include LuckyCache::Cachable
12+
include LuckyCache::Cacheable
1313
property title : String
1414

1515
def initialize(@title : String)
@@ -49,7 +49,7 @@ describe LuckyCache::MemoryStore do
4949

5050
result.should be_a(Array(User))
5151
counter.should eq(1)
52-
friends = result.not_nil!
52+
friends = result.as(Array(User))
5353
friends.size.should eq(2)
5454
friends.map(&.email).should contain("chris@email.net")
5555
end
@@ -68,7 +68,7 @@ describe LuckyCache::MemoryStore do
6868

6969
result.should be_a(Array(Post))
7070
counter.should eq(1)
71-
friends = result.not_nil!
71+
friends = result.as(Array(Post))
7272
friends.size.should eq(2)
7373
friends.map(&.title).should contain("learn about cash")
7474
end
@@ -93,10 +93,10 @@ describe LuckyCache::MemoryStore do
9393
UUID.random
9494
end
9595
Timecop.travel(12.hours.from_now) do
96-
cache.read("coupon").not_nil!.expired?.should eq(false)
96+
cache.read("coupon").as(LuckyCache::CacheItem).expired?.should eq(false)
9797
end
9898
Timecop.travel(35.hours.from_now) do
99-
cache.read("coupon").not_nil!.expired?.should eq(false)
99+
cache.read("coupon").as(LuckyCache::CacheItem).expired?.should eq(false)
100100
end
101101
Timecop.travel(49.hours.from_now) do
102102
cache.read("coupon").should eq(nil)

spec/stores/null_store_spec.cr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
require "../spec_helper"
22

33
class User
4-
include LuckyCache::Cachable
4+
include LuckyCache::Cacheable
55
property email : String
66

77
def initialize(@email : String)
88
end
99
end
1010

1111
class Post
12-
include LuckyCache::Cachable
12+
include LuckyCache::Cacheable
1313
property title : String
1414

1515
def initialize(@title : String)
@@ -49,7 +49,7 @@ describe LuckyCache::NullStore do
4949

5050
result.should be_a(Array(User))
5151
counter.should eq(2)
52-
friends = result.not_nil!
52+
friends = result.as(Array(User))
5353
friends.size.should eq(2)
5454
friends.map(&.email).should contain("chris@email.net")
5555
end
@@ -68,7 +68,7 @@ describe LuckyCache::NullStore do
6868

6969
result.should be_a(Array(Post))
7070
counter.should eq(2)
71-
friends = result.not_nil!
71+
friends = result.as(Array(Post))
7272
friends.size.should eq(2)
7373
friends.map(&.title).should contain("learn about cash")
7474
end

src/lucky_cache.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require "splay_tree_map"
22
require "habitat"
33
require "uuid"
44
require "json"
5-
require "./lucky_cache/cachable"
5+
require "./lucky_cache/cacheable"
66
require "./lucky_cache/cache_item"
77
require "./lucky_cache/stores/*"
88
require "./lucky_cache/*"
@@ -15,5 +15,5 @@ module LuckyCache
1515
setting default_duration : Time::Span = 1.minute
1616
end
1717

18-
alias CachableTypes = Cachable | Array(Cachable) | String | Array(String) | Int32 | Array(Int32) | Int64 | Array(Int64) | Float64 | Array(Float64) | Bool | Array(Bool) | Time | UUID | JSON::Any
18+
alias CacheableTypes = Cacheable | Array(Cacheable) | String | Array(String) | Int32 | Array(Int32) | Int64 | Array(Int64) | Float64 | Array(Float64) | Bool | Array(Bool) | Time | UUID | JSON::Any
1919
end

src/lucky_cache/cache_item.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module LuckyCache
22
struct CacheItem
3-
getter value : CachableTypes
3+
getter value : CacheableTypes
44
getter expires_in : Time::Span
55
private getter expiration : Time
66

7-
def initialize(@value : CachableTypes, @expires_in : Time::Span)
7+
def initialize(@value : CacheableTypes, @expires_in : Time::Span)
88
@expiration = @expires_in.from_now
99
end
1010

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Include this module in the custom types you want to cache
2-
module LuckyCache::Cachable
2+
module LuckyCache::Cacheable
33
end

src/lucky_cache/html_helpers.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module LuckyCache::HtmlHelpers
88
# end
99
# end
1010
# ```
11-
def cache(key, *, expires_in : Time::Span?)
11+
def cache(key, *, expires_in : Time::Span?, &)
1212
cache = LuckyCache.settings.storage
1313
expires = expires_in || LuckyCache.settings.default_duration
1414

0 commit comments

Comments
 (0)