View Source BeamMeta.Release.Otp (BeamMeta v0.2.1)

Functions for retrieving information related to Erlang/OTP releases.

This module does not deal with releases prior to version OTP 17.

Link to this section Summary

Types

A map that information related to a release in GitHub.

An Erlang/OTP release version.

A release version requirement.

Functions

Returns a map with only final releases since Erlang/OTP 17.

Returns the latest stable Erlang/OTP version.

Returns a map with all the prereleases since Erlang/OTP 17.

Returns a map which contains all the information that we find relevant from releases data.

Returns a filtered map from releases_data/0 that matches the otp_version_requirement and options.

Convert an Erlang/OTP version to the original string representation.

Returns a list with all the Erlang/OTP versions since OTP 17.

Returns a list versions since Erlang/OTP 17, according to kind.

Link to this section Types

Specs

asset() :: :doc_html | :doc_man | :readme | :tarball | :win32 | :win64

Specs

asset_data() :: %{
  content_type: mime_type :: String.t(),
  name: file_name :: String.t(),
  url: String.t()
}

Specs

release_data() ::
  BeamMeta.nonempty_keyword(
    version_key :: atom(),
    %{
      optional(:assets) => BeamMeta.nonempty_keyword(asset(), asset_data()),
      :created_at => DateTime.t(),
      optional(:id) => pos_integer(),
      optional(:json_url) => BeamMeta.url(),
      :latest? => boolean(),
      optional(:prerelease?) => boolean(),
      optional(:published_at) => DateTime.t(),
      optional(:tarball_url) => BeamMeta.url(),
      optional(:url) => BeamMeta.url(),
      :version => version(),
      optional(:zipball_url) => BeamMeta.url()
    }
  )

A map that information related to a release in GitHub.

This information is originally provided by BeamLangsMetaData.otp_releases/0 and is transformed.

Specs

version() :: Version.t() | String.t()

An Erlang/OTP release version.

For example: #Version<24.2.0> or "24.2".

Specs

version_requirement() :: Version.Requirement.t() | String.t()

A release version requirement.

It could it be a Version.Requirement.t/0 or a string representation of this one, for example: #Version.Requirement<"~> 24.0"> or "~> 1.13".

Link to this section Functions

Specs

final_releases() :: release_data()

Returns a map with only final releases since Erlang/OTP 17.

Examples

> BeamMeta.Release.Otp.releases()
[
  "24.0-rc3": %{
    created_at: ~U[2021-04-21 10:00:17Z],
    id: 41767908,
    json_url: "https://api.github.com/repos/erlang/otp/releases/41767908",
    latest?: false,
    prerelease?: true,
    published_at: ~U[2021-04-21 10:31:19Z],
    tarball_url: "https://api.github.com/repos/erlang/otp/tarball/OTP-24.0-rc3",
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.0-rc3",
    version: #Version<24.0.0-rc3>,
    zipball_url: "https://api.github.com/repos/erlang/otp/zipball/OTP-24.0-rc3"
  },
  ...
  "20.3.8.9": %{
    created_at: ~U[2018-09-11 13:14:17Z],
    latest?: true,
    version: #Version<20.3.8-9>
  },
  ...
]

Specs

latest_version() :: version()

Returns the latest stable Erlang/OTP version.

Examples

> BeamMeta.Release.Otp.latest_version()
#Version<24.2.0>

Specs

prereleases() :: release_data()

Returns a map with all the prereleases since Erlang/OTP 17.

Examples

> BeamMeta.Release.Otp.prereleases()
[
  "24.0-rc3": %{
    created_at: ~U[2021-04-21 10:00:17Z],
    id: 41767908,
    json_url: "https://api.github.com/repos/erlang/otp/releases/41767908",
    latest?: false,
    prerelease?: true,
    published_at: ~U[2021-04-21 10:31:19Z],
    tarball_url: "https://api.github.com/repos/erlang/otp/tarball/OTP-24.0-rc3",
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.0-rc3",
    version: #Version<24.0.0-rc3>,
    zipball_url: "https://api.github.com/repos/erlang/otp/zipball/OTP-24.0-rc3"
  },
  "24.0-rc2": %{
    created_at: ~U[2021-03-26 07:38:27Z],
    id: 40524774,
    json_url: "https://api.github.com/repos/erlang/otp/releases/40524774",
    latest?: false,
    prerelease?: true,
    published_at: ~U[2021-03-26 08:05:13Z],
    tarball_url: "https://api.github.com/repos/erlang/otp/tarball/OTP-24.0-rc2",
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.0-rc2",
    version: #Version<24.0.0-rc2>,
    zipball_url: "https://api.github.com/repos/erlang/otp/zipball/OTP-24.0-rc2"
  },
  ...
]

Specs

release_data() :: release_data()

Returns a map which contains all the information that we find relevant from releases data.

Includes data from final releases and preseleases starting from OTP 17.

Examples

