module

CRDoc::Shards::Builder

Turns a source tree into slim docs JSON.

Constants

COPY_ENTRIES = ["shard.yml", "shard.lock", "src"] of ::String

Top-level entries copied from a local tree. README* and LICENSE* also match.

COPY_PREFIXES = ["README", "LICENSE"] of ::String
SHA_PATTERN = /\A\h{7,40}\z/
STALE_TEMP_AGE = 1.hour

Build directories older than this are leftovers from an interrupted run.

Class methods

build_docs(dir : Path, name : String, version : String, log : IO) : String

Runs crystal docs in dir and returns the slim JSON.

Source
build_root

Directory holding build temp directories.

Source
clone(url : String, ref : String | Nil, dest : Path, log : IO, label : String = url) : String

Clones url into dest and returns the resolved HEAD commit. label names the repository in error messages.

Source
copy_tree(source : Path, dest : Path) : Nil

Copies the parts of source that docs need into dest: shard.yml, shard.lock, src/, and README and LICENSE files.

Source
install_dependencies(dir : Path, name : String, log : IO) : Nil

Installs runtime dependencies into <dir>/lib.

Source
read_shard_yml(dir : Path) : ShardInfo

Reads name, version and dependency presence from <dir>/shard.yml.

Source
sweep_stale(root : Path, now : Time = Time.utc) : Nil

Removes children of root last modified over STALE_TEMP_AGE ago.

Source
with_tempdir

Yields a fresh temp directory and removes it afterwards, also on INT/TERM (which exit 130). Leftovers from earlier interrupted builds are swept first.

Source

Nested types