diff --git a/rebar.config b/rebar.config index 9ad8f91..9fa50e2 100644 --- a/rebar.config +++ b/rebar.config @@ -11,13 +11,13 @@ {project_plugins, [covertool, rebar3_ex_doc, {rebar3_hank, "~> 0.3.0"}]}. -{deps, [{hex_core, "0.8.4"}, {verl, "1.1.1"}]}. +{deps, [{hex_core, "0.10.1"}, {verl, "1.1.1"}]}. {profiles, [ {test, [ {extra_src_dirs, ["test/support"]}, {overrides, [{override, rebar3,[{deps, [{erlware_commons, "1.3.1"}]}]}]}, - {deps, [{hex_core, "0.8.4"}, + {deps, [{hex_core, "0.10.1"}, {erlware_commons, "1.5.0"}, {elli, "3.3.0"}, {jsone, "1.5.3"}, {meck, "0.9.0"}]}, {erl_opts, [nowarn_export_all]} diff --git a/rebar.lock b/rebar.lock index 900ed3e..9aa6c4a 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,11 +1,11 @@ {"1.2.0", -[{<<"hex_core">>,{pkg,<<"hex_core">>,<<"0.8.4">>},0}, +[{<<"hex_core">>,{pkg,<<"hex_core">>,<<"0.10.1">>},0}, {<<"verl">>,{pkg,<<"verl">>,<<"1.1.1">>},0}]}. [ {pkg_hash,[ - {<<"hex_core">>, <<"FF38B56D164D5987962232C28D769661907B55CE1F058CAECA8E0C8CA5BD85C8">>}, + {<<"hex_core">>, <<"A2AF5C8D9A00A2E3F4337EFD278384B3F5E538EBE9EC541FAA0709BEAC9EA0C5">>}, {<<"verl">>, <<"98F3EC48B943AA4AE8E29742DE86A7CD752513687911FE07D2E00ECDF3107E45">>}]}, {pkg_hash_ext,[ - {<<"hex_core">>, <<"4B8C21FA049515D778395E38B0D0E5D48B7ECDC703BBA1F7007E2651292CE61A">>}, + {<<"hex_core">>, <<"FD39152D342B7FD4CE3F803AC7F084B60D1BC9BF13E707E35DBDCE266FBB65F0">>}, {<<"verl">>, <<"0925E51CD92A0A8BE271765B02430B2E2CFF8AC30EF24D123BD0D58511E8FB18">>}]} ]. diff --git a/src/rebar3_hex_client.erl b/src/rebar3_hex_client.erl index c679859..016d998 100644 --- a/src/rebar3_hex_client.erl +++ b/src/rebar3_hex_client.erl @@ -26,18 +26,18 @@ -define(is_success(N), N >= 200 andalso N =< 299). -create_user(HexConfig, Username, Password, Email) -> +create_user(HexConfig, Username, Password, Email) -> Res = hex_api_user:create(HexConfig, Username, Password, Email), response(Res). -reset_password(HexConfig, User) -> +reset_password(HexConfig, User) -> Res = hex_api_user:reset_password(HexConfig, User), response(Res). -me(HexConfig) -> +me(HexConfig) -> Res = hex_api_user:me(HexConfig), response(Res). - + key_add(HexConfig, <>, Perms) -> Res = hex_api_key:add(HexConfig, KeyName, Perms), response(Res); @@ -76,7 +76,7 @@ publish(HexConfig, Tarball, Opts) -> Res = hex_api_release:publish(HexConfig, Tarball, Opts), response(Res). -delete_release(HexConfig, Name, Version) -> +delete_release(HexConfig, Name, Version) -> Res = hex_api_release:delete(HexConfig, Name, Version), response(Res). @@ -95,14 +95,15 @@ delete_docs(Config, Name, Version) -> Res = hex_api:delete(Config, ["packages", Name, "releases", Version, "docs"]), response(Res). -retire(Config, Package, Version, Reason, Message) -> +-dialyzer({nowarn_function, retire/5}). +retire(Config, Package, Version, Reason, Message) -> Msg = #{<<"reason">> => Reason, <<"message">> => Message }, Res = hex_api_release:retire(Config, Package, Version, Msg), response(Res). -unretire(Config, Package, Version) -> +unretire(Config, Package, Version) -> Res = hex_api_release:unretire(Config, Package, Version), response(Res). @@ -122,7 +123,7 @@ response({ok, {422, _Headers, #{<<"message">> := <<"Validation error(s)">>} = Re {error, Res}; response({ok, {422, _Headers, Res}}) -> {error, Res}; -response({ok, {500, _Headers, Res}}) -> +response({ok, {500, _Headers, Res}}) -> {error, Res}; response({_, _} = Unknown) -> Unknown. diff --git a/src/rebar3_hex_retire.erl b/src/rebar3_hex_retire.erl index 617622d..88915b5 100644 --- a/src/rebar3_hex_retire.erl +++ b/src/rebar3_hex_retire.erl @@ -7,8 +7,8 @@ %% $ rebar3 hex retire PACKAGE VERSION --unretire %% ''' %% -%% Mark a package as retired when you no longer recommend it's usage. A retired package is still resolvable and usable -%% but it will be flagged as retired in the repository and a message will be displayed to users when they use the +%% Mark a package as retired when you no longer recommend it's usage. A retired package is still resolvable and usable +%% but it will be flagged as retired in the repository and a message will be displayed to users when they use the %% package. %% %%

Retirement reasons

@@ -24,8 +24,8 @@ %%

Command line options

%% %% @@ -63,6 +63,7 @@ init(State) -> {ok, State1}. %% @private +-dialyzer({no_return, do/1}). -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, {?MODULE, rebar3_hex_config:repo_error()}}. do(State) -> case rebar3_hex_config:repo(State) of @@ -124,6 +125,7 @@ format_error(bad_command) -> format_error(Reason) -> rebar3_hex_error:format_error(Reason). +-dialyzer({nowarn_function, retire/6}). retire(State, PkgName, Version, Repo, RetireReason, RetireMessage) -> HexConfig = rebar3_hex_config:get_hex_config(?MODULE, Repo, write), Msg = #{<<"reason">> => RetireReason,