> BeamMeta.Release.Otp.release_data()
[
   "17.0": %{
    assets: [
      doc_html: %{
        content_type: "application/gzip",
        name: "otp_doc_html_17.0.tar.gz",
        url: "https://erlang.org/download/otp_doc_html_17.0.tar.gz"
      },
      doc_man: %{
        content_type: "application/gzip",
        name: "otp_doc_man_17.0.tar.gz",
        url: "https://erlang.org/download/otp_doc_man_17.0.tar.gz"
      },
      win32: %{
        content_type: "application/octet-stream",
        name: "otp_win32_17.0.exe",
        url: "https://erlang.org/download/otp_win32_17.0.exe"
      },
      win64: %{
        content_type: "application/octet-stream",
        name: "otp_win64_17.0.exe",
        url: "https://erlang.org/download/otp_win64_17.0.exe"
      }
    ],
    latest?: false,
    version: #Version<17.0.0>
  },
  "17.0.1": %{latest?: false, version: #Version<17.0.1>},
  "17.0.2": %{latest?: false, version: #Version<17.0.2>},
  "17.1": %{
    assets: [
      doc_html: %{...},
      doc_man: %{...},
      win32: %{...},
      win64: %{...},
    ],
    latest?: false,
    version: #Version<17.1.0>
  },
  ...,
  "24.1.7": %{
    assets: [
      doc_html: %{...},
      doc_man: %{...},
      win32: %{...},
      win64: %{...},
    ],
    latest?: false,
    published_at: ~U[2021-11-22 09:04:55Z], 
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.1.7",
    version: #Version<24.1.7>
  },
  "24.2": %{
    assets: [
      doc_html: %{...},
      doc_man: %{...},
      win32: %{...},
      win64: %{...},
    ],
    latest?: true,
    published_at: ~U[2021-12-15 14:31:36Z],
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.2",
    version: #Version<24.2.0>
  }
]
Link to this function

release_data(otp_version_requirement, options \\ [])

View Source

Returns a filtered map from releases_data/0 that matches the otp_version_requirement and options.

options are options supported by Version.match?/3. Currently the only supported key is :allow_pre which accepts true or false values. Defaults to true. Note the currently no prereleases are listed in the release_data/0, so this option has no effect.

See releases_data/0 for more information.

Examples

> BeamMeta.Release.Otp.release_data("~> 24.1") 
[
  "24.2": %{
    assets: [
      doc_html: %{
        content_type: "application/gzip",
        name: "otp_doc_html_24.2.tar.gz",
        url: "https://github.com/erlang/otp/releases/download/OTP-24.2/otp_doc_html_24.2.tar.gz"
      },
      doc_man: %{
        content_type: "application/gzip",
        name: "otp_doc_man_24.2.tar.gz",
        url: "https://github.com/erlang/otp/releases/download/OTP-24.2/otp_doc_man_24.2.tar.gz"
      },
      win32: %{
        content_type: "application/octet-stream",
        name: "otp_win32_24.2.exe",
        url: "https://github.com/erlang/otp/releases/download/OTP-24.2/otp_win32_24.2.exe"
      },
      win64: %{
        content_type: "application/octet-stream",
        name: "otp_win64_24.2.exe",
        url: "https://github.com/erlang/otp/releases/download/OTP-24.2/otp_win64_24.2.exe"
      }
    ],
    latest?: true,
    published_at: ~U[2021-12-15 14:31:36Z],
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.2",
    version: #Version<24.2.0>
  },
  "24.1.7": %{
    assets: [
      doc_html: %{...},
      doc_man: %{...},
      win32: %{...},
      win64: %{...},
    ],
    latest?: false,
    published_at: ~U[2021-11-22 09:04:55Z],
    url: "https://github.com/erlang/otp/releases/tag/OTP-24.1.7",
    version: #Version<24.1.7>
  },
  "24.1.6": %{...},
  "24.1.5": %{...},
  "24.1.4": %{...},
  "24.1.3": %{...},
  "24.1.2": %{...},
  "24.1.1": %{...},
  "24.1": %{...},
]
Link to this function

to_original_string(version)

View Source

Specs

to_original_string(Version.t()) :: String.t()

Convert an Erlang/OTP version to the original string representation.

Examples

iex> Version.parse!("23.3.4-10") |> BeamMeta.Release.Otp.to_original_string()
"23.3.4.10"

iex> Version.parse!("23.3.4-10.3") |> BeamMeta.Release.Otp.to_original_string()
"23.3.4.10.3"

iex> Version.parse!("25.0.0-rc0") |> BeamMeta.Release.Otp.to_original_string()
"25.0.0-rc0"

Specs

versions() :: [version(), ...]

Returns a list with all the Erlang/OTP versions since OTP 17.

The list contains the versions in string format, sorted ascendenly.

Examples:

> BeamMeta.Release.Otp.versions()
["17.0", "17.0.1", "17.0.2", "17.1", "17.1.1", "17.1.2", "17.2", "17.2.1",
 "17.2.2", "17.3", "17.3.1", "17.3.2", "17.3.3", "17.3.4", "17.4", "17.4.1",
 "17.5", "17.5.1", "17.5.2", "17.5.3", "17.5.4", "17.5.5", "17.5.6", ...]

Specs

versions(BeamMeta.release_kind()) :: [Version.t()]

Returns a list versions since Erlang/OTP 17, according to kind.

The list contains the versions in the Version.t/0 format, sorted ascendenly.

kind can be:

  • :release
  • :prerelease

Examples

> BeamMeta.Release.Otp.versions(:release)

> BeamMeta.Release.Otp.versions(:prerelease)