Plushie.Binary (Plushie v0.7.2)

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 under _build/<env>/plushie-renderer-spec/target/plushie-renderer/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 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.

Returns the plushie-rust release this SDK targets.

Validates that the binary at path matches the system architecture.

Functions

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.

plushie_rust_version()

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

Returns the plushie-rust release this SDK targets.

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).