Skip to content

Commit

Permalink
Merge branch 'release/2.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
lrascao committed Jan 30, 2019
2 parents 7244851 + 3d3c468 commit dbd74c2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]

## [2.4.3] - 30-01-2019
### Added
### Changed
### Fixed
- [(fix) Add -n parameter to accept release name](https://github.com/lrascao/rebar3_appup_utils/pull/58)
- [filter map spec list](https://github.com/lrascao/rebar3_appup_utils/pull/56)

## [2.4.2] - 16-12-2018
### Added
### Changed
Expand Down
17 changes: 4 additions & 13 deletions src/rebar3_appup_generate.erl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ init(State) ->
{bare, true}, % The task can be run by the user, always true
{deps, ?DEPS}, % The list of dependencies
{opts, [ % list of options understood by the plugin
{relname, $n, "relname", string, "Release name"},
{previous, $p, "previous", string, "location of the previous release"},
{previous_version, $p, "previous_version", string, "version of the previous release"},
{current, $c, "current", string, "location of the current release"},
Expand Down Expand Up @@ -87,7 +88,7 @@ do(State) ->
PluginInfo = rebar3_appup_utils:appup_plugin_appinfo(Apps),
PluginDir = rebar_app_info:dir(PluginInfo),

Name = get_release_name(State),
Name = rebar3_appup_utils:get_release_name(State),
rebar_api:debug("release name: ~p", [Name]),

%% check for overload of the current release
Expand Down Expand Up @@ -655,6 +656,8 @@ diff_supervisor_spec(_, _) ->
supervisor_spec_workers([], Acc) -> Acc;
supervisor_spec_workers([{_, {Mod, _F, _A}, _, _, worker, _} | Rest], Acc) ->
supervisor_spec_workers(Rest, Acc ++ [Mod]);
supervisor_spec_workers([#{start := {Mod, _F, _A}, type := worker} | Rest], Acc) ->
supervisor_spec_workers(Rest, Acc ++ [Mod]);
supervisor_spec_workers([_ | Rest], Acc) ->
supervisor_spec_workers(Rest, Acc).

Expand Down Expand Up @@ -729,18 +732,6 @@ get_current_rel_path(State, Name) ->
Path -> Path
end.

-spec get_release_name(State) -> Res when
State :: rebar_state:t(),
Res :: string().
get_release_name(State) ->
RelxConfig = rebar_state:get(State, relx, []),
case lists:keyfind(release, 1, RelxConfig) of
{release, {Name0, _Ver}, _} ->
atom_to_list(Name0);
{release, {Name0, _Ver}, _, _} ->
atom_to_list(Name0)
end.

%%------------------------------------------------------------------------------
%%
%% Add pre and post instructions to the instuctions created by appup generate.
Expand Down
2 changes: 1 addition & 1 deletion src/rebar3_appup_plugin.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
%% -------------------------------------------------------------------
{application, rebar3_appup_plugin, [
{description, "A rebar3 plugin for handling .appup files"},
{vsn, "2.4.2"},
{vsn, "2.4.3"},
{registered, []},
{applications,
[
Expand Down
8 changes: 1 addition & 7 deletions src/rebar3_appup_tar.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
%% @spec do(rebar_state:t()) -> {'ok',rebar_state:t()} | {'error',string()}.
do(State) ->
RelxConfig = rebar_state:get(State, relx, []),
Name = case lists:keyfind(release, 1, RelxConfig) of
{release, {Name0, _Ver}, _} ->
atom_to_list(Name0);
{release, {Name0, _Ver}, _, _} ->
atom_to_list(Name0)
end,
Name = rebar3_appup_utils:get_release_name(State),
rebar_api:debug("release name: ~p", [Name]),

RelDir = filename:join([rebar_dir:base_dir(State),
Expand Down
11 changes: 10 additions & 1 deletion src/rebar3_appup_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
%% -------------------------------------------------------------------
-module(rebar3_appup_utils).

-export([prop_check/3,
-export([get_release_name/1,
prop_check/3,
make_proplist/2,
find_files/3,
find_files_by_ext/2, find_files_by_ext/3,
Expand All @@ -35,6 +36,14 @@
find_app_by_name/2,
vsn/1]).

-spec get_release_name(State) -> Res when
State :: rebar_state:t(),
Res :: string().
get_release_name(State) ->
RelxConfig = rebar_state:get(State, relx, []),
{release, {Name0, _Ver}, _} = lists:keyfind(release, 1, RelxConfig),
atom_to_list(Name0).

%% Helper function for checking values and aborting when needed
%% @spec prop_check(boolean(),_,_) -> any().
prop_check(true, _, _) -> true;
Expand Down

0 comments on commit dbd74c2

Please sign in to comment.