summaryrefslogtreecommitdiff
path: root/src/rebar3.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-09-07 20:03:08 -0500
committerTristan Sloughter <t@crashfast.com>2015-09-07 22:05:53 -0500
commitda3d8a69cc6467dcb63348dfa02bc4b98f528ca4 (patch)
treee64a7014f58b75335824753247cf69a5230b4a20 /src/rebar3.erl
parentd7f2226d31f4708518c1ddb41f7666f9c1d0f151 (diff)
add providers 'local upgrade' and 'local install' for installing/upgrading
Diffstat (limited to 'src/rebar3.erl')
-rw-r--r--src/rebar3.erl18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 5233f8e..aae9ec0 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -26,7 +26,8 @@
%% -------------------------------------------------------------------
-module(rebar3).
--export([main/1,
+-export([main/0,
+ main/1,
run/1,
run/2,
global_option_spec_list/0,
@@ -42,6 +43,12 @@
%% Public API
%% ====================================================================
+%% For running with:
+%% erl +sbtu +A0 -noinput -mode minimal -boot start_clean -s rebar3 main -extra "$@"
+main() ->
+ List = init:get_plain_arguments(),
+ main(List).
+
%% escript Entry point
-spec main(list()) -> no_return().
main(Args) ->
@@ -146,7 +153,14 @@ init_config() ->
%% resources out of the escript
State1 = try
ScriptName = filename:absname(escript:script_name()),
- rebar_state:escript_path(State, ScriptName)
+ %% Running with 'erl -s rebar3 main' still sets a name for some reason
+ %% so verify it is a real file
+ case filelib:is_regular(ScriptName) of
+ true ->
+ rebar_state:escript_path(State, ScriptName);
+ false ->
+ State
+ end
catch
_:_ ->
State