View Source MishkaInstaller.Installer.Downloader (Mishka installer v0.1.0)

The MishkaInstaller.Installer.Downloader module provides functions for downloading packages from various sources such as Hex.pm and GitHub.

It supports different download types and can fetch specific versions or the latest releases. This module also includes functions for retrieving mix.exs files from these sources.

Security considerations

It is important to remember that all of the functionalities contained within this section must be implemented at the high access level, and they should not directly take any input from the user. Ensure that you include the required safety measures.

Summary

Functions

Downloads a package from the specified source.

Retrieves the mix.exs file for the specified package.

Types

@type download_type() ::
  :hex
  | :github
  | :github_latest_release
  | :github_latest_tag
  | :github_release
  | :github_tag
  | :url
@type error_return() ::
  {:error, [%{action: atom(), field: atom(), message: String.t()}]}
@type okey_return() :: {:ok, struct() | map() | binary()}
@type pkg() ::
  %{app: String.t()}
  | %{app: String.t(), tag: String.t()}
  | %{path: String.t()}
  | %{path: String.t(), release: String.t()}
  | %{path: String.t(), tag: String.t()}
  | %{path: String.t(), branch: String.t() | tuple()}

Functions

@spec download(download_type(), pkg()) :: okey_return() | error_return()

Downloads a package from the specified source.

Security considerations

It is important to remember that all of the functionalities contained within this section must be implemented at the high access level, and they should not directly take any input from the user. Ensure that you include the required safety measures.

Example:

download(:hex, %{app: app, tag: tag_name})
download(:github, %{path: path, branch: {branch, git: true}})
download(:github, %{path: path, branch: branch})
download(:github, %{path: path, release: release})
download(:github, %{path: path, tag: tag})
download(:hex, %{app: app})
download(:github, %{path: path})
download(:github_latest_release, %{path: path})
download(:github_latest_tag, %{path: path})
@spec get_mix(download_type(), pkg()) :: okey_return() | error_return()

Retrieves the mix.exs file for the specified package.

Security considerations

It is important to remember that all of the functionalities contained within this section must be implemented at the high access level, and they should not directly take any input from the user. Ensure that you include the required safety measures.

Example:

get_mix(:hex, %{app: app, tag: tag_name})
get_mix(:github_release, %{path: path, release: tag_name})
get_mix(:github_tag, %{path: path, tag: tag_name})
get_mix(:hex, %{app: app})
get_mix(:github, %{path: path})
get_mix(:github_latest_release, %{path: path})
get_mix(:github_latest_tag, %{path: path})
get_mix(:url, %{path: path})