A simple OTP application generated using rebar.
-
Download and compile Rebar
hg clone ssh://hg@bitbucket.org/basho/rebar
-
Compile the SampleApp
$ rebar compile
==> mysample_app (compile)
Compiled src/mysample_app.erl
Compiled src/mysample_sup.erl
Compiled src/mysample_server.erl
==> rel (compile)
==> otp_rebar_sample (compile)
-
Create a rebar release
$ rebar generate ==> rel (generate)
-
Make the application executable
$ chmod u+x rel/mysample/bin/mysample
$ ./rel/mysample/bin/mysample
Usage: mysample {start|stop|restart|reboot|ping|console|attach}
-
Startup the application
$ ./rel/mysample/bin/mysample console
...
Eshell V5.8.4 (abort with ^G)
(mysample@127.0.0.1)1>
-
Check everything works
(mysample@127.0.0.1)1> application:which_applications().
[{mysample_app,[],[]},
{sasl,"SASL CXC 138 11","2.1.9.4"},
{stdlib,"ERTS CXC 138 10","1.17.4"},
{kernel,"ERTS CXC 138 10","2.14.4"}]
(mysample@127.0.0.1)2> mysample_server:start_link().
{ok,<0.54.0>}
(mysample@127.0.0.1)3> mysample_server:say_hello().
Hello from server!
ok
Some useful resources for understanding Rebar: