Reputation: 135
I would like to write a standalone Erlang application which could be run just like any other program (by clicking on .exe executable). Something like Wings3D does.
How can I do it ? What is the best approach to make it possible ? I am on Windows platform, if it is important.
2nd UPDATE:
Well, I haven't exported the promodb:start/0
function and that was the reason Erlang could'n start (and, as the Muzaaya Joshua says, werl -s
does not work). But now, I have another strange problem. In my rebar.config
I have 2 dependencies:
{deps, [
{cowboy, ".*", {git, "https://github.com/extend/cowboy.git"}},
{erlydtl, ".*", {git, "https://github.com/evanmiller/erlydtl.git"}}
]
}.
and after I start Erlang using
erl -pa ebin deps/cowboy/ebin deps/erlydtl/ebin deps/proper/ebin -s promodb
I find by application:which_application() that only Cowboy is started:
[{cowboy,"Small, fast, modular HTTP server.","0.4.0"},
{stdlib,"ERTS CXC 138 10","1.18"},
{kernel,"ERTS CXC 138 10","2.15"}]
As far as I know, Erlang should start all needed applications that I put in my promodb.app
file, as:
{application, promodb,
[
{description, ""},
{vsn, "0.1"},
{registered, [promodb_sup]},
{applications, [
kernel,
stdlib,
cowboy,
erlydtl
]},
{mod, { promodb, []}},
{env, []}
]}.
What did I do wrong ?
Upvotes: 3
Views: 3133
Reputation: 420
Erlydtl doesn't have an application behaviour, it works like a library. As you can see in erlydtl examples, no app is needed to be started.
https://github.com/evanmiller/erlydtl#template-compilation
Check this:
erl -pa ebin deps/*/ebin
1> erlydtl:compile(<<"{{ foo }}">>, my_module_name).
Does it works?
I like escriptize rebar option to create executables.
Upvotes: 1
Reputation: 124
I use rebar escriptize
to pack a standalone package like rebar. Then you can use ./PackageName
in linux or escript.exe PackageName
in windows.
Upvotes: 3
Reputation: 7836
Actually the -s
option works everywhere. Just use erl
NOT . The werl
werl
command attempts to load a GUI on Windows.
The BitRock Install Builder is a great tool you need to check out. Yaws Web Server written in Erlang, uses it and many other applications.
Upvotes: 1
Reputation: 40374
I think you need to create a release package and a boot script as explained in the documentation.
Upvotes: 2