Module rebar_pkg_resource

Behaviours: rebar_resource.

Data Types

cached_result()

cached_result() = {bad_checksum, string()} | {bad_registry_checksum, string()} | {failed_extract, string()} | {ok, true} | {unexpected_hash, string(), term(), binary()}

download_result()

download_result() = {bad_download, binary() | string()} | {fetch_fail, term(), term()} | cached_result()

Function Index

download/3 Download the given pkg.
download/4 Download the given pkg.
etag/1 Read the etag belonging to the pkg file from the cache directory.
lock/2
make_vsn/1 Implementation of rebar_resource make_vsn callback.
needs_update/2 Return true if the stored version of the pkg is older than the current version.
request/2 Download the pkg belonging to the given address.
ssl_opts/1 Return the SSL options adequate for the project based on its configuration, including for validation of certs.
store_etag_in_cache/2 Store the given etag in the .cache folder.

Function Details

download/3

download(TmpDir, Pkg, State) -> Res

Download the given pkg.

download/4

download(TmpDir, Pkg, State, UpdateETag) -> Res

Download the given pkg. The etag belonging to the pkg file will be updated only if the UpdateEtag is true and the ETag returned from the hexpm server is different.

etag/1

etag(Path) -> Res

Read the etag belonging to the pkg file from the cache directory. The etag is stored in a separate file when the etag belonging to the package is returned from the hexpm server. The name is package-vsn.etag.

lock/2

lock(AppDir, Source) -> Res

make_vsn/1

make_vsn(Vsn) -> Res

Implementation of rebar_resource make_vsn callback. Returns {error, string()} as this operation is not supported for pkg sources.

needs_update/2

needs_update(Dir, Pkg) -> Res

Return true if the stored version of the pkg is older than the current version.

request/2

request(Url, ETag) -> Res

Download the pkg belonging to the given address. If the etag of the pkg is the same what we stored in the etag file previously return {ok, cached}, if the file has changed (so the etag is not the same anymore) return {ok, Contents, NewEtag}, otherwise if some error occured return error.

ssl_opts/1

ssl_opts(Url) -> Res

Return the SSL options adequate for the project based on its configuration, including for validation of certs.

store_etag_in_cache/2

store_etag_in_cache(File, ETag) -> Res

Store the given etag in the .cache folder. The name is pakckage-vsn.etag.


Generated by EDoc