ZealDocsets.Docset (zeal_docsets v0.1.7)

Copy Markdown View Source

Orchestrates the construction of a .docset bundle for a single dependency.

A docset has the following on-disk layout:

{package}.docset/
 icon.png           package logo (if available)
 icon@2x.png        same logo at 2× (for HiDPI displays)
 meta.json          name, title, version metadata
 Contents/
     Info.plist     Apple plist with Dash/Zeal configuration
     Resources/
         docSet.dsidx               SQLite search index
         Documents/docs/{package}/  mirrored HTML documentation

The build is skipped (and the existing docset optionally re-installed) when the current on-disk version matches the requested version, unless force: true is given.

Summary

Functions

Builds a .docset bundle for dep inside workspace_root/output/.

Returns the default Zeal docsets directory for the current platform.

Derives a human-readable display title from a package name.

Functions

build(dep, workspace_root, opts \\ [])

@spec build(ZealDocsets.Dep.t(), Path.t(), keyword()) ::
  {:ok, Path.t(), Path.t() | nil} | {:skipped, Path.t()}

Builds a .docset bundle for dep inside workspace_root/output/.

Options

  • :force — when true, rebuilds even if the version is already
                  up to date. Defaults to `false`.
  • :install — when true, copies the resulting docset to
                  `install_root`. Defaults to `true`.
  • :install_root — the Zeal docsets directory. Defaults to the
                  platform-specific Zeal docsets path.
  • :mirror_fn — internal/testing hook that overrides the mirroring
                  function. Defaults to `&ZealDocsets.Hexdocs.mirror/3`.

Return values

  • {:ok, docset_path, installed_path} — docset was (re)built and optionally installed. installed_path is nil when install: false.
  • {:skipped, docset_path} — existing docset is already at the correct version and was skipped.

default_install_root()

@spec default_install_root() :: Path.t()

Returns the default Zeal docsets directory for the current platform.

The default path is resolved for Linux, macOS, and Windows.

title_from_package(dep)

@spec title_from_package(ZealDocsets.Dep.t()) :: String.t()

Derives a human-readable display title from a package name.

Splits on underscores and capitalises each word: "phoenix_live_view""Phoenix Live View".