From 9441251f9fa7e214a35abd1b4d4eef85d4dc35c3 Mon Sep 17 00:00:00 2001 From: Juhani Rankimies Date: Sun, 26 Dec 2010 13:56:17 +0100 Subject: Use file:change_mode/2 instead of invoking chmod --- src/rebar_escripter.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/rebar_escripter.erl') diff --git a/src/rebar_escripter.erl b/src/rebar_escripter.erl index f2870d3..20f5e66 100644 --- a/src/rebar_escripter.erl +++ b/src/rebar_escripter.erl @@ -30,6 +30,7 @@ clean/2]). -include("rebar.hrl"). +-include_lib("kernel/include/file.hrl"). %% =================================================================== %% Public API @@ -70,7 +71,8 @@ escriptize(Config, AppFile) -> end, %% Finally, update executable perms for our script - [] = os:cmd(?FMT("chmod u+x ~p", [Filename])), + {ok, #file_info{mode = Mode}} = file:read_file_info(Filename), + ok = file:change_mode(Filename, Mode bor 8#00100), ok. clean(Config, AppFile) -> -- cgit v1.1 From c466076ffb5a1ea4c00d49fefff0dcfbceb58236 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 31 Jan 2011 17:43:31 +0100 Subject: Clean up emacs file local variables --- src/rebar_escripter.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rebar_escripter.erl') diff --git a/src/rebar_escripter.erl b/src/rebar_escripter.erl index 20f5e66..5ee95e9 100644 --- a/src/rebar_escripter.erl +++ b/src/rebar_escripter.erl @@ -1,4 +1,4 @@ -%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- %% ex: ts=4 sw=4 et %% ------------------------------------------------------------------- %% -- cgit v1.1 From 63de05d914f3c2bef6dcfc6cf966400d93c9c80d Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 28 Jan 2011 16:08:27 +0100 Subject: Clean up code --- src/rebar_escripter.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/rebar_escripter.erl') diff --git a/src/rebar_escripter.erl b/src/rebar_escripter.erl index 5ee95e9..8b23263 100644 --- a/src/rebar_escripter.erl +++ b/src/rebar_escripter.erl @@ -48,7 +48,8 @@ escriptize(Config, AppFile) -> %% Look for a list of other applications (dependencies) to include %% in the output file. We then use the .app files for each of these %% to pull in all the .beam files. - InclBeams = get_app_beams(rebar_config:get_local(Config, escript_incl_apps, []), []), + InclBeams = get_app_beams( + rebar_config:get_local(Config, escript_incl_apps, []), []), %% Construct the archive of everything in ebin/ dir -- put it on the %% top-level of the zip file so that code loading works properly. @@ -62,11 +63,13 @@ escriptize(Config, AppFile) -> ok -> ok; {error, WriteError} -> - ?ERROR("Failed to write ~p script: ~p\n", [AppName, WriteError]), + ?ERROR("Failed to write ~p script: ~p\n", + [AppName, WriteError]), ?FAIL end; {error, ZipError} -> - ?ERROR("Failed to construct ~p escript: ~p\n", [AppName, ZipError]), + ?ERROR("Failed to construct ~p escript: ~p\n", + [AppName, ZipError]), ?FAIL end, @@ -94,9 +97,11 @@ get_app_beams([], Acc) -> get_app_beams([App | Rest], Acc) -> case code:lib_dir(App, ebin) of {error, bad_name} -> - ?ABORT("Failed to get ebin/ directory for ~p escript_incl_apps.", [App]); + ?ABORT("Failed to get ebin/ directory for " + "~p escript_incl_apps.", [App]); Path -> - Acc2 = [{filename:join([App, ebin, F]), file_contents(filename:join(Path, F))} || + Acc2 = [{filename:join([App, ebin, F]), + file_contents(filename:join(Path, F))} || F <- filelib:wildcard("*", Path)], get_app_beams(Rest, Acc2 ++ Acc) end. -- cgit v1.1