Skip to content

Commit 8d0c5b7

Browse files
committed
Cache command
1 parent c5bd50e commit 8d0c5b7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/solargraph/shell.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def clear
8989
map 'clear-cache' => :clear
9090
map 'clear-cores' => :clear
9191

92+
desc 'cache', 'Cache a gem', hide: true
93+
# @return [void]
94+
# @param gem [String]
95+
# @param version [String, nil]
96+
def cache gem, version = nil
97+
spec = Gem::Specification.find_by_name(gem, version)
98+
pins = GemPins.build(spec)
99+
Cache.save('gems', "#{spec.name}-#{spec.version}.ser", pins)
100+
end
101+
92102
desc 'uncache GEM [...GEM]', "Delete cached gem documentation"
93103
# @return [void]
94104
def uncache *gems

0 commit comments

Comments
 (0)