diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-07-27 18:36:31 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-08-16 07:22:27 -0500 |
commit | eb8fa02df7d71435a879de987b3139bb5bffb963 (patch) | |
tree | e3ac360353b37811be1a3775d986e4a3ceab16e2 /src/rebar_escripter.erl | |
parent | 19c215ee9fe0726a1983b36f4f8bcc21d42a5ef8 (diff) |
large refactoring
Removed separate compilers
Resolves apps to build
Finds avail deps before pulling/building
Includes relx
Simplifies build commands
Diffstat (limited to 'src/rebar_escripter.erl')
-rw-r--r-- | src/rebar_escripter.erl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/rebar_escripter.erl b/src/rebar_escripter.erl index 0cc43ef..395475f 100644 --- a/src/rebar_escripter.erl +++ b/src/rebar_escripter.erl @@ -26,6 +26,11 @@ %% ------------------------------------------------------------------- -module(rebar_escripter). +-behaviour(rebar_provider). + +-export([init/1, + do/1]). + -export([escriptize/2, clean/2]). @@ -35,10 +40,33 @@ -include("rebar.hrl"). -include_lib("kernel/include/file.hrl"). +-define(PROVIDER, escriptize). +-define(DEPS, [app_builder]). + %% =================================================================== %% Public API %% =================================================================== +-spec init(rebar_config:config()) -> {ok, rebar_config:config()}. +init(State) -> + State1 = rebar_config:add_provider(State, #provider{name = ?PROVIDER, + provider_impl = ?MODULE, + provides = escriptize, + bare = false, + deps = ?DEPS, + example = "escriptize", + short_desc = "", + desc = "", + opts = []}), + {ok, State1}. + +-spec do(rebar_config:config()) -> {ok, rebar_config:config()} | relx:error(). +do(Config) -> + AppName = rebar_config:get_local(Config, escript_top_level_app, undefined), + App = rebar_config:get_app(Config, AppName), + {ok, Config1} = escriptize(Config, rebar_app_info:app_file(App)), + {ok, Config1}. + escriptize(Config0, AppFile) -> %% Extract the application name from the archive -- this is the default %% name of the generated script |