enable the rebar semver plugin on erlware_commons

Signed-off-by: Jordan Wilberding <diginux@gmail.com>
This commit is contained in:
Eric Merritt 2012-10-19 18:22:03 -05:00 committed by Jordan Wilberding
parent 1540fb1652
commit c4887e2021
3 changed files with 7 additions and 24 deletions

View file

@ -3,7 +3,9 @@
%% Dependencies ================================================================
{deps, [{neotoma, "",
{git, "https://github.com/seancribbs/neotoma.git", {branch, master}}},
{proper, "", {git, "https://github.com/manopapad/proper.git", {branch, master}}}]}.
{proper, "", {git, "https://github.com/manopapad/proper.git", {branch, master}}},
{rebar_vsn_plugin, ".*", {git, "https://github.com/erlware/rebar_vsn_plugin.git",
{branch, "master"}}}]}.
{erl_first_files, ["ec_dictionary"]}.
@ -18,3 +20,6 @@
{cover_enabled, true}.
{cover_print_enabled, true}.
%% Rebar Plugins ==============================================================
{plugins, [rebar_vsn_plugin]}.

View file

@ -1,7 +1,7 @@
%% -*- mode: Erlang; fill-column: 75; comment-column: 50; -*-
{application, erlware_commons,
[{description, "Additional standard library for Erlang"},
{vsn, git},
{vsn, "semver"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib]}]}.

View file

@ -1,22 +0,0 @@
%% -*- mode: Erlang; erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 80 -*-
[{application, AppName, Details0}] = CONFIG,
%% Get the tag timestamp and minimal ref from the system. The
%% timestamp is really important from an ordering perspective.
{ok, RawRef} = rebar_utils:sh("git log -n 1 --pretty=format:'%ct.%h\n' .", []),
{ok, RawTag} = rebar_utils:sh("git describe --always --abbrev=0 --tags "
"`git log -n 1 --pretty=format:%h .`", []),
%% Cleanup the tag and the Ref information. Basically leading 'v's and
%% whitespace needs to go away.
Tag = re:replace(RawTag, "(^v)|\\s", "", [global]),
Ref = re:replace(RawRef, "\\s", "", [global]),
%% Create the valid [semver](http://semver.org) version from the tag
Vsn = erlang:binary_to_list(erlang:iolist_to_binary([Tag, "+build.", Ref])),
%% Replace the old version with the new one
Details1 = lists:keyreplace(vsn, 1, Details0, {vsn, Vsn}),
[{application, AppName, Details1}].