mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-27 13:56:21 +08:00
standalone.exs: Cache Elixir download (#988)
This commit is contained in:
parent
2c34f62c11
commit
5e82147db0
1 changed files with 10 additions and 5 deletions
|
|
@ -99,11 +99,16 @@ defmodule Standalone do
|
||||||
release
|
release
|
||||||
end
|
end
|
||||||
|
|
||||||
defp download_elixir_at_destination(destination, elixir_version) do
|
defp download_elixir_at_destination(destination, version) do
|
||||||
url = "https://github.com/elixir-lang/elixir/releases/download/v#{elixir_version}/Precompiled.zip"
|
url = "https://github.com/elixir-lang/elixir/releases/download/v#{version}/Precompiled.zip"
|
||||||
|
path = Path.join(System.tmp_dir!(), "elixir_#{version}.zip")
|
||||||
|
|
||||||
|
unless File.exists?(path) do
|
||||||
binary = fetch_body!(url)
|
binary = fetch_body!(url)
|
||||||
File.write!("/tmp/elixir_#{elixir_version}.zip", binary, [:binary])
|
File.write!(path, binary, [:binary])
|
||||||
:zip.unzip('/tmp/elixir_#{elixir_version}.zip', cwd: destination)
|
end
|
||||||
|
|
||||||
|
:zip.unzip(String.to_charlist(path), cwd: destination)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp erts_data do
|
defp erts_data do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue