From 410e2bcdecbf10037e6430f64707ef244a738e45 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Thu, 12 Feb 2015 07:21:16 -0600 Subject: replace package management with hex.pm --- src/rebar_pkg_resource.erl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/rebar_pkg_resource.erl') 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(<>)], "/"), + {ok, saved_to_file} = httpc:request(get, {Url, []}, [], [{stream, TmpFile}]), {tarball, TmpFile}. make_vsn(_) -> -- cgit v1.1