Raxol.System.Updater (Raxol v0.4.0)
View SourceProvides version management and self-update functionality for Raxol.
This module handles:
- Checking for updates from GitHub releases
- Comparing versions to determine if updates are available
- Self-updating the application when running as a compiled binary
- Managing update settings and configurations
Summary
Functions
Checks if a newer version of Raxol is available.
Displays update information to the user, if an update is available.
Performs a self-update of the application if running as a compiled binary.
Enables or disables automatic update checks.
Checks for updates and applies them if available.
Functions
Checks if a newer version of Raxol is available.
Returns a tuple with the check result and the latest version if available:
{:no_update, current_version}
- No update available{:update_available, latest_version}
- Update available{:error, reason}
- Error occurred during check
Parameters
force
: When set totrue
, bypasses the update check interval. Defaults tofalse
.
Examples
iex> Raxol.System.Updater.check_for_updates()
{:no_update, "0.1.0"}
iex> Raxol.System.Updater.check_for_updates(force: true)
{:update_available, "0.2.0"}
Displays update information to the user, if an update is available.
This function checks for updates (respecting the check interval) and outputs a message to the user if an update is available.
Examples
iex> Raxol.System.Updater.notify_if_update_available()
:ok
Performs a self-update of the application if running as a compiled binary.
Returns:
:ok
- Update successfully completed{:error, reason}
- Error occurred during update{:no_update, current_version}
- No update needed
Parameters
version
: The version to update to. If not provided, updates to the latest version.opts
: Options for the update process::use_delta
: Whether to try using delta updates (default: true)
Examples
iex> Raxol.System.Updater.self_update()
:ok
iex> Raxol.System.Updater.self_update("0.2.0")
{:error, "Not running as a compiled binary"}
Enables or disables automatic update checks.
Parameters
enabled
: Whether to enable or disable automatic update checks
Examples
iex> Raxol.System.Updater.set_auto_check(true)
:ok
iex> Raxol.System.Updater.set_auto_check(false)
:ok
Checks for updates and applies them if available.
Options
:force
(boolean): Force update check, bypassing interval.:use_delta
(boolean): Use delta updates if available (default: true).:version
(string): Update to a specific version (default: latest).
Returns
:ok
if update was successful.{:no_update, version}
if already up to date.{:error, reason}
if an error occurred.