Safe.Version (mix_safe v1.0.0)

Copy Markdown View Source

Version resolution and lock file management for the SAFE binary.

Resolves the SAFE binary version against a semver constraint, reads/writes the safe.lock file (JSON format).

Summary

Functions

Returns true if the version satisfies the ~> 1.5.0 constraint.

Returns the semver constraint used to resolve SAFE binary versions.

Returns the mix_safe plugin version (compiled from mix.exs at build time).

Reads the pinned SAFE version from <project_dir>/safe.lock.

Picks the latest stable version from versions_map (a map of version string => platform checksums) that satisfies the constraint. Pre-releases are excluded.

Writes the pinned SAFE version to <project_dir>/safe.lock in JSON format.

Functions

compatible?(version_string)

Returns true if the version satisfies the ~> 1.5.0 constraint.

constraint()

Returns the semver constraint used to resolve SAFE binary versions.

plugin_version()

Returns the mix_safe plugin version (compiled from mix.exs at build time).

read_lock(project_dir)

Reads the pinned SAFE version from <project_dir>/safe.lock.

Returns {:ok, version_string} or {:error, :not_found}.

resolve_version(versions_map)

Picks the latest stable version from versions_map (a map of version string => platform checksums) that satisfies the constraint. Pre-releases are excluded.

write_lock(project_dir, version)

Writes the pinned SAFE version to <project_dir>/safe.lock in JSON format.