简体   繁体   English

package Elixir CLI 应用程序的最佳方法是什么?

[英]What is the best way to package Elixir CLI application?

Suppose I have a CLI application with subcommands and arguments (like application foo --bar baz ).假设我有一个带有子命令和 arguments 的 CLI 应用程序(如application foo --bar baz )。 How can I package it for distribution without requiring user to install Erlang?如何在不需要用户安装 Erlang 的情况下进行 package 分发?

I know there's mix escript Mix task, but it builds a binary that requires Erlang to be installed, also Mix reference states that escripts should be used only for development purposes.我知道有mix escript Mix 任务,但它构建了一个需要安装 Erlang 的二进制文件,并且 Mix 参考声明 escripts 只能用于开发目的。 mix release , however, produces redundant shell scripts that I don't want to see in dist.但是mix release会产生多余的 shell 脚本,我不想在 dist 中看到这些脚本。

So, is there a way to make a standalone distributable of an Elixir CLI application?那么,有没有办法让 Elixir CLI 应用程序独立分发?

PS This is actually my first experience with Elixir (and the whole Erlang ecosystem) PS 这实际上是我对 Elixir(以及整个 Erlang 生态系统)的第一次体验

Elixir applications can be packaged asErlang releases , see also here . Elixir 应用程序可以打包为Erlang 版本,另请参见此处 These can include Erlang VM.这些可以包括 Erlang VM。 Elixir since 1.9 supports building releases without extra tooling, using included mix task mix release - please check the documentation for greasy details: https://hexdocs.pm/mix/Mix.Tasks.Release.html Elixir 从 1.9 开始支持在没有额外工具的情况下构建版本,使用包含的混合任务mix release - 请查看文档以了解详细信息: https://hexdocs.pm/mix/Mix.Tasks.Release.ZFC35FDC70D5FC69D5A266

You might benefit from a quick look at this blog post for inspiration and conceptual overview, noticing that for simple CLI app it is much simpler: https://www.cogini.com/blog/best-practices-for-deploying-elixir-apps/您可能会从快速浏览这篇博文中获得灵感和概念概述中受益,并注意到对于简单的 CLI 应用程序来说它要简单得多: https://www.cogini.com/blog/best-practices-for-deploying-elixir-应用/

Bakeware generates a single executable file. Bakeware生成单个可执行文件。

They have added a CLI app example here .他们在这里添加了一个 CLI 应用程序示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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