Steps To Create Projects
Table of Contents

http://www.metabrew.com/article/erlang-rebar-tutorial-generating-releases-upgrades
http://alancastro.org/2010/05/01/erlang-application-management-with-rebar.html

http://carbonshaft.blogspot.com/2011/11/tutorial-getting-started-with-erlang.html

  • step 1
C:\Users\user\work\suck\>mkdir apps
  • step 2
C:\Users\user\work\suck\>mkdir apps\dummy
  • step 3
C:\Users\user\work\suck\>cd apps\dummy
  • step 4
C:\Users\user\work\suck\apps\dummy>rebar create-app appid=dummy

if you want to start the application for development, update the following two lines into dummy_app.erl

%% export start/0

-export([start/0, start/2,…]).

%% add this line
start() -> application:start(dummy_app).

%% ===================================================================
%% Application callbacks
%% ===================================================================

start(_StartType, _StartArgs) ->
dummy_sup:start_link().

[[/code]]

C:\Users\user\work\suck>erl -pa apps/dummy/ebin -boot start_sasl -s dummy_app
  • step 5

create a new file named rebar.config:

C:\Users\user\work\suck>type .\rebar.config
{sub_dirs, [
            "apps/dummy",
            "rel"
           ]}.
  • step 6
C:\Users\user\work\suck\>rebar compile
  • step 7
C:\Users\user\work\suck\>erl -pa apps/dummy/ebin -s application start dummy

or if you have optional step 4.1

C:\Users\user\work\suck>erl -pa apps/dummy/ebin -boot start_sasl -s dummy_app
  • step 8
C:\Users\user\work\suck\rel\dummynode>rebar create-node nodeid=dummynode
  • step 9

edit the .\rel\reltool.config, please note the changes I made is highlighted with star *

{sys, [
      * {lib_dirs, ["../apps"]}, *
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "dummynode", "1",
        [
         kernel,
         stdlib,
         sasl,
       *  dummy  *
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "dummynode"},
       {profile, embedded},
       {incl_cond, exclude},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
                           "^erts.*/(doc|info|include|lib|man|src)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, sasl,   [{incl_cond, include}]},
       {app, stdlib, [{incl_cond, include}]},
       {app, kernel, [{incl_cond, include}]},
      * {app, dummy, [{incl_cond, include}]} *
      ]}.

{target_dir, "dummynode"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/dummynode", "bin/dummynode"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/dummynode.cmd", "bin/dummynode.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.
  • step 10
C:\Users\user\work\suck>rebar generate
  • step 11
C:\Users\user\work\suck>.\rel\dummynode\bin\dummynode.cmd console
  • step 12

run in admin privilige in a command window:

C:\Users\user\work\suck>.\rel\dummynode\bin\dummynode.cmd install
  • step 13

in a normal window

C:\Users\user\work\suck>.\rel\dummynode\bin\dummynode.cmd start
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License