erlang-rebar/rebar-0012-Try-shell-variab...

23 lines
860 B
Diff
Raw Normal View History

From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sun, 6 Mar 2016 01:25:36 +0300
Subject: [PATCH] Try shell variable VSN first
Try shell variable VSN first before substituting version placeholder in
app-file.
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 348d06d..47975cb 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -268,7 +268,7 @@ vcs_vsn(Config, Vsn, Dir) ->
Cache = rebar_config:get_xconf(Config, vsn_cache),
case dict:find(Key, Cache) of
error ->
- VsnString = vcs_vsn_1(Vsn, Dir),
+ VsnString = case os:getenv("VSN") of false -> vcs_vsn_1(Vsn, Dir); V -> V end,
Cache1 = dict:store(Key, VsnString, Cache),
Config1 = rebar_config:set_xconf(Config, vsn_cache, Cache1),
{Config1, VsnString};