summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuhani Rankimies <juhani@juranki.com>2010-08-02 20:35:26 +0300
committerJuhani Rankimies <juhani@juranki.com>2010-08-02 20:35:26 +0300
commit8a5eea5ef1d9d2cb8275044a1a3071bd80adef03 (patch)
tree27c5e63ce2c146b3a31d6165d8250876a332ce79
parentde716e18524355ad406fba34f99be07f5206dbbd (diff)
add bat scripts for bootstrap and rebat (windows doesn't understand shebang), make bootstrap work on windows
-rwxr-xr-xbootstrap24
-rw-r--r--bootstrap.bat2
-rw-r--r--rebar.bat2
3 files changed, 22 insertions, 6 deletions
diff --git a/bootstrap b/bootstrap
index 1772864..e7f32ca 100755
--- a/bootstrap
+++ b/bootstrap
@@ -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
@@ -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()),
diff --git a/bootstrap.bat b/bootstrap.bat
new file mode 100644
index 0000000..b646a7d
--- /dev/null
+++ b/bootstrap.bat
@@ -0,0 +1,2 @@
+@echo off
+escript.exe bootstrap %*
diff --git a/rebar.bat b/rebar.bat
new file mode 100644
index 0000000..6b97b00
--- /dev/null
+++ b/rebar.bat
@@ -0,0 +1,2 @@
+@echo off
+escript.exe rebar %*