diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2012-04-25 11:08:18 -0400 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2012-05-14 10:04:41 +0200 |
commit | 8d823308021623a73640eedd538069172f87797b (patch) | |
tree | 02ba95e47811279b229a504c6531716fc86b1033 /src | |
parent | 32ddef7158aa66e1a39160108dd769f9205111ee (diff) |
Add rsync as another option to fetch dependencies
Newly added syntax:
{deps, [ {<depname>, ".*", {rsync, "<rsync_url>"}}, ... ]}
Where rsync_url is any URL accepted by the rsync command.
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_deps.erl | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 8a8e26f..f06eb76 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -385,7 +385,10 @@ download_source(AppDir, {svn, Url, Rev}) -> ok = filelib:ensure_dir(AppDir), rebar_utils:sh(?FMT("svn checkout -r ~s ~s ~s", [Rev, Url, filename:basename(AppDir)]), - [{cd, filename:dirname(AppDir)}]). + [{cd, filename:dirname(AppDir)}]); +download_source(AppDir, {rsync, Url}) -> + ok = filelib:ensure_dir(AppDir), + rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s", [Url, AppDir]), []). update_source(Dep) -> %% It's possible when updating a source, that a given dep does not have a @@ -426,7 +429,10 @@ update_source(AppDir, {svn, _Url, Rev}) -> update_source(AppDir, {hg, _Url, Rev}) -> rebar_utils:sh(?FMT("hg pull -u -r ~s", [Rev]), [{cd, AppDir}]); update_source(AppDir, {bzr, _Url, Rev}) -> - rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]). + rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]); +update_source(AppDir, {rsync, Url}) -> + rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s",[Url,AppDir]),[]). + @@ -439,7 +445,7 @@ source_engine_avail(Source) -> source_engine_avail(Name, Source). source_engine_avail(Name, Source) - when Name == hg; Name == git; Name == svn; Name == bzr -> + when Name == hg; Name == git; Name == svn; Name == bzr; Name == rsync -> case vcs_client_vsn(Name) >= required_vcs_client_vsn(Name) of true -> true; @@ -460,10 +466,11 @@ vcs_client_vsn(Path, VsnArg, VsnRegex) -> false end. -required_vcs_client_vsn(hg) -> {1, 1}; -required_vcs_client_vsn(git) -> {1, 5}; -required_vcs_client_vsn(bzr) -> {2, 0}; -required_vcs_client_vsn(svn) -> {1, 6}. +required_vcs_client_vsn(hg) -> {1, 1}; +required_vcs_client_vsn(git) -> {1, 5}; +required_vcs_client_vsn(bzr) -> {2, 0}; +required_vcs_client_vsn(svn) -> {1, 6}; +required_vcs_client_vsn(rsync) -> {2, 0}. vcs_client_vsn(hg) -> vcs_client_vsn(rebar_utils:find_executable("hg"), " --version", @@ -476,7 +483,10 @@ vcs_client_vsn(bzr) -> "Bazaar \\(bzr\\) (\\d+).(\\d+)"); vcs_client_vsn(svn) -> vcs_client_vsn(rebar_utils:find_executable("svn"), " --version", - "svn, version (\\d+).(\\d+)"). + "svn, version (\\d+).(\\d+)"); +vcs_client_vsn(rsync) -> + vcs_client_vsn(rebar_utils:find_executable("rsync"), " --version", + "rsync version (\\d+).(\\d+)"). has_vcs_dir(git, Dir) -> filelib:is_dir(filename:join(Dir, ".git")); @@ -487,6 +497,8 @@ has_vcs_dir(bzr, Dir) -> has_vcs_dir(svn, Dir) -> filelib:is_dir(filename:join(Dir, ".svn")) orelse filelib:is_dir(filename:join(Dir, "_svn")); +has_vcs_dir(rsync, _) -> + true; has_vcs_dir(_, _) -> true. |