mad_deps_SUITE.erl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. -module(mad_deps_SUITE).
  2. -export([all/0]).
  3. -export([repos_path/1]).
  4. -export([path/1]).
  5. -export([name_and_repo/1]).
  6. -export([checkout_to/1]).
  7. -export([get_publisher/1]).
  8. -export([fetch/1]).
  9. -import(helper, [get_value/2]).
  10. all() ->
  11. [repos_path, path, name_and_repo, checkout_to, get_publisher, fetch].
  12. repos_path(_) ->
  13. Path = filename:join([os:cmd("echo -n $HOME"), ".mad", "repos"]),
  14. Path = mad_deps:repos_path().
  15. path(_) ->
  16. Path = filename:join([os:cmd("echo -n $HOME"), ".mad", "repos",
  17. "publisher", "repo"]),
  18. Path = mad_deps:path("publisher", "repo").
  19. name_and_repo(_) ->
  20. Dep = {x,".*",{git,"blah, blah..",{tag,"v0.8.10"}}},
  21. {"x",{git,"blah, blah..", {tag,"v0.8.10"}}} = mad_deps:name_and_repo(Dep).
  22. checkout_to(_) ->
  23. "v0.8.10" = mad_deps:checkout_to({tag, "v0.8.10"}),
  24. "develop" = mad_deps:checkout_to({branch, "develop"}).
  25. get_publisher(_) ->
  26. "erlang" = mad_deps:get_publisher("git://github.com/erlang/otp.git"),
  27. "s1n4" = mad_deps:get_publisher("https://github.com/s1n4/mad"),
  28. "xyz" = mad_deps:get_publisher("https://bitbucket.org/xyz/repo").
  29. fetch(Config) ->
  30. DataDir = get_value(data_dir, Config),
  31. DepsDir = filename:join(DataDir, "deps"),
  32. os:cmd("rm -rf " ++ DepsDir),
  33. %% make repos and deps directories
  34. os:cmd("mkdir -p " ++ mad_deps:repos_path()),
  35. os:cmd("mkdir -p " ++ DepsDir),
  36. Deps = [{mad, ".*",
  37. {git, "git://github.com/s1n4/mad.git", {branch, "master"}}
  38. }],
  39. mad_deps:fetch(DataDir, "rebar.config", Deps),
  40. {ok, _} = file:list_dir(filename:join(DepsDir, "mad")),
  41. os:cmd("rm -rf " ++ DepsDir).