Skip to content

Commit 97e514d

Browse files
committed
Add a reload! command for console
1 parent 7faf625 commit 97e514d

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Packages.all
5555

5656
# Get all violations
5757
Violations.all
58+
59+
# Reset the cache
60+
reload!
5861
```
5962

6063
### Ruby API

lib/query_packwerk.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,10 @@ def full_name(pack_name)
8282

8383
"packs/#{pack_name}"
8484
end
85+
86+
sig { void }
87+
def reload!
88+
Packages.reload!
89+
Violations.reload!
90+
end
8591
end

lib/query_packwerk/packages.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ def all
4444
def where(**query_params, &query_fn)
4545
QueryPackwerk::Packages.new(super)
4646
end
47+
48+
sig { void }
49+
def reload!
50+
@all = nil
51+
end
4752
end
4853

4954
sig { params(original_collection: T::Array[QueryPackwerk::Package]).void }

lib/query_packwerk/violations.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ def all
5454
def where(**query_params, &query_fn)
5555
QueryPackwerk::Violations.new(super(**query_params, &query_fn))
5656
end
57+
58+
sig { void }
59+
def reload!
60+
@all = nil
61+
end
5762
end
5863

5964
sig do

0 commit comments

Comments
 (0)