ExMaude.Binary (ExMaude v0.4.0)

View Source

Maude binary management and platform detection.

This module handles locating and managing Maude executables, with support for:

  • Binaries in ExMaude's priv/maude/bin/ (installed via mix maude.install; the git checkout also carries platform binaries there for development — the hex package does not, since Maude is GPL-licensed)
  • System PATH detection
  • Custom path configuration

Fallback Chain

Binary resolution follows this priority:

  1. Application.get_env(:ex_maude, :maude_path) - Explicit config
  2. MAUDE_PATH - Environment override
  3. priv/maude/bin/maude-{platform} or priv/maude/bin/maude - Local binary (development checkout or mix maude.install)
  4. System.find_executable("maude") - System PATH
  5. Raises error with install instructions

Examples

# Get the Maude binary path
ExMaude.Binary.path()
#=> "/path/to/ex_maude/priv/maude/bin/maude-darwin-arm64"

# Check if a local binary is available
ExMaude.Binary.bundled?()
#=> true

# Get current platform
ExMaude.Binary.platform()
#=> "darwin-arm64"

Summary

Functions

Checks whether this installation contains a package-local Maude binary for the current platform.

Returns a package-local Maude binary for the current platform, or nil.

Returns the path to the Maude binary, or nil if not found.

Returns the path to the Maude binary.

Returns the current platform identifier.

Returns the priv directory path for ExMaude.

Checks if the current platform is supported.

Returns platforms that ExMaude can identify and use with a configured, locally installed, or system-provided Maude executable.

Returns the version associated with checkout-local development assets.

Functions

bundled?()

@spec bundled?() :: boolean()

Checks whether this installation contains a package-local Maude binary for the current platform.

bundled_path()

@spec bundled_path() :: Path.t() | nil

Returns a package-local Maude binary for the current platform, or nil.

Released Hex packages do not include these GPL-licensed binaries; this helper primarily supports source checkouts and separately installed assets.

find()

@spec find() :: Path.t() | nil

Returns the path to the Maude binary, or nil if not found.

Unlike path/0, this does not raise an error.

path()

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

Returns the path to the Maude binary.

Follows the fallback chain: config → environment → local → system → error.

Examples

ExMaude.Binary.path()
#=> "/path/to/maude"

platform()

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

Returns the current platform identifier.

Examples

ExMaude.Binary.platform()
#=> "darwin-arm64"

priv_dir()

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

Returns the priv directory path for ExMaude.

supported_platform?()

@spec supported_platform?() :: boolean()

Checks if the current platform is supported.

supported_platforms()

@spec supported_platforms() :: [String.t()]

Returns platforms that ExMaude can identify and use with a configured, locally installed, or system-provided Maude executable.

This is broader than mix maude.install availability. Official stable Maude release assets currently cover macOS arm64/x64 and Linux x64; Linux arm64 callers must provide a compatible executable.

version()

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

Returns the version associated with checkout-local development assets.

Use ExMaude.version/0 to query the interpreter that will actually run.