Skip to content

Commit

Permalink
feat: correctly use package-interface.json from HexDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ghivert committed Jul 9, 2024
1 parent 7635107 commit c6001fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/backend/src/gloogle_hex_ffi.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package_interface_path(ContentDest, BaseName) ->
unicode:characters_to_binary(Path).

save_file(ContentDest, HttpBody) ->
wisp:log_debug("Using HexDocs for package-interface.json"),
PackageInterfacePath = <<ContentDest/binary, "/package-interface.json">>,
file:write_file(PackageInterfacePath, HttpBody),
{unicode:characters_to_binary(PackageInterfacePath), <<"">>}.
Expand All @@ -25,8 +26,8 @@ extract_tar(Binary, BaseName, Version, Slug) ->
erl_tar:extract(Content, [{cwd, ContentDest}, compressed]),
{PackageInterface, Result} =
case httpc:request(Url) of
{ok, {_, _, HttpBody}} -> save_file(ContentDest, HttpBody);
{ok, {_, HttpBody}} -> save_file(ContentDest, HttpBody);
{ok, {{_, 200, _}, _, HttpBody}} -> save_file(ContentDest, HttpBody);
{ok, {200, HttpBody}} -> save_file(ContentDest, HttpBody);
{error, _} ->
BuildCmd = <<"cd ", ContentDest/binary, " && gleam docs build">>,
Res = os:cmd(binary_to_list(BuildCmd)),
Expand Down

0 comments on commit c6001fc

Please sign in to comment.