Permalink
Browse files

Better rebar templating support. Including makefile target, readme do…

…cs and doesn't require you to make your own toplevel directory.
  • Loading branch information...
1 parent f39619c commit 99957246bdec7f76c615f6070609fe45bcdda576 David Reid committed Nov 11, 2010
View
@@ -1,3 +1,7 @@
+
+PREFIX:=../
+DEST:=$(PREFIX)$(APPID)
+
REBAR=./rebar
all:
@@ -17,3 +21,7 @@ build_plt:
dialyzer:
@$(REBAR) analyze
+
+app:
+ @$(REBAR) create template=mochiwebapp dest=$(DEST) appid=$(APPID)
+
View
8 README
@@ -1 +1,9 @@
MochiWeb is an Erlang library for building lightweight HTTP servers.
+
+MochiWeb uses rebar templates to make getting started easy.
+
+To create a new app use:
+ make app APPID=project_name
+
+To create a new app in a specific directory:
+ make app APPID=project_name PREFIX=$HOME/projects/
View
BIN rebar
Binary file not shown.
View
@@ -2,4 +2,4 @@
{erl_opts, [debug_info]}.
{cover_enabled, true}.
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
-{template_dir, "support/mochiapp/"}.
+{template_dir, "support/templates/"}.
@@ -1,21 +0,0 @@
-%% -*- erlang -*-
-{variables, [{appid, "mochiapp"},
- {author, "Mochi Media <dev@mochimedia.com>"},
- {year, "2010"},
- {version, "0.01"},
- {port, 8080},
- {dest, "{{appid}}"}]}.
-{dir, "{{appid}}"}.
-{template, "src/mochiapp.app.src", "{{dest}}/src/{{appid}}.app.src"}.
-{template, "src/mochiapp.erl", "{{dest}}/src/{{appid}}.erl"}.
-{template, "src/mochiapp_app.erl", "{{dest}}/src/{{appid}}_app.erl"}.
-{template, "src/mochiapp_deps.erl", "{{dest}}/src/{{appid}}_deps.erl"}.
-{template, "src/mochiapp_sup.erl", "{{dest}}/src/{{appid}}_sup.erl"}.
-{template, "src/mochiapp_web.erl", "{{dest}}/src/{{appid}}_web.erl"}.
-{template, "start-dev.sh", "{{dest}}/start-dev.sh"}.
-{file, "../../.gitignore", "{{dest}}/.gitignore"}.
-{file, "../../Makefile", "{{dest}}/Makefile"}.
-{file, "rebar.config", "{{dest}}/rebar.config"}.
-{file, "../../rebar", "{{dest}}/rebar"}.
-{chmod, 8#755, "{{dest}}/rebar"}.
-{chmod, 8#755, "{{dest}}/start-dev.sh"}.
@@ -0,0 +1,21 @@
+%% -*- erlang -*-
+{variables, [{appid, "mochiwebapp"},
+ {author, "Mochi Media <dev@mochimedia.com>"},
+ {year, "2010"},
+ {version, "0.1"},
+ {port, 8080},
+ {dest, "{{appid}}"}]}.
+{dir, "{{dest}}"}.
+{template, "mochiwebapp_skel/src/mochiapp.app.src", "{{dest}}/src/{{appid}}.app.src"}.
+{template, "mochiwebapp_skel/src/mochiapp.erl", "{{dest}}/src/{{appid}}.erl"}.
+{template, "mochiwebapp_skel/src/mochiapp_app.erl", "{{dest}}/src/{{appid}}_app.erl"}.
+{template, "mochiwebapp_skel/src/mochiapp_deps.erl", "{{dest}}/src/{{appid}}_deps.erl"}.
+{template, "mochiwebapp_skel/src/mochiapp_sup.erl", "{{dest}}/src/{{appid}}_sup.erl"}.
+{template, "mochiwebapp_skel/src/mochiapp_web.erl", "{{dest}}/src/{{appid}}_web.erl"}.
+{template, "mochiwebapp_skel/start-dev.sh", "{{dest}}/start-dev.sh"}.
+{file, "../../.gitignore", "{{dest}}/.gitignore"}.
+{file, "../../Makefile", "{{dest}}/Makefile"}.
+{file, "mochiwebapp_skel/rebar.config", "{{dest}}/rebar.config"}.
+{file, "../../rebar", "{{dest}}/rebar"}.
+{chmod, 8#755, "{{dest}}/rebar"}.
+{chmod, 8#755, "{{dest}}/start-dev.sh"}.
View

0 comments on commit 9995724

Please sign in to comment.