mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Rebar3/Mix: If dev profile/environment, enable tools automatically
This commit is contained in:
parent
4431fbbe5a
commit
9275bf40b2
6
mix.exs
6
mix.exs
@ -187,10 +187,14 @@ defmodule Ejabberd.MixProject do
|
|||||||
{:ok, path} ->
|
{:ok, path} ->
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
case :file.consult(filepath) do
|
config2 = case :file.consult(filepath) do
|
||||||
{:ok,config} -> config
|
{:ok,config} -> config
|
||||||
_ -> [stun: true, zlib: true]
|
_ -> [stun: true, zlib: true]
|
||||||
end
|
end
|
||||||
|
case Mix.env() do
|
||||||
|
:dev -> List.keystore(config2, :tools, 0, {:tools, true})
|
||||||
|
_ -> config2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp config(key) do
|
defp config(key) do
|
||||||
|
@ -6,10 +6,22 @@
|
|||||||
{elixir, true} -> [elixir, iex, logger, mix];
|
{elixir, true} -> [elixir, iex, logger, mix];
|
||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
Tools = case lists:keyfind(tools, 1, Terms) of
|
|
||||||
{tools, true} -> [observer]; % for `ejabberdctl etop`
|
ProfileEnvironmentVariable = os:getenv("REBAR_PROFILE"),
|
||||||
|
AsProfiles = case lists:dropwhile(fun("as") -> false; (_) -> true end,
|
||||||
|
init:get_plain_arguments()) of
|
||||||
|
["as", Profiles | _] -> string:split(Profiles, ",");
|
||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
|
Terms2 = case lists:member("dev", [ProfileEnvironmentVariable | AsProfiles]) of
|
||||||
|
true -> lists:keystore(tools, 1, Terms, {tools, true});
|
||||||
|
false -> Terms
|
||||||
|
end,
|
||||||
|
Tools = case lists:keyfind(tools, 1, Terms2) of
|
||||||
|
{tools, true} -> [observer];
|
||||||
|
_ -> []
|
||||||
|
end,
|
||||||
|
|
||||||
{[lists:keyfind(description, 1, Terms),
|
{[lists:keyfind(description, 1, Terms),
|
||||||
lists:keyfind(vsn, 1, Terms),
|
lists:keyfind(vsn, 1, Terms),
|
||||||
{env, [{enabled_backends, EBs}]}
|
{env, [{enabled_backends, EBs}]}
|
||||||
|
Loading…
Reference in New Issue
Block a user