Skip to content

Commit

Permalink
Merge branch 'release/2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lrascao committed Mar 2, 2018
2 parents b667b01 + 5c2f1bc commit cd464f8
Show file tree
Hide file tree
Showing 14 changed files with 550 additions and 56 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]

## [2.4.0] - 02-03-2018
### Added
- [Merge .appup.pre.src & .appup.post.src files into the generated appup](https://github.com/lrascao/rebar3_appup_utils/pull/31)
- [Add documentation for dependency custom appup files](https://github.com/lrascao/rebar3_appup_utils/pull/33)
- [Add support of custom branches on relapp tests](https://github.com/lrascao/rebar3_appup_utils/pull/32)
### Changed
### Fixed
- [Replace deprecated string:tokens/2](https://github.com/lrascao/rebar3_appup_utils/pull/42)
- [Replace deprecated string:tokens/2 and string:strip/3](https://github.com/lrascao/rebar3_appup_utils/pull/40)
- [Drop unknown behaviours when generating appup](https://github.com/lrascao/rebar3_appup_utils/pull/34)
- [Fetch dep app info from all_deps instead of parsed deps](https://github.com/lrascao/rebar3_appup_utils/pull/26)

## [2.3.0] - 05-12-2017
### Added
* [Add support for appup.src dependency overrides](https://github.com/lrascao/rebar3_appup_utils/pull/19)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rebar3 appup plugin
A rebar3 plugin for handling release upgrades. Supports the following features:
* Automatic generation of the `.appup` file containing instructions necessary to upgrade and downgrade from one release to the other. [More info](doc/UPGRADE_DOWNGRADE.md)
* Validation of any `.appup.src` files that might be present, these are scripts that can contain Erlang code. They are templated, evaluated and their results and written to an `.appup` file that is then moved to the target dir. [More info](doc/APPUP_SRC.md)
* Handles any dependency `.appup.src` files maintained by your application. [More info](doc/CUSTOM_APPUP.md)
* Automatic code injection for `gen_server` state record conversion between versions. [More info](doc/STATE_RECORD_CONVERSION.md)
* Automatically generated module dependencies. [More info](doc/MODULE_DEPENDENCIES.md)

Expand Down
24 changes: 24 additions & 0 deletions doc/CUSTOM_APPUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Providing a custom dependency .appup.src file

There is sometimes the need to provide `.appup` files for external dependencies.

A lot of the times it's not possible to timely integrate the `.appup` pull requests for them, maybe you're not bumping to the latest version and the maintainer is not willing to create a support branch just for you.

The plugin offers a way out of this by searching not only the application's `appup.src` files but others as well, it then processes them as usual and moves to the dependency directory which goes through he usual release upgrade procedure.

Your application will be the one maintaining the `.appup.src` files of dependencies that it's interested in generating release upgrades from, you just keep them alonsing your own `.appup.src`, the name of the file must match the name of the dependency.

You can find an example of this in the [relapp test release](https://github.com/lrascao/relapp1/commit/488b9501d88166ee9792e14ee676469f790384f1), in this case `relapp1` is maintaining a `statsderl.appup.src` file that will be processed and copied to the output of the `statsderl` application:

```
{ "0.5.2",
[{ <<".*">>,
[{restart_application, statsderl}]
}],
[{ <<".*">>,
[{restart_application, statsderl}]
}]
}.
```

Here we're saying that to move from any version to `0.5.2` of the `statsderl` dependency (either upgrading or downgrading) we just restart the application.
26 changes: 26 additions & 0 deletions pr2relnotes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env sh

if [ -z $1 ]
then
echo "pr2relnotes.sh: prints list of pull requests merged since <tag>"
echo " usage: $0 <tag> [pull-request-url (default: https://github.com/lrascao/rebar3_appup_plugin/pull/)]"
exit 0
fi
export url=${2:-"https://github.com/lrascao/rebar3_appup_utils/pull/"}

git log --merges --pretty=medium $1..HEAD | \
awk -v url=$url '
# first line of a merge commit entry
/^commit / {mode="new"}
# merge commit default message
/ +Merge pull request/ {
page_id=substr($4, 2, length($4)-1);
mode="started";
next;
}
# line of content including title
mode=="started" && / [^ ]+/ {
print "- [" substr($0, 5) "](" url page_id ")"; mode="done"
}'
4 changes: 2 additions & 2 deletions priv/templates/appup.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%% appup generated for {{app}} by rebar3_appup_plugin ({{{now}}})
{ "{{{new_vsn}}}",
[{ "{{{old_vsn}}}",
{{upgrade_instructions}} }],
{{{upgrade_instructions}}} }],
[{ "{{{old_vsn}}}",
{{downgrade_instructions}} }]
{{{downgrade_instructions}}} }]
}.
3 changes: 2 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
debug_info]}.

{deps, [
{bbmustache, "1.5.0"}
{bbmustache, "1.5.0"},
string_compat
]}.

{cover_enabled, true}.
Expand Down
6 changes: 4 additions & 2 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{"1.1.0",
[{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.5.0">>},0}]}.
[{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.5.0">>},0},
{<<"string_compat">>,{pkg,<<"string_compat">>,<<"0.0.1">>},0}]}.
[
{pkg_hash,[
{<<"bbmustache">>, <<"8CFDE0602E90A4057E161BF5288ADE854B4E511E2E8924966A8438730E958381">>}]}
{<<"bbmustache">>, <<"8CFDE0602E90A4057E161BF5288ADE854B4E511E2E8924966A8438730E958381">>},
{<<"string_compat">>, <<"90E3196826B84EF8F7F9A0B50007697F1228C0E06A5E64112648D4ABC8CFC452">>}]}
].
6 changes: 1 addition & 5 deletions src/rebar3_appup_compile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ process_app(AppInfo, State) ->
%% this appup.src might pertain to some other
%% application dependency, check for that
Name = list_to_binary(filename:basename(Source, ".appup.src")),
%% fetch this app deps
AppDeps = dict:fetch({parsed_deps,default},
rebar_state:opts(State)),
SourceAppInfo = rebar3_appup_utils:find_app_info(Name,
rebar_state:all_deps(State, AppDeps)),
SourceAppInfo = rebar3_appup_utils:find_app_info(Name, State),
process_appup_src(Source, SourceAppInfo, State);
false -> ok
end
Expand Down

0 comments on commit cd464f8

Please sign in to comment.