There's rarely a need to restart the whole Erlang application. Reloading changed modules is a more common use-case and it is usually enough to apply your changes. Regarding application start: if your application depends on other applications, application:start() will fail, until you start all the dependencies. Because of that, it is common to write a helper function <your-app-name>:start() . Here's an example . Another useful function is <your-app-name>:stop() . With all these techniques applied, a workflow would look like this:
Start the Erlang shell and keep it open; type <your-app-name>:start().
Make changes; run compilation; type l() in your Erlang shell.
When changes require application restart, type <your-app-name>:stop(), <your-app-name>:start().
4条答案
按热度按时间57hvy0tb1#
Here's my setup:
make
in the source directory.l()
in Erlang shell. You can find this and some other useful macros here: http://www.snookles.com/erlang/user_default.erlThere's rarely a need to restart the whole Erlang application. Reloading changed modules is a more common use-case and it is usually enough to apply your changes.
Regarding application start: if your application depends on other applications, application:start() will fail, until you start all the dependencies. Because of that, it is common to write a helper function
<your-app-name>:start()
. Here's an example . Another useful function is<your-app-name>:stop()
.With all these techniques applied, a workflow would look like this:
<your-app-name>:start().
l()
in your Erlang shell.<your-app-name>:stop(), <your-app-name>:start().
dfddblmv2#
你可以把rebar看作是一个构建工具。
make:all/0
和整个make模块也可以提供帮助。要从shell显式地重新加载模块,你可以使用l(Module)
。最后,你可能还对创建一个Erlang release来“ Package ”所有的Erlang应用程序感兴趣。xjreopfe3#
编辑和编译是由我使用的IDE(带erlide的Eclispe)完成的。
我还创建了一个脚本来启动我的应用程序和有用的工具。这个脚本只用于开发时间。
为了重新加载修改过的源代码和编译过的bin,我使用了mochiweb的reloader。reloader观察bin目录,如果有修改,它会加载模块并运行eunit测试,如果你有一些内部的话。
示例:
erl +A 5 +K true -name @127.0.0.1 -pa $PWD/ebin $PWD/test $PWD/deps/*/ebin -boot start_sasl -s reloader -s toolbar -s
cyej8jka4#
你也可以尝试一下erlbuild。Erlbuild是一个简单的应用程序,它会在src目录中查找更改过的源文件,如果找到了一些文件,它会编译并再次加载模块。加载完模块后,erlbuild会运行模块的测试。
您可以在以下位置找到该项目:https://github.com/ulfa/erlbuild
超低频(~ U)