Minga.Extension.Updater (Minga v0.1.0)

Copy Markdown View Source

Orchestrates extension update checks, application, and rollback.

The update lifecycle has two phases:

  1. Check (background Task): fetch remote changes for all extensions, build a list of available updates, and send it to the Editor to enter confirmation mode.

  2. Apply (after user confirms): for each accepted update, fast-forward git repos or reinstall hex packages, recompile, and rollback on failure.

All check functions run in a background Task so they don't block the editor. Results are communicated back via Minga.Events broadcasts.

Summary

Types

Result of a single extension update attempt.

Functions

Applies the accepted updates from the confirmation dialog.

Checks for updates on all extensions and sends results to the Editor for confirmation. Designed to run in a background Task.

Checks for updates on a single extension by name and sends results to the Editor for confirmation. Designed to run in a background Task.

Gets the git log details for an extension (for the d key in confirmation).

Types

update_result()

@type update_result() ::
  {:updated, atom(), String.t(), String.t()}
  | {:up_to_date, atom()}
  | {:rolled_back, atom(), String.t()}
  | {:error, atom(), String.t()}

Result of a single extension update attempt.

Functions

apply_accepted(extension_confirm_state)

@spec apply_accepted(Minga.Mode.ExtensionConfirmState.t()) :: :ok

Applies the accepted updates from the confirmation dialog.

Takes the confirmation state and applies updates for each accepted index. Runs in a background Task. Results are posted to Messages.

check_all()

@spec check_all() :: :ok

Checks for updates on all extensions and sends results to the Editor for confirmation. Designed to run in a background Task.

Fetches remote changes for git extensions and checks version info for hex extensions, then sends an :extension_updates_available message to the Editor with the update list.

check_single(name)

@spec check_single(atom()) :: :ok

Checks for updates on a single extension by name and sends results to the Editor for confirmation. Designed to run in a background Task.

details(name)

@spec details(atom()) :: String.t()

Gets the git log details for an extension (for the d key in confirmation).

Returns a formatted string of recent commit messages.