emqx.app.src.script 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. %%-*- mode: erlang -*-
  2. %% .app.src.script
  3. Config = case os:getenv("EMQX_DESC") of
  4. false -> CONFIG; % env var not defined
  5. [] -> CONFIG; % env var set to empty string
  6. Desc ->
  7. [begin
  8. AppConf0 = lists:keystore(description, 1, AppConf, {description, Desc}),
  9. {application, App, AppConf0}
  10. end || Conf = {application, App, AppConf} <- CONFIG]
  11. end,
  12. RemoveLeadingV =
  13. fun(Tag) ->
  14. case re:run(Tag, "^[v|e]?[0-9]\.[0-9]\.([0-9]|(rc|beta|alpha)\.[0-9])", [{capture, none}]) of
  15. nomatch ->
  16. re:replace(Tag, "/", "-", [{return ,list}]);
  17. _ ->
  18. %% if it is a version number prefixed by 'v' or 'e', then remove it
  19. re:replace(Tag, "[v|e]", "", [{return ,list}])
  20. end
  21. end,
  22. case os:getenv("EMQX_DEPS_DEFAULT_VSN") of
  23. false -> Config; % env var not defined
  24. [] -> Config; % env var set to empty string
  25. Tag ->
  26. [begin
  27. AppConf0 = lists:keystore(vsn, 1, AppConf, {vsn, RemoveLeadingV(Tag)}),
  28. {application, App, AppConf0}
  29. end || Conf = {application, App, AppConf} <- Config]
  30. end.