8000 Allow core and stdlib documentation to be uncached by apiology · Pull Request #899 · castwide/solargraph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow core and stdlib documentation to be uncached #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
19 changes: 17 additions & 2 deletions lib/solargraph/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def config(directory = '.')
)
# @return [void]
def clear
puts "Deleting the cached documentation"
puts "Deleting all cached documentation (gems, core and stdlib)"
Solargraph::Cache.clear
end
map 'clear-cache' => :clear
Expand All @@ -105,11 +105,26 @@ def cache gem, version = nil
Cache.save('gems', "#{spec.name}-#{spec.version}.ser", pins)
end

desc 'uncache GEM [...GEM]', "Delete cached gem documentation"
desc 'uncache GEM [...GEM]', "Delete specific cached gem documentation"
long_desc %(
Specify one or more gem names to clear. 'core' or 'stdlib' may
also be specified to clear cached system documentation.
Documentation will be regenerated as needed.
)
# @return [void]
def uncache *gems
raise ArgumentError, 'No gems specified.' if gems.empty?
gems.each do |gem|
if gem == 'core'
Cache.uncache("core.ser")
next
end

if gem == 'stdlib'
Cache.uncache("stdlib")
next
end

spec = Gem::Specification.find_by_name(gem)
Cache.uncache('gems', "#{spec.name}-#{spec.version}.ser")
Cache.uncache('gems', "#{spec.name}-#{spec.version}.yardoc")
Expand Down
0