aboutsummaryrefslogtreecommitdiff
path: root/src/lustre_add_ffi.erl
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-02-18 10:45:00 +0000
committerHayleigh Thompson <me@hayleigh.dev>2024-02-18 10:45:00 +0000
commit69b36cf003212e98800d5f27af74bb59f3bbca5d (patch)
tree11a198e64017a5ac4207c1311b1d9ac3b0ee92de /src/lustre_add_ffi.erl
parent8128c25b6d8e597e5c652007f483c22047425c5c (diff)
downloadlustre-69b36cf003212e98800d5f27af74bb59f3bbca5d.tar.gz
lustre-69b36cf003212e98800d5f27af74bb59f3bbca5d.zip
:recycle: Big refactor of CLI-related things.
Diffstat (limited to 'src/lustre_add_ffi.erl')
-rw-r--r--src/lustre_add_ffi.erl49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/lustre_add_ffi.erl b/src/lustre_add_ffi.erl
deleted file mode 100644
index d7c5030..0000000
--- a/src/lustre_add_ffi.erl
+++ /dev/null
@@ -1,49 +0,0 @@
--module(lustre_add_ffi).
--export([
- get_cpu/0,
- get_esbuild/1,
- get_os/0,
- unzip_esbuild/1
-]).
-
-get_os() ->
- case os:type() of
- {win32, _} -> <<"win32">>;
- {unix, darwin} -> <<"darwin">>;
- {unix, linux} -> <<"linux">>;
- {_, Unknown} -> atom_to_binary(Unknown, utf8)
- end.
-
-get_cpu() ->
- case erlang:system_info(os_type) of
- {unix, _} ->
- [Arch, _] = string:split(erlang:system_info(system_architecture), "-"),
- list_to_binary(Arch);
- {win32, _} ->
- case erlang:system_info(wordsize) of
- 4 -> {ok, <<"ia32">>};
- 8 -> {ok, <<"x64">>}
- end
- end.
-
-get_esbuild(Url) ->
- inets:start(),
- ssl:start(),
-
- case httpc:request(get, {Url, []}, [], [{body_format, binary}]) of
- {ok, {{_, 200, _}, _, Zip}} -> {ok, Zip};
- {ok, Res} -> {error, {network_error, Res}};
- {error, Err} -> {error, {network_error, Err}}
- end.
-
-unzip_esbuild(Zip) ->
- Result =
- erl_tar:extract({binary, Zip}, [
- memory, compressed, {files, ["package/bin/esbuild"]}
- ]),
-
- case Result of
- {ok, [{_, Esbuild}]} -> {ok, Esbuild};
- {ok, Res} -> {error, {unzip_error, Res}};
- {error, Err} -> {error, {unzip_error, Err}}
- end.