Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elixir or Hex portable package format?

Tags:

elixir

Is there any portable format for elixir code? Other than the obvious tar.

For example, if I wanted to provide one or more modules to a client or fellow developers on another team (without the use of github). How would I do that?

The answer in some other familiar languages are: Ruby - gem, Java - jar, Python - egg, ect.

like image 810
mgwidmann Avatar asked Jul 01 '14 00:07

mgwidmann


People also ask

What is Hex elixir?

Hex is a package manager for the BEAM ecosystem, any language that compiles to run on the BEAM VM, such as Elixir and Erlang, can be used to build Hex packages. Hex consists of the HTTP API, this website, the repository serving packages and indexes, HexDocs, the Mix build-tool integration, and other services.

What is a hex package?

Hex is package manager for the Erlang VM. This project currently provides tasks that integrate with Mix, Elixir's build tool. See hex.pm for installation instructions and other documentation.


1 Answers

It depends on what you want to provide.

I will discuss three options below, all available through our build tool called Mix.

  • Hex packages source files. If you want to provide code for other developers to use in their projects, Hex is the best option because it knows how to fetch and resolve dependencies too. Call mix local.hex to install it and then mix local to see all available Hex tasks;

  • Escript allows you to bundle your whole project (including dependencies) into an executable that can be invoked from the command line. You need to have Erlang installed for escripts to work, you don't need to have Elixir installed though. Note an Escript cannot be used as a dependency by other projects.

  • Archives are basically a tar of compiled artifacts that the Erlang runtime knows how to load. Archives do not include dependencies and, in Elixir, they are used only as plugins for the Mix build tool. For example, Hex above is installed as an archive inside Mix.

like image 137
José Valim Avatar answered Oct 23 '22 16:10

José Valim