Plumb.Args (plumb v0.2.4)

Copy Markdown View Source

Parses the arguments mix publish takes.

Kept apart from the task so the decisions are pure and testable: what the task then does with them touches git, the filesystem and Hex.

Summary

Functions

The checks that run before a release, in the order they run.

The checks named by --skip, or [] when it was not given.

The release step named by the positional arguments.

Types

step()

@type step() :: :major | :minor | :patch | :current | {:version, String.t()}

Functions

checks()

@spec checks() :: [String.t()]

The checks that run before a release, in the order they run.

iex> Plumb.Args.checks()
["readme", "format", "test", "docs"]

skipped(list)

@spec skipped(String.t() | nil) :: {:ok, [String.t()]} | {:error, String.t()}

The checks named by --skip, or [] when it was not given.

Returns {:error, message} naming any check that does not exist, rather than silently running it.

Examples

iex> Plumb.Args.skipped("format, docs")
{:ok, ["format", "docs"]}

iex> Plumb.Args.skipped(nil)
{:ok, []}

step(arg1)

@spec step([String.t()]) :: {:ok, step()} | {:error, String.t()}

The release step named by the positional arguments.

:current releases the version already in mix.exs rather than bumping — for a run that bumped, committed, tagged and pushed, then failed to upload.

Examples

iex> Plumb.Args.step(["minor"])
{:ok, :minor}

iex> Plumb.Args.step(["current"])
{:ok, :current}

iex> Plumb.Args.step(["1.2.3"])
{:ok, {:version, "1.2.3"}}