Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved Windows Support.

  • Loading branch information...
commit abfbfc248eac19384f94ec8d92658538e8921727 1 parent ef8c7f3
@rambocoder rambocoder authored
View
8 Makefile
@@ -10,17 +10,9 @@ SESSION_CONFIG_DIR=priv/test_session_config
all:
@$(REBAR) get-deps
@$(REBAR) compile
- $(ERL) -pa ebin -pa deps/*/ebin \
- -eval 'erlydtl:compile("src/boss/boss_html_error_template.dtl", boss_html_error_template, [{out_dir, "ebin"}])' \
- -eval 'erlydtl:compile("src/boss/boss_html_doc_template.dtl", boss_html_doc_template, [{out_dir, "ebin"}])' \
- -noshell -s init stop
boss:
@$(REBAR) compile skip_deps=true
- $(ERL) -pa ebin -pa deps/*/ebin \
- -eval 'erlydtl:compile("src/boss/boss_html_error_template.dtl", boss_html_error_template, [{out_dir, "ebin"}])' \
- -eval 'erlydtl:compile("src/boss/boss_html_doc_template.dtl", boss_html_doc_template, [{out_dir, "ebin"}])' \
- -noshell -s init stop
clean:
@$(REBAR) clean
View
36 priv/rebar/boss_rebar.erl
@@ -135,11 +135,20 @@ start_dev_cmd(_RebarConf, BossConf, AppFile) ->
rebar_log:log(info, "Generating dynamic start-dev command~n", []),
AppName = app_name(AppFile),
- EbinDirs = all_ebin_dirs(BossConf, AppFile),
SName = sname(BossConf, AppFile),
+ case os:type() of
+ {win32, _ } ->
+ EbinDirs = all_ebin_dirs(windows, BossConf, AppFile),
+ Dirs = io_lib:format("~p", [lists:flatten(EbinDirs)]), %EbinDirs come back as a list of lists [[],[],[]]
+ Cmd = io_lib:format("werl -pa ~s -boss developing_app ~s -boot start_sasl -config boss -s reloader -s boss -sname ~s",
+ [string:join(lists:append(EbinDirs), " -pa "), AppName, SName]),
+ io:format("~s~n", [Cmd]);
+ _ ->
+ EbinDirs = all_ebin_dirs(BossConf, AppFile),
+ io:format("exec erl -pa ~s -boss developing_app ~s -boot start_sasl -config boss -s reloader -s boss -sname ~s",
+ [string:join(EbinDirs, " -pa "), AppName, SName])
- io:format("exec erl -pa ~s -boss developing_app ~s -boot start_sasl -config boss -s reloader -s boss -sname ~s",
- [string:join(EbinDirs, " -pa "), AppName, SName]),
+ end,
ok.
%%--------------------------------------------------------------------
@@ -324,6 +333,27 @@ all_ebin_dirs(BossConf, _AppFile) ->
end end, [], lists:reverse(BossConf)).
%%--------------------------------------------------------------------
+%% @doc Start the boss app
+%% @spec all_ebin_dirs(windows, BossConf, _AppFile)
+%% Gets the exact path name of all deps ebin dirs
+%% for the apps defined in boss.config for Windows
+%% @end
+%%--------------------------------------------------------------------
+all_ebin_dirs(windows, BossConf, _AppFile) ->
+ lists:foldl(fun({_App, Config}, EbinDirs) ->
+ case lists:keyfind(path, 1, Config) of
+ false -> EbinDirs;
+ {path, Path} ->
+ MainEbin = filename:join([Path, "ebin"]),
+ filelib:ensure_dir(filename:join([MainEbin, "foobar"])),
+ DepsEbins = case file:list_dir(Path++"/deps") of
+ {ok, Dirs} -> lists:map(fun(Dir) -> Path ++ "/deps/" ++ Dir ++ "/ebin" end, Dirs);
+ {error, _Reason} -> []
+ end,
+ [lists:append([MainEbin] , DepsEbins) | EbinDirs] % DepsEbins is a list, while MainEbin is a string
+ end end, [], lists:reverse(BossConf)).
+
+%%--------------------------------------------------------------------
%% @doc Injects the boss.conf configuration to the boss application
%% @spec init_conf(BossConf)
%% @end
View
BIN  rebar
Binary file not shown
View
4 rebar.cmd
@@ -0,0 +1,4 @@
+@echo off
+setlocal
+set rebarscript=%~f0
+escript.exe "%rebarscript:.cmd=%" %*
View
6 rebar.config
@@ -8,3 +8,9 @@
{mochiweb, ".*", {git, "git://github.com/mochi/mochiweb.git", {tag, "v2.3.0"}}},
{poolboy, ".*", {git, "git://github.com/devinus/poolboy.git", {tag, "855802e0cc"}}}
]}.
+{erlydtl_opts, [
+ {doc_root, "src/boss"},
+ {out_dir, "ebin"},
+ {source_ext, ".dtl"},
+ {module_ext, ""}
+ ]}.
View
1  skel.template
@@ -34,6 +34,7 @@
{file, "skel/init.sh", "{{dest}}/init.sh"}.
{file, "skel/init-dev.sh", "{{dest}}/init-dev.sh"}.
{file, "skel/rebar", "{{dest}}/rebar"}.
+{file, "skel/rebar.cmd", "{{dest}}/rebar.cmd"}.
{file, "skel/rebar.config", "{{dest}}/rebar.config"}.
{chmod, 8#755, "{{dest}}/init.sh"}.
{chmod, 8#755, "{{dest}}/init-dev.sh"}.
View
BIN  skel/rebar
Binary file not shown
View
4 skel/rebar.cmd
@@ -0,0 +1,4 @@
+@echo off
+setlocal
+set rebarscript=%~f0
+escript.exe "%rebarscript:.cmd=%" %*
View
5 skel/start-server.bat
@@ -1,2 +1,3 @@
-make
-erl -pa ebin -boot start_sasl -config boss -s reloader -s boss
+@ECHO OFF
+FOR /F "tokens=*" %%i in ('"rebar.cmd boss c=start_dev_cmd ^| findstr werl"') do set myvar=%%i
+START "Erlang Window" %myvar%
View
52 windows-make.bat
@@ -0,0 +1,52 @@
+@ECHO OFF
+REM @echo 1st:%1 2nd:%2 3rd:%3 4th:%4
+
+SET PWD=%cd%
+SET APPNAME=%3
+for %%* in (.) do set PARENTDIR=%%~n*
+
+IF /I [%1] EQU [] CALL :all
+IF /I "%1"=="all" CALL :all
+IF /I "%1"=="boss" CALL :boss
+IF /I "%1"=="clean" CALL :clean
+IF /I "%1"=="get-deps" CALL :get-deps
+IF /I "%1"=="deps" CALL :deps
+IF /I "%1"=="test" CALL :test
+IF /I "%1"=="app" IF /I "%2"=="project" IF [%3] NEQ [] CALL :app
+
+:: End of main program
+GOTO End
+
+
+:all
+CALL rebar.cmd get-deps
+CALL rebar.cmd compile
+GOTO :EOF
+
+:boss
+CALL rebar.cmd compile skip_deps=true
+GOTO :EOF
+
+:clean
+CALL rebar.cmd clean
+GOTO :EOF
+
+:get-deps
+CALL rebar.cmd get-deps
+GOTO :EOF
+
+:deps
+CALL rebar.cmd compile
+GOTO :EOF
+
+:test
+CALL rebar.cmd skip_deps=true eunit
+GOTO :EOF
+
+:: example how to invoke: windows-make.bat app PROJECT=awesomename
+:app
+CALL rebar.cmd create template=skel dest=../%APPNAME% src=../%PARENTDIR% appid=%APPNAME% skip_deps=true
+GOTO :EOF
+
+:End
+:: End of batch file
Please sign in to comment.
Something went wrong with that request. Please try again.