Current section
Files
Jump to
Current section
Files
src/go_over@hex@retired.erl
-module(go_over@hex@retired).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/go_over/hex/retired.gleam").
-export([check_retired/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/go_over/hex/retired.gleam", 14).
?DOC(false).
-spec pull_retired(go_over@hex@puller:puller(), go_over@packages:package()) -> nil.
pull_retired(Pull, Pkg) ->
go_over@util@print:progress(
<<<<"Checking: "/utf8, (erlang:element(2, Pkg))/binary>>/binary,
" From hex.pm"/utf8>>
),
Pkg_path = go_over@hex@core:release_path(Pkg),
Pkg_path_fail = go_over@hex@core:pkg_pull_error(Pkg, Pkg_path),
_ = simplifile_erl:delete(Pkg_path),
_pipe = simplifile:create_directory_all(Pkg_path),
gxyz@cli:hard_fail_with_msg(_pipe, Pkg_path_fail),
Resp = go_over@hex@core:do_pull_hex(
Pull,
Pkg,
go_over@hex@core:release_url(Pkg)
),
_pipe@1 = Pkg,
_pipe@2 = go_over@hex@core:release_filename(_pipe@1),
_pipe@3 = simplifile:write(_pipe@2, Resp),
gxyz@cli:hard_fail_with_msg(_pipe@3, Pkg_path_fail).
-file("src/go_over/hex/retired.gleam", 31).
?DOC(false).
-spec check_retired(go_over@hex@puller:puller(), go_over@packages:package()) -> gleam@option:option(gleam@hexpm:release_retirement()).
check_retired(Pull, Pkg) ->
_pipe = Pkg,
_pipe@1 = go_over@hex@core:release_path(_pipe),
go_over@util@cache:pull_if_not_cached(
_pipe@1,
3600,
gxyz@function:freeze2(fun pull_retired/2, Pull, Pkg),
<<<<(erlang:element(2, Pkg))/binary, ":"/utf8>>/binary,
(erlang:element(4, Pkg))/binary>>
),
Cached_file_name = go_over@hex@core:release_filename(Pkg),
Resp = begin
_pipe@2 = Cached_file_name,
_pipe@3 = simplifile:read(_pipe@2),
gxyz@cli:hard_fail_with_msg(
_pipe@3,
<<"failed to read "/utf8, Cached_file_name/binary>>
)
end,
Release = begin
_pipe@4 = gleam@json:parse(Resp, gleam@hexpm:release_decoder()),
gxyz@cli:hard_fail_with_msg(
_pipe@4,
<<"failed to parse "/utf8, Cached_file_name/binary>>
)
end,
erlang:element(8, Release).