diff options
author | Tim Watson <watson.timothy@gmail.com> | 2011-10-06 07:55:56 +0100 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-10-11 11:23:23 +0200 |
commit | 6dfcd8b9f2b1fa73575c353b37e7b7d2e77fa5be (patch) | |
tree | caee132cc8813358ef68d12ef04c64ef1732bb5f /src | |
parent | 5a0aa04b20cbb56022a7af1e8eee6ee32e668083 (diff) |
Support for custom version commands
This patch adds support for customising the way in which rebar generates
version numbers for app.src files using the `{vsn,Spec}` approach.
Whilst the existing `{vsn,ScmName::atom()}` syntax will continue to
work, users can also pass `{vsn,{cmd,Cmd::string()}}` in which
case the provided *command* will be used. For example:
```erlang
{application, doodah,
[
{vsn, {cmd, "git rev-parse --short HEAD"}}]}.
```
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_app_utils.erl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index e2b5508..1281752 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -139,6 +139,8 @@ vcs_vsn(Vcs, Dir) -> {unknown, VsnString} -> ?DEBUG("vcs_vsn: Unknown VCS atom in vsn field: ~p\n", [Vcs]), VsnString; + {cmd, CmdString} -> + vcs_vsn_invoke(CmdString, Dir); Cmd -> %% If there is a valid VCS directory in the application directory, %% use that version info @@ -173,6 +175,7 @@ vcs_vsn_cmd(git) -> vcs_vsn_cmd(hg) -> "hg identify -i"; vcs_vsn_cmd(bzr) -> "bzr revno"; vcs_vsn_cmd(svn) -> "svnversion"; +vcs_vsn_cmd({cmd, _Cmd}=Custom) -> Custom; vcs_vsn_cmd(Version) -> {unknown, Version}. vcs_vsn_invoke(Cmd, Dir) -> |