Elixir或Hex便携式包装格式? [英] Elixir or Hex portable package format?

查看:75
本文介绍了Elixir或Hex便携式包装格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

e剂代码是否有任何可移植格式?除了明显的tar。

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

例如,如果我想为一个客户或另一个团队的其他开发人员提供一个或多个模块(不使用github)。我该怎么办?

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?

其他一些熟悉的语言的答案是:Ruby-gem,Java-jar,Python-egg等。

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是最佳选择,因为它也知道如何获取和解决依赖关系。调用 mix local.hex 进行安装,然后调用 mix local 查看所有可用的十六进制任务;

  • 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 允许您将整个项目(包括依赖项)捆绑到一个可执行文件中,该可执行文件可以从命令行调用。您需要安装Erlang才能运行脚本,但是不需要安装Elixir。请注意,Escript 不能被其他项目用作依赖项。

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.

存档基本上是已编译工件的tar,Erlang运行时知道如何加载。存档不包含依赖项,在Elixir中,它们仅用作Mix构建工具的插件。例如,上面的Hex作为存档安装在Mix中。

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.

这篇关于Elixir或Hex便携式包装格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