Skip to content

Commit

Permalink
Bump hex_core to v0.10.1 (#335)
Browse files Browse the repository at this point in the history
* Bump hex_core to v0.10.1

* Ignore false warnings about hex_api_release:retire/4

The spec in hex_core for hex_api_release:retire/4 indicates
atoms are the keys for the retire reason (a map). Yet, we've
always used strings and they continue to work.

* Ignore the no_return error in do/1 per previous commit
  • Loading branch information
starbelly authored Jun 12, 2024
1 parent f5c97dc commit a21c817
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -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">>}]}
].
17 changes: 9 additions & 8 deletions src/rebar3_hex_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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, <<KeyName/binary>>, Perms) ->
Res = hex_api_key:add(HexConfig, KeyName, Perms),
response(Res);
Expand Down Expand Up @@ -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).

Expand All @@ -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).

Expand All @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions src/rebar3_hex_retire.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
%%
%% <h2> Retirement reasons </h2>
Expand All @@ -24,8 +24,8 @@
%% <h2> Command line options </h2>
%%
%% <ul>
%% <li>`--repo' - Specify the repository to work with. This option is required when
%% you have multiple repositories configured, including organizations. The argument must
%% <li>`--repo' - Specify the repository to work with. This option is required when
%% you have multiple repositories configured, including organizations. The argument must
%% be a fully qualified repository name (e.g, `hexpm', `hexpm:my_org', `my_own_hexpm').
%% </li>
%% </ul>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a21c817

Please sign in to comment.