Skip to content

Commit

Permalink
add bat scripts for bootstrap and rebat (windows doesn't understand s…
Browse files Browse the repository at this point in the history
…hebang), make bootstrap work on windows
  • Loading branch information
juranki committed Aug 2, 2010
1 parent de716e1 commit 8a5eea5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
24 changes: 18 additions & 6 deletions bootstrap
Expand Up @@ -13,11 +13,9 @@ main(Args) ->
%% Check for force=1 flag to force a rebuild
case lists:member("force=1", Args) of
true ->
[] = os:cmd("rm -rf ebin/*.beam"),
ok;
rm("ebin/*.beam");
false ->
os:cmd("rm -f ebin/rebar_core.beam"),
ok
rm("ebin/rebar_core.beam")
end,

%% Compile all src/*.erl to ebin
Expand Down Expand Up @@ -69,13 +67,27 @@ main(Args) ->
end,

%% Finally, update executable perms for our script
[] = os:cmd("chmod u+x rebar"),

case os:type() of
{unix,_} ->
[] = os:cmd("chmod u+x rebar"),
ok;
_ ->
ok
end,

%% Add a helpful message
io:format("Congratulations! You now have a self-contained script called \"rebar\" in\n"
"your current working directory. Place this script anywhere in your path\n"
"and you can use rebar to build OTP-compliant apps.\n").

rm(Path) ->
NativePath = filename:nativename(Path),
Cmd = case os:type() of
{unix,_} -> "rm -f ";
{win32,_} -> "del /q "
end,
[] = os:cmd(Cmd ++ NativePath),
ok.

build_time() ->
{{Y, M, D}, {H, Min, S}} = calendar:now_to_universal_time(now()),
Expand Down
2 changes: 2 additions & 0 deletions bootstrap.bat
@@ -0,0 +1,2 @@
@echo off
escript.exe bootstrap %*
2 changes: 2 additions & 0 deletions rebar.bat
@@ -0,0 +1,2 @@
@echo off
escript.exe rebar %*

0 comments on commit 8a5eea5

Please sign in to comment.