|
@ -31,12 +31,9 @@ |
|
|
is_app_dir/0, is_app_dir/1, |
|
|
is_app_dir/0, is_app_dir/1, |
|
|
is_app_src/1, |
|
|
is_app_src/1, |
|
|
app_src_to_app/1, |
|
|
app_src_to_app/1, |
|
|
app_name/2, |
|
|
|
|
|
app_applications/2, |
|
|
|
|
|
|
|
|
load_app_file/2, |
|
|
app_vsn/2]). |
|
|
app_vsn/2]). |
|
|
|
|
|
|
|
|
-export([load_app_file/2]). % TEMPORARY |
|
|
|
|
|
|
|
|
|
|
|
-include("rebar.hrl"). |
|
|
-include("rebar.hrl"). |
|
|
|
|
|
|
|
|
%% =================================================================== |
|
|
%% =================================================================== |
|
@ -94,24 +91,6 @@ app_src_to_app(Filename) -> |
|
|
filelib:ensure_dir(AppFile), |
|
|
filelib:ensure_dir(AppFile), |
|
|
AppFile. |
|
|
AppFile. |
|
|
|
|
|
|
|
|
app_name(Config, AppFile) -> |
|
|
|
|
|
case load_app_file(Config, AppFile) of |
|
|
|
|
|
{ok, NewConfig, AppName, _} -> |
|
|
|
|
|
{NewConfig, AppName}; |
|
|
|
|
|
{error, Reason} -> |
|
|
|
|
|
?ABORT("Failed to extract name from ~s: ~p\n", |
|
|
|
|
|
[AppFile, Reason]) |
|
|
|
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
app_applications(Config, AppFile) -> |
|
|
|
|
|
case load_app_file(Config, AppFile) of |
|
|
|
|
|
{ok, NewConfig, _, AppInfo} -> |
|
|
|
|
|
{NewConfig, get_value(applications, AppInfo, AppFile)}; |
|
|
|
|
|
{error, Reason} -> |
|
|
|
|
|
?ABORT("Failed to extract applications from ~s: ~p\n", |
|
|
|
|
|
[AppFile, Reason]) |
|
|
|
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
app_vsn(Config, AppFile) -> |
|
|
app_vsn(Config, AppFile) -> |
|
|
case load_app_file(Config, AppFile) of |
|
|
case load_app_file(Config, AppFile) of |
|
|
{ok, Config1, _, AppInfo} -> |
|
|
{ok, Config1, _, AppInfo} -> |
|
@ -123,10 +102,6 @@ app_vsn(Config, AppFile) -> |
|
|
[AppFile, Reason]) |
|
|
[AppFile, Reason]) |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
%% =================================================================== |
|
|
|
|
|
%% Internal functions |
|
|
|
|
|
%% =================================================================== |
|
|
|
|
|
|
|
|
|
|
|
load_app_file(_State, undefined) -> {error, missing_app_file}; |
|
|
load_app_file(_State, undefined) -> {error, missing_app_file}; |
|
|
load_app_file(State, Filename) -> |
|
|
load_app_file(State, Filename) -> |
|
|
AppFile = {app_file, Filename}, |
|
|
AppFile = {app_file, Filename}, |
|
@ -147,6 +122,10 @@ load_app_file(State, Filename) -> |
|
|
{ok, State, AppName, AppData} |
|
|
{ok, State, AppName, AppData} |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
%% =================================================================== |
|
|
|
|
|
%% Internal functions |
|
|
|
|
|
%% =================================================================== |
|
|
|
|
|
|
|
|
%% In the case of *.app.src we want to give the user the ability to |
|
|
%% In the case of *.app.src we want to give the user the ability to |
|
|
%% dynamically script the application resource file (think dynamic version |
|
|
%% dynamically script the application resource file (think dynamic version |
|
|
%% string, etc.), in a way similar to what can be done with the rebar |
|
|
%% string, etc.), in a way similar to what can be done with the rebar |
|
|