diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-02-17 10:35:50 -0600 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-02-17 10:35:50 -0600 |
commit | 43a18bf4fa55a7ef23a6da837ba4450996fe8725 (patch) | |
tree | 14a08750177ecf866353583dd8d7549f0ba30864 /src/rebar_pkg_resource.erl | |
parent | d65e6da7dae7a205050befb76752b58721660ff9 (diff) | |
parent | 501b9b42dfa4c06bc1d537e810f2e4d730e5d8f7 (diff) |
Merge pull request #145 from tsloughter/hex
Replace package management with hex.pm
Diffstat (limited to 'src/rebar_pkg_resource.erl')
-rw-r--r-- | src/rebar_pkg_resource.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl index 5cd6fc8..0508e2c 100644 --- a/src/rebar_pkg_resource.erl +++ b/src/rebar_pkg_resource.erl @@ -5,7 +5,7 @@ -behaviour(rebar_resource). -export([lock/2 - ,download/2 + ,download/3 ,needs_update/2 ,make_vsn/1]). @@ -23,9 +23,11 @@ needs_update(Dir, {pkg, _Name, Vsn, _Url}) -> true end. -download(Dir, {pkg, _Name, _Vsn, Url}) -> +download(Dir, {pkg, Name, Vsn}, State) -> TmpFile = filename:join(Dir, "package.tar.gz"), - {ok, saved_to_file} = httpc:request(get, {binary_to_list(Url), []}, [], [{stream, TmpFile}]), + CDN = rebar_state:get(State, rebar_packages_cdn, "https://s3.amazonaws.com/s3.hex.pm/tarballs"), + Url = string:join([CDN, binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>)], "/"), + {ok, saved_to_file} = httpc:request(get, {Url, []}, [], [{stream, TmpFile}]), {tarball, TmpFile}. make_vsn(_) -> |