Raxol.System.Updater (Raxol v0.2.0)

View Source

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

Functions

check_for_updates(opts \\ [])

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 to true, bypasses the update check interval. Defaults to false.

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"}

do_replace_executable(current_exe, new_exe, platform)

notify_if_update_available()

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

self_update(version \\ nil, opts \\ [])

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"}

set_auto_check(enabled)

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