Versioce.PostHook behaviour (Versioce v2.0.0) View Source

Behaviour for post hooks in versioce.

A hook can be defined by simply using Versioce.PostHook in a module:

defmodule MyProj.Versioce.PreHook do
  use Versioce.PostHook

  def run(version) do
    IO.inspect(version)
    {:ok, version}
  end
end

The run/1 function will receive a version that project was bumped to. It can modify it and make required side-effects but it should return it of form {:ok, version} as result of one hook is piped into the next one, unless {:error, reason} is returned, then the hook pipe is halted.

Link to this section Summary

Callbacks

A hook needs to implement run which receives the new version of the project. It should return it in form {:ok, version} | {:error, reason}

Link to this section Callbacks

Specs

run(String.t()) :: {:ok, String.t()} | {:error, String.t()}

A hook needs to implement run which receives the new version of the project. It should return it in form {:ok, version} | {:error, reason}