Hex v0.20.0 mix hex.package View Source
Fetches or diffs packages.
Fetch a package tarball to the current directory.
mix hex.package fetch PACKAGE VERSION [--unpack]
mix hex.package diff PACKAGE VERSION1..VERSION2
This command fetches package tarballs for both versions, unpacks them into temporary directories and runs a diff command. Afterwards, the temporary directories are automatically deleted.
Note, similarly to when tarballs are fetched with
hex_metadata.config is placed in each unpacked directory.
This file contains package's metadata as Erlang terms and so
we can additionally see the diff of that.
The exit code of the task is that of the underlying diff command.
The diff command can be customized by setting
configuration option, see
mix help config for more information.
The default diff command is:
git diff --no-index __PATH1__ __PATH2__
__PATH2__ placeholders will be interpolated with
paths to directories of unpacked tarballs for each version.
Many diff commands supports coloured output but becase we execute the command in non-interactive mode, they'd usually be disabled.
On Unix systems you can pipe the output to more commands, for example:
`mix hex.package diff decimal 1.0.0..1.1.0 | colordiff | less -R`
Here, the output of
mix hex.package diff is piped to the
utility to adds colours, which in turn is piped to
less -R which
"pages" it. (
-R preserves escape codes which allows colours to work.)
Another option is to configure the diff command itself. For example, to
force Git to always colour the output we can set the
mix hex.config diff_command "git diff --color=always --no-index __PATH1__ __PATH2__" mix hex.package diff decimal 1.0.0..1.1.0
--unpack- Unpacks the tarball after fetching it
--organization ORGANIZATION- Set this for private packages belonging to an organization