Created
January 18, 2026 07:56
-
-
Save 0riginaln0/dad474457e0ae6d33ace0659643256f9 to your computer and use it in GitHub Desktop.
Crystal script to generate local documentation for specified dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "file_utils" | |
| require "wait_group" | |
| # {name, link, refname} | |
| DEPS = [ | |
| {"kemal", "https://github.com/kemalcr/kemal", "master"}, | |
| {"db", "https://github.com/crystal-lang/crystal-db", "master"}, | |
| {"sqlite3", "https://github.com/crystal-lang/crystal-sqlite3", "master"}, | |
| {"radix", "https://github.com/luislavena/radix", "master"}, | |
| {"backtracer", "https://github.com/Sija/backtracer.cr", "master"}, | |
| {"exception_page", "https://github.com/crystal-loot/exception_page", "master"}, | |
| ] | |
| def docgen(name, link, refname) | |
| lib_dir = "lib/#{name}" | |
| unless Dir.exists? lib_dir | |
| puts "Dir not found: #{lib_dir}" | |
| return | |
| end | |
| url = "#{link}/blob/%{refname}/%{path}#L%{line}" | |
| args = ["docs", "--source-url-pattern=#{url}", "--source-refname=#{refname}"] | |
| if Process.run("crystal", args, chdir: lib_dir).success? | |
| puts "#{name} succeded" | |
| else | |
| puts "#{name} failed" | |
| end | |
| end | |
| wg = WaitGroup.new(DEPS.size) | |
| DEPS.each do |(name, link, refname)| | |
| spawn do | |
| docgen(name, link, refname) | |
| ensure | |
| wg.done | |
| end | |
| end | |
| wg.wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment