简体   繁体   中英

Elixir or Hex portable package format?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM