solargraph icon indicating copy to clipboard operation
solargraph copied to clipboard

Cache stdlib/core from command line

Open apiology opened this issue 4 months ago • 1 comments

This adds the ability to cache both the core and standard libraries from the command line, with improved output messages for better understanding of where pins are coming from:

$ bundle exec solargraph help gem
Usage:
  solargraph gems [GEM[=VERSION]...] [STDLIB...] [core]

Description:
  This command will cache the generated type documentation for the specified libraries. While Solargraph will generate this on the
  fly when needed, it takes time. This command will generate it in advance, which can be useful for CI scenarios.

  With no arguments, it will cache all libraries in the current workspace. If a gem or standard library name is specified, it will
  cache that library's type documentation.

  An equals sign after a gem will allow a specific gem version to be cached.

  The 'core' argument can be used to cache the type documentation for the core Ruby libraries.

  Cached documentation is stored in /Users/broz/.cache/solargraph, which can be stored between CI runs.
$
$ bundle exec solargraph gems
Caching these gems: []
Caching RBS pins for Ruby core
Caching RBS pins for standard library tmpdir
Caching RBS pins for standard library ripper
Caching RBS pins for standard library socket
Caching RBS pins for standard library yaml
Caching RBS pins for standard library psych
Caching RBS pins for standard library dbm
Caching RBS pins for standard library pstore
Caching YARD and RBS collection pins for gem ast:2.4.3
Caching YARD and RBS collection pins for gem backport:1.2.0
Caching YARD and RBS collection pins for gem base64:0.3.0
Caching YARD and RBS collection pins for gem benchmark:0.4.1
Caching YARD and RBS collection pins for gem bigdecimal:3.2.2
Caching YARD and RBS collection pins for gem bundler:2.5.23
Caching YARD and RBS collection pins for gem cgi:0.5.0
Caching YARD and RBS collection pins for gem date:3.4.1
Caching YARD and RBS collection pins for gem diff-lcs:1.6.2
Caching YARD and RBS collection pins for gem digest:3.2.0
Caching YARD and RBS collection pins for gem docile:1.4.1
Caching YARD and RBS collection pins for gem fileutils:1.7.3
Caching YARD and RBS collection pins for gem imagen:0.2.0
Caching YARD and RBS collection pins for gem jaro_winkler:1.6.1
Caching YARD and RBS collection pins for gem json:2.13.2
Caching YARD and RBS collection pins for gem kramdown:2.5.1
Caching YARD and RBS collection pins for gem kramdown-parser-gfm:1.1.0
Caching YARD and RBS collection pins for gem language_server-protocol:3.17.0.5
Caching YARD and RBS collection pins for gem lint_roller:1.1.0
Caching YARD and RBS collection pins for gem logger:1.7.0
Caching YARD and RBS collection pins for gem nokogiri:1.18.9
Caching YARD and RBS collection pins for gem observer:0.1.2
Caching YARD and RBS collection pins for gem open3:0.2.1
Caching YARD and RBS collection pins for gem ostruct:0.6.3
Caching YARD and RBS collection pins for gem parallel:1.27.0
Caching YARD and RBS collection pins for gem parser:3.3.9.0
Caching YARD and RBS collection pins for gem pathname:0.4.0
Caching YARD and RBS collection pins for gem prism:1.4.0
Caching YARD and RBS collection pins for gem racc:1.8.1
Caching YARD and RBS collection pins for gem rainbow:3.1.1
Caching YARD and RBS collection pins for gem rake:13.3.0
Caching YARD and RBS collection pins for gem rbs:3.9.4
Caching YARD and RBS collection pins for gem regexp_parser:2.11.2
Caching YARD and RBS collection pins for gem reverse_markdown:3.0.0
Caching YARD and RBS collection pins for gem rexml:3.4.2
Caching YARD and RBS collection pins for gem rubocop:1.80.1
Caching YARD and RBS collection pins for gem rubocop-ast:1.46.0
Caching YARD and RBS collection pins for gem ruby-progressbar:1.13.0
Caching YARD and RBS collection pins for gem rugged:1.9.0
Caching YARD and RBS collection pins for gem securerandom:0.4.1
Caching YARD and RBS collection pins for gem simplecov:0.22.0
Caching YARD and RBS collection pins for gem simplecov-html:0.13.2
Caching YARD and RBS collection pins for gem simplecov-lcov:0.8.0
Caching YARD and RBS collection pins for gem simplecov_json_formatter:0.1.4
Caching YARD and RBS collection pins for gem stringio:3.1.7
Caching YARD and RBS collection pins for gem tempfile:0.3.1
Caching YARD and RBS collection pins for gem thor:1.4.0
Caching YARD and RBS collection pins for gem tilt:2.6.1
Caching YARD and RBS collection pins for gem undercover:0.7.4
Caching YARD and RBS collection pins for gem unicode-display_width:3.1.5
Caching YARD and RBS collection pins for gem unicode-emoji:4.0.4
Caching YARD and RBS collection pins for gem yard:0.9.37
Caching YARD and RBS collection pins for gem yard-activesupport-concern:0.0.1
Caching YARD and RBS collection pins for gem yard-solargraph:0.1.0
Caching YARD and RBS collection pins for gem benchmark:0.4.1
Caching YARD and RBS collection pins for gem bundler:2.5.23
Caching YARD and RBS collection pins for gem cgi:0.5.0
Caching YARD and RBS collection pins for gem date:3.4.1
Caching YARD and RBS collection pins for gem digest:3.2.0
Caching YARD and RBS collection pins for gem fileutils:1.7.3
Caching YARD and RBS collection pins for gem json:2.13.2
Caching YARD and RBS collection pins for gem logger:1.7.0
Caching YARD and RBS collection pins for gem open3:0.2.1
Caching YARD and RBS collection pins for gem ostruct:0.6.3
Caching YARD and RBS collection pins for gem pathname:0.4.0
Caching YARD and RBS collection pins for gem prism:1.4.0
Caching YARD and RBS collection pins for gem securerandom:0.4.1
Caching YARD and RBS collection pins for gem tempfile:0.3.1
Documentation cached for all 101 gems.
Caching RBS pins for standard library benchmark
Caching RBS pins for standard library cgi
Caching RBS pins for standard library tempfile
Caching RBS pins for standard library stringio
Caching RBS pins for standard library coverage
Caching RBS pins for standard library date
Caching RBS pins for standard library delegate
Caching RBS pins for standard library did_you_mean
Caching RBS pins for standard library digest
Caching RBS pins for standard library erb
Caching RBS pins for standard library fileutils
Caching RBS pins for standard library find
Caching RBS pins for standard library forwardable
Caching RBS pins for standard library ipaddr
Caching RBS pins for standard library json
Caching RBS pins for standard library logger
Caching RBS pins for standard library monitor
Caching RBS pins for standard library objspace
Caching RBS pins for standard library open-uri
Caching RBS pins for standard library tempfile
Caching RBS pins for standard library uri
Caching RBS pins for standard library stringio
Caching RBS pins for standard library open3
Caching RBS pins for standard library openssl
Caching RBS pins for standard library socket
Caching RBS pins for standard library digest
Caching RBS pins for standard library optparse
Caching RBS pins for standard library pathname
Caching RBS pins for standard library pp
Caching RBS pins for standard library prettyprint
Caching RBS pins for standard library prettyprint
Caching RBS pins for standard library prism
Caching RBS pins for standard library pstore
Caching RBS pins for standard library psych
Caching RBS pins for standard library dbm
Caching RBS pins for standard library pstore
Caching RBS pins for standard library rdoc
Caching RBS pins for standard library resolv
Caching RBS pins for standard library socket
Caching RBS pins for standard library timeout
Caching RBS pins for standard library securerandom
Caching RBS pins for standard library shellwords
Caching RBS pins for standard library singleton
Caching RBS pins for standard library strscan
Caching RBS pins for standard library tempfile
Caching RBS pins for standard library time
Caching RBS pins for standard library timeout
Caching RBS pins for standard library tsort
Caching RBS pins for standard library uri
Documentation cached for core, standard library and gems.
broz@Mac:~/src/solargraph$ 
```

apiology avatar Sep 03 '25 13:09 apiology

This PR takes a chunk of complexity out of #1006 - apologies if some of the code looks a little awkward or out of place out of that context, but it should be enough to be a useful chunk of functionality on its own.

apiology avatar Sep 03 '25 13:09 apiology