mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
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"}}]}. ```
This commit is contained in:
parent
5a0aa04b20
commit
6dfcd8b9f2
1 changed files with 3 additions and 0 deletions
|
@ -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) ->
|
||||
|
|
Loading…
Reference in a new issue