Raxol.System.Updater (Raxol v2.0.1)

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

cancel_update()

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

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear_update_error()

clear_update_history()

clear_update_log()

clear_update_stats()

default_update_settings()

download_update(version)

get_available_versions()

get_current_version()

get_update_error()

get_update_history()

get_update_log()

get_update_progress()

get_update_settings()

get_update_stats()

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

handle_manager_info(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.

handle_no_update(context, arg)

install_update(context, version)

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

rollback_update()

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

set_update_settings(settings)

start_link(init_opts \\ [])

update(opts \\ [])