Plushie.Binary (Plushie v0.6.0)

Copy Markdown View Source

Resolves the path to the plushie binary.

Resolution order for path!/0:

  1. PLUSHIE_BINARY_PATH environment variable
  2. Application config :binary_path
  3. Custom widget build in _build/<env>/plushie/target/
  4. Downloaded binary in _build/plushie/bin/

Steps 1 and 2 are explicit configuration -- if set but pointing to a missing file, they raise immediately rather than falling through. Steps 3 and 4 are implicit discovery and silently try the next option.

Summary

Functions

Returns the plushie-renderer version this SDK targets.

Returns the binary name for custom widget builds.

Returns the directory where downloaded binaries are stored.

Returns the platform-specific binary name for downloads.

Standard instructions for resolving a missing plushie binary.

Returns the path to the plushie binary.

Validates that the binary at path matches the system architecture.

Functions

binary_version()

@spec binary_version() :: String.t()

Returns the plushie-renderer version this SDK targets.

build_name()

@spec build_name() :: String.t()

Returns the binary name for custom widget builds.

Derived from the Mix project app name by default, overridable via config:

config :plushie, :build_name, "my-custom-renderer"

For a project named :my_dashboard, the default is my-dashboard-renderer.

download_dir()

@spec download_dir() :: String.t()

Returns the directory where downloaded binaries are stored.

This is _build/plushie/bin/ relative to the project root, shared across Mix environments (the binary is platform-specific, not env-specific).

download_name()

@spec download_name() :: String.t()

Returns the platform-specific binary name for downloads.

Format: plushie-renderer-{os}-{arch} (e.g. plushie-renderer-linux-x86_64).

not_found_message()

@spec not_found_message() :: String.t()

Standard instructions for resolving a missing plushie binary.

Used by the compiler, test helper, and error messages to provide consistent guidance.

path!()

@spec path!() :: String.t()

Returns the path to the plushie binary.

Raises with not_found_message/0 if no binary can be resolved, or with a specific message if an explicitly configured path doesn't exist.

validate_architecture!(path)

@spec validate_architecture!(path :: String.t()) :: :ok

Validates that the binary at path matches the system architecture.

Runs file on the binary and compares the detected architecture against :erlang.system_info(:system_architecture). Raises on mismatch. Returns :ok on match or if the check cannot be performed (e.g. file command not available, or architecture not recognized).