commit
49bc69e35a
3 changed files with 19 additions and 24 deletions
|
@ -24,7 +24,7 @@
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%% This should be opaque, but that kills dialyzer so for now we export it
|
%% This should be opaque, but that kills dialyzer so for now we export it
|
||||||
%% however you should not rely on the internal representation here
|
%% however you should not rely on the internal representation here
|
||||||
-type t() :: {string()}.
|
-type t() :: {}.
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% API
|
%%% API
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
-spec new() -> t().
|
-spec new() -> t().
|
||||||
new() ->
|
new() ->
|
||||||
{"v"}.
|
{}.
|
||||||
|
|
||||||
-spec vsn(t()) -> {ok, string()} | {error, Reason::any()}.
|
-spec vsn(t()) -> {ok, string()} | {error, Reason::any()}.
|
||||||
vsn(Data) ->
|
vsn(Data) ->
|
||||||
|
@ -85,15 +85,15 @@ get_patch_count(RawRef) ->
|
||||||
os:cmd(Cmd).
|
os:cmd(Cmd).
|
||||||
|
|
||||||
-spec parse_tags(t()) -> {string()|undefined, ec_semver:version_string()}.
|
-spec parse_tags(t()) -> {string()|undefined, ec_semver:version_string()}.
|
||||||
parse_tags({Prefix}) ->
|
parse_tags(_) ->
|
||||||
first_valid_tag(os:cmd("git log --oneline --decorate | grep -F \"tag: \""), Prefix).
|
first_valid_tag(os:cmd("git log --oneline --decorate | grep -F \"tag: \"")).
|
||||||
%% TODO: The following command sould be able to get the version
|
%% TODO: The following command sould be able to get the version
|
||||||
%% number directly, without a re:run. Should be checked for POSIX
|
%% number directly, without a re:run. Should be checked for POSIX
|
||||||
%% "git log --oneline --decorate | grep -F \"tag: \" --color=never | head -n 1 | sed \"s/.*tag: " ++ Prefix ++ "\([^,)]*\).*/\1/\"".
|
%% "git log --oneline --decorate | grep -F \"tag: \" --color=never | head -n 1 | sed \"s/.*tag: v?\([^,)]*\).*/\1/\"".
|
||||||
|
|
||||||
-spec first_valid_tag(string(), string()) -> {string()|undefined, ec_semver:version_string()}.
|
-spec first_valid_tag(string()) -> {string()|undefined, ec_semver:version_string()}.
|
||||||
first_valid_tag(Line, Prefix) ->
|
first_valid_tag(Line) ->
|
||||||
RE = lists:flatten(io_lib:format("(\\(|\\s)tag:\\s(~s([^,\\)]+))", [Prefix])),
|
RE = "(\\(|\\s)tag:\\s(v?([^,\\)]+))",
|
||||||
case re:run(Line, RE, [{capture, [2, 3], list}]) of
|
case re:run(Line, RE, [{capture, [2, 3], list}]) of
|
||||||
{match,[Tag, Vsn]} ->
|
{match,[Tag, Vsn]} ->
|
||||||
{Tag, Vsn};
|
{Tag, Vsn};
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
%% -*- mode: Erlang; fill-column: 75; comment-column: 50; -*-
|
|
||||||
{application,erlware_commons,
|
{application,erlware_commons,
|
||||||
[{description,"Additional standard library for Erlang"},
|
[{description,"Additional standard library for Erlang"},
|
||||||
{vsn, "0.15.0"},
|
{vsn,"0.16.0"},
|
||||||
{modules,[]},
|
{modules,[]},
|
||||||
{registered,[]},
|
{registered,[]},
|
||||||
{applications,[kernel,stdlib]},
|
{applications,[kernel,stdlib]},
|
||||||
|
|
||||||
{contributors,["Eric Merritt","Tristan Sloughter",
|
{contributors,["Eric Merritt","Tristan Sloughter",
|
||||||
"Jordan Wilberding","Martin Logan"]},
|
"Jordan Wilberding","Martin Logan"]},
|
||||||
{licenses,["Apache"]},
|
{licenses,["Apache"]},
|
||||||
{links, [{"Github","https://github.com/erlware/erlware_commons"}]}
|
{links,[{"Github",
|
||||||
]}.
|
"https://github.com/erlware/erlware_commons"}]}]}.
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
%%% @copyright Erlware, LLC.
|
%%% @copyright Erlware, LLC.
|
||||||
-module(ec_plists_tests).
|
-module(ec_plists_tests).
|
||||||
|
|
||||||
-ifdef(DEV_ONLY).
|
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
|
@ -76,4 +74,3 @@ ftmap_bad_test() ->
|
||||||
?assertMatch([{value, 1}, {error,{throw,test_exception}}, {value, 3},
|
?assertMatch([{value, 1}, {error,{throw,test_exception}}, {value, 3},
|
||||||
{value, 4}, {value, 5}] , Results).
|
{value, 4}, {value, 5}] , Results).
|
||||||
|
|
||||||
-endif.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue