You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 line
1.6 KiB

  1. IsRebar3 = case application:get_key(rebar, vsn) of
  2. {ok, VSN} ->
  3. [VSN1 | _] = string:tokens(VSN, "-"),
  4. [Maj, Min, Patch] = string:tokens(VSN1, "."),
  5. (list_to_integer(Maj) >= 3);
  6. undefined ->
  7. lists:keymember(mix, 1, application:loaded_applications())
  8. end,
  9. case IsRebar3 of
  10. true ->
  11. CONFIG;
  12. false ->
  13. io:format("la~n", []),
  14. CONFIG1 = [{eunit_opts, [verbose]}, {plugins, [rebar_gdb_plugin]} | CONFIG],
  15. ErlOpts = [{d, 'JIFFY_DEV'}],
  16. Proper = [{proper, ".*", {git, "git://github.com/manopapad/proper.git", "master"}}],
  17. ConfigPath = filename:dirname(SCRIPT),
  18. DevMarker = filename:join([ConfigPath, ".jiffy.dev"]),
  19. case filelib:is_file(DevMarker) of
  20. true ->
  21. % Don't override existing dependencies
  22. CONFIG2 = case lists:keyfind(deps, 1, CONFIG1) of
  23. false ->
  24. CONFIG1 ++ [{deps, Proper}];
  25. {deps, DepsList} ->
  26. lists:keyreplace(deps, 1, CONFIG1, {deps, DepsList ++ Proper})
  27. end,
  28. case lists:keyfind(erl_opts, 1, CONFIG2) of
  29. false ->
  30. CONFIG2 ++ [{erl_opts, ErlOpts}];
  31. {erl_opts, Opts} ->
  32. NewOpts = {erl_opts, Opts ++ ErlOpts},
  33. lists:keyreplace(erl_opts, 1, CONFIG2, NewOpts)
  34. end;
  35. false ->
  36. CONFIG1
  37. end
  38. end.