It is simple to use this tutorial for creating a minimal Erlang Mochiweb application. Clone the git repository and run make twice.
However, trying to do the same on Fedora 20 using the packages erlang-mochiweb and erlang-rebar wasn't so simple.
While the templates are included in the /usr/lib64/erlang/lib/mochiweb-2.4.2/support directory, it is missing the Makefile. We need to execute the rebar commands instead.
Several lines need to be commented in support/templates/mochiwebapp.template. These correspond to files not included in the erlang-mochiweb rpm package -
$ cd /usr/lib64/erlang/lib/mochiweb- 2.4.2/
$ rebar create template=mochiwebapp dest= appid=
$ cd
$ rebar compile
$ ./start-dev.sh
If successful, browsing localhost:8080 shows the success page.
However, trying to do the same on Fedora 20 using the packages erlang-mochiweb and erlang-rebar wasn't so simple.
While the templates are included in the /usr/lib64/erlang/lib/mochiweb-2.4.2/support directory, it is missing the Makefile. We need to execute the rebar commands instead.
Several lines need to be commented in support/templates/mochiwebapp.template. These correspond to files not included in the erlang-mochiweb rpm package -
%%{file, "../../.gitignore", "{{dest}}/.gitignore"}.The script start-dev.sh fails. Solution is to replace '\\' by '\'. The script becomes:
%%{file, "../../Makefile", "{{dest}}/Makefile"}.
%%{file, "../../rebar", "{{dest}}/rebar"}.
%%{chmod, 8#755, "{{dest}}/rebar"}.
exec erl -pa ebin edit deps/*/ebin -boot start_sasl \Now,
-sname {{appid}}_dev \
-s {{appid}} \
-s reloader
$ cd /usr/lib64/erlang/lib/mochiweb- 2.4.2/
$ rebar create template=mochiwebapp dest=
$ cd
$ rebar compile
$ ./start-dev.sh
If successful, browsing localhost:8080 shows the success page.