我搜索package management
上Erlang
和Elixir
并得到了一些指针rebar
rebar3
mix
hex
和relx
等,您可以帮助澄清它们之间的关系?哪里用什么?难道package
只是同义词Erlang的application
组成的modules
?
运行时:
./rebar eunit
Run Code Online (Sandbox Code Playgroud)
测试也针对外部依赖项运行.有没有办法改变这种行为?也许通过rebar.config文件?
我有一个使用Rebar作为构建工具的项目.在开发时,我希望尽可能简单地在shell中编译和加载Rebar.config中指定的所有应用程序依赖项.我在Emacs中使用Erlang shell.什么是快速的方法呢?
这可能吗?
我遇到的关于如何构建和使用Rebar的所有教程都涉及到Unix命令,而且我是一个非常不幸的Windows用户.如果我能帮忙的话,我真的很想避免安装Cygwin.
例如,要构建Rebar,您将获得:
$ git clone git://github.com/rebar/rebar.git
$ cd rebar
$ ./bootstrap
Recompile: src/getopt
...
Recompile: src/rebar_utils
==> rebar (compile)
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
Run Code Online (Sandbox Code Playgroud)
什么是windows-cmd等价物?
下面的任何链接或教程提供有关如何在Windows shell中使用钢筋的分步说明将非常感激.
更新:
手动下载并将Rebar解压缩到我的目录后,位于:C:\ erlang\rebar
我转到windows shell并输入:
SET PATH=C:\Program Files\erl5.10.1\bin
Run Code Online (Sandbox Code Playgroud)
这是位于包含erlang.exe的目录内的'bin'文件夹
接下来我输入:
C:\erlang\rebar>bootstrap.bat
Run Code Online (Sandbox Code Playgroud)
编译了!:)
我是Erlang世界的新手,目前无法弄清楚如何启动我的虚拟erlang应用程序.可能,我只是遗漏了一些东西......所以,我用rebar创建了一个应用程序(rebar create-app appid = dummys).
目前我有
我发现为了在开发期间运行应用程序,最好创建一个应该调用application:start(module)的额外start方法.
我在启动方法中添加了一些基本的日志记录.
start() ->
error_logger:info_msg("Starting app(dev)..~n"),
application:start(dummys_app).
start(_StartType, _StartArgs) ->
error_logger:info_msg("Starting app..~n"),
dummys_sup:start_link().
Run Code Online (Sandbox Code Playgroud)
如果我试试
erl -noshell -pa ebin -s application start dummys
erl -noshell -pa ebin -s application start dummys_app
Run Code Online (Sandbox Code Playgroud)
没有输出..
如果我试试
erl -noshell -pa ebin -s dummys start
Run Code Online (Sandbox Code Playgroud)
erl因错误而崩溃..
如果我试试
erl -noshell -pa ebin -s dummys_app start
Run Code Online (Sandbox Code Playgroud)
它输出的只是" 启动应用程序(开发)... "而这就是全部.但我也希望看到"正在开始使用.. "
我错过了什么或做错了什么?
=============
另一个问题:如何正确地向我的虚拟应用程序添加新模块?例如,我有一个名为"*dummys_cool*"的附加模块,它有一个" 开始 "方法.如何告诉我的应用程序运行"dummys_cool #start"方法?
谢谢!
我是Erlang编程语言的新手.Erlang中是否有标准的构建工具?
我已经搜索了这些,不知道我应该使用哪一个.我不知道它用于什么样的场合?
我一般都是钢筋和二郎的初学者.我试图根据本教程创建一个带有钢筋的erlang版本:http://www.metabrew.com/article/erlang-rebar-tutorial-generating-releases-upgrades并且在运行生成的版本时陷入困境.
我的系统是Ubuntu 11.04 64bit,erlang R14B03,从源头安装.
当我调用'bin/somenode console'时,我收到以下错误之一:
Exec: /home/ghik/Inz/somerel/rel/somenode/erts-5.8.4/bin/erlexec -boot /home/ghik/Inz/somerel/rel/somenode/releases/1/somenode -mode embedded -config /home/ghik/Inz/somerel/rel/somenode/etc/app.config -args_file /home/ghik/Inz/somerel/rel/somenode/etc/vm.args -- console
Root: /home/ghik/Inz/somerel/rel/somenode
{"init terminating in do_boot",{'cannot load',hipe_amd64_encode,get_files}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
Run Code Online (Sandbox Code Playgroud)
有趣的是,每次运行它时,都会列出不同的原子而不是'hipe_amd64_encode',例如:'hipe_amd64_defuse','hipe_amd64_assemble'等等.我猜测erlang无法加载hipe,但我不知道为什么是试图加载它的第一个地方.该版本仅包含一个非常简单的应用程序,仅依赖于内核和stdlib.
出于某种原因,rebar会生成一个带有大量不必要应用程序的.rel文件:
%% rel generated at {2011,9,6} {20,5,48}
{release,{"somenode","1"},
{erts,"5.8.4"},
[{kernel,"2.14.4"},
{stdlib,"1.17.4"},
{sasl,"2.1.9.4"},
{someapp,"1"},
{compiler,"4.7.4",load},
{crypto,"2.0.3",load},
{et,"1.4.3",load},
{gs,"1.5.13",load},
{hipe,"3.8",load},
{inets,"5.6",load},
{mnesia,"4.4.19",load},
{observer,"0.9.9",load},
{public_key,"0.12",load},
{runtime_tools,"1.8.5",load},
{ssl,"4.1.5",load},
{syntax_tools,"1.6.7.1",load},
{tools,"2.6.6.4",load},
{webtool,"0.8.8",load},
{wx,"0.98.10",load}]}.
Run Code Online (Sandbox Code Playgroud)
为什么rebar列表会在.rel文件中列出很多应用程序?事件如果没问题,为什么不发布?
我正在尝试运行rebar generate来为erlang钢筋项目生成一个版本并获得以下错误.我有什么想法我做错了吗?
./rebar generate
Command 'generate' not understood or not applicable
Run Code Online (Sandbox Code Playgroud)
我在OSX上使用erlang版本的Erlang R14B03,下面是我的rebar.conf
{lib_dirs, ["deps"]}.
{sub_dirs, ["rel"]}.
{deps, [
{folsom, ".*", {git, "git://github.com/boundary/folsom", "master"}}
]}.
{require_otp_vsn, "R14|R15"}.
{erl_opts, [
fail_on_warning,
debug_info,
warn_missing_spec
]}.
{clean_files, ["*.eunit", "ebin/*.beam", "rel/graphsom"]}.
{cover_enabled, true}.
{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
Run Code Online (Sandbox Code Playgroud) 关于Erlang的大多数文章和书籍都可以找到专注于创建长期运行的类似服务器的应用程序,而不会覆盖命令行工具创建的过程.
我有一个包含3个应用程序的多应用程序rebar3项目:
myweb
- cowboy
基于Web的服务;mycli
- 准备资产的命令行工具myweb
;mylib
-使用两个图书馆myweb
和mycli
,取决于NIF.由于构建我想得到这样的工件:
我在野外看到的方法之一是创建一个自包含的escript文件.至少rebar
并且relx
这样做.所以我试一试.
优点:
缺点:
mylib
;*.so
文件嵌入到生成的escript文件中,因此无法在运行时加载,因此NIF不起作用(参见erlang rebar escriptize&nifs);rebar3 escriptize
不能很好地处理依赖关系(参见bug 1139).未知数:
构建命令行工具的另一种方法在Fred Hebert 的How I start:Erlang文章中有所描述.
优点:
缺点:
main/1
;未知数:
上述两种方法似乎都不适合我. …
如果我自己编写escript,我可以使用nif,但是当我使用rebar escriptize时,无法找到nif函数.我认为这是因为*.so对象没有像束文件那样被打包.这是一个简单的例子;
rebar.config
:
{deps, [
{'jiffy', "", {git, "https://github.com/davisp/jiffy.git", {branch, master}}}
]}.
{escript_incl_apps, [jiffy]}.
%% I tried this to see what happens if the so got in there but didn't help
{escript_incl_extra, [{"deps/jiffy/priv/jiffy.so", "/path/to/my/proj"}]}.
Run Code Online (Sandbox Code Playgroud)
test.erl
:
-module(test).
-export([main/1]).
main(_Args) ->
jiffy:decode(<<"1">>),
ok.
Run Code Online (Sandbox Code Playgroud)
rebar get-deps compile escriptize ./test
结果是
escript: exception error: undefined function jiffy:decode/1
in function test:main/1 (src/test.erl, line 7)
in call from escript:run/2 (escript.erl, line 741)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_it/1
in …
Run Code Online (Sandbox Code Playgroud)