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.

37 lines
1.2 KiB

  1. % This file is part of Jiffy released under the MIT license.
  2. % See the LICENSE file for more information.
  3. % Only include PropEr as a dependency when the JIFFY_DEV
  4. % environment variable is defined. This allows downstream
  5. % applications to avoid requiring PropEr.
  6. %
  7. % This script is based on the example provided with Rebar.
  8. ErlOpts = [{d, 'JIFFY_DEV'}],
  9. Proper = [
  10. {proper, ".*", {git, "git://github.com/manopapad/proper.git", "master"}}
  11. ],
  12. ConfigPath = filename:dirname(SCRIPT),
  13. DevMarker = filename:join([ConfigPath, ".jiffy.dev"]),
  14. case filelib:is_file(DevMarker) of
  15. true ->
  16. % Don't override existing dependencies
  17. Config0 = case lists:keyfind(deps, 1, CONFIG) of
  18. false ->
  19. CONFIG ++ [{deps, Proper}];
  20. {deps, DepsList} ->
  21. lists:keyreplace(deps, 1, CONFIG, {deps, DepsList ++ Proper})
  22. end,
  23. Config1 = case lists:keyfind(erl_opts, 1, Config0) of
  24. false ->
  25. Config0 ++ [{erl_opts, ErlOpts}];
  26. {erl_opts, Opts} ->
  27. NewOpts = {erl_opts, Opts ++ ErlOpts},
  28. lists:keyreplace(erl_opts, 1, Config0, NewOpts)
  29. end;
  30. false ->
  31. CONFIG
  32. end.