Checks that a README's install snippet still fits the version being released.
A README telling people to depend on ~> 0.1.1 when you have just published
0.2.0 is wrong in a way nothing else catches: the code compiles, the tests
pass, the docs build, and everyone following the instructions silently gets the
old release.
The check runs against the target version rather than the one in mix.exs,
so it fails before the release is written rather than after it is published.
Modes
:satisfies— the target version must satisfy the requirement the README names. Imposes no style, and catches the case where a release falls outside what the README allows at all.:exact— the README must name exactly~> MAJOR.MINORof the target. For a 0.x project, where a minor bump is a breaking change, this is the honest one:~> 0.3tells a reader that0.4.0is a safe upgrade, and it is not.
Summary
Functions
Whether source is fit to publish version of app under mode.
The requirement source names for app, from a {:app, "requirement"} pair.
Types
Functions
Whether source is fit to publish version of app under mode.
Returns :ok, or {:error, message} naming what the README says and what it
should say.
Examples
iex> Plumb.Readme.check(~s|{:drafter, "~> 0.3"}|, :drafter, "0.3.1", :satisfies)
:ok
iex> Plumb.Readme.check(~s|{:drafter, "~> 0.3"}|, :drafter, "0.3.1", :exact)
:ok
The requirement source names for app, from a {:app, "requirement"} pair.
Takes the first occurrence. Returns {:error, message} when the app is not
named at all, which is treated as a failure rather than a pass — a README with
no install snippet cannot be verified.
Examples
iex> Plumb.Readme.requirement(~s|{:drafter, "~> 0.3"}|, :drafter)
{:ok, "~> 0.3"}