Skip to content

Commit

Permalink
format scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Aug 13, 2023
1 parent b60eb9a commit 9a85168
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
inputs: [
"*.exs",
"config/**/*.exs"
"config/**/*.exs",
"scripts/**/*.exs"
],
subdirectories: [
"apps/elixir_ls_utils",
"apps/elixir_ls_debugger",
"apps/language_server",
"scripts"
"apps/language_server"
]
]
31 changes: 19 additions & 12 deletions scripts/installer.exs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ defmodule ElixirLS.Mix do
# with added option to disable stopping apps after install
# we don't want hex app stopped
# The original code is licensed under

# Apache License
# Version 2.0, January 2004
# http://www.apache.org/licenses/
Expand Down Expand Up @@ -243,7 +243,6 @@ defmodule ElixirLS.Mix do

# END OF TERMS AND CONDITIONS


def install(deps, opts \\ [])

def install(deps, opts) when is_list(deps) and is_list(opts) do
Expand Down Expand Up @@ -476,7 +475,7 @@ defmodule ElixirLS.Installer do
defp run_mix_install({:local, dir}, force?) do
Mix.install(
[
{:elixir_ls, path: dir},
{:elixir_ls, path: dir}
],
force: force?,
start_applications: false,
Expand All @@ -488,7 +487,8 @@ defmodule ElixirLS.Installer do
end

defp run_mix_install({:tag, tag}, force?) do
Mix.install([
Mix.install(
[
{:elixir_ls, github: "elixir-lsp/elixir-ls", tag: tag}
],
force: force?,
Expand All @@ -503,26 +503,29 @@ defmodule ElixirLS.Installer do
end

defp get_release do
version = Path.expand("#{__DIR__}/VERSION")
|> File.read!()
|> String.trim()
version =
Path.expand("#{__DIR__}/VERSION")
|> File.read!()
|> String.trim()

{:tag, "v#{version}"}
end

def install(force?) do
if local?() do
dir = local_dir()
IO.puts(:stderr, "Installing local ElixirLS from #{dir}")
IO.puts(:stderr, "Running in #{File.cwd!}")
IO.puts(:stderr, "Running in #{File.cwd!()}")

run_mix_install({:local, dir}, force?)
else
{:tag, tag} = get_release()
IO.puts(:stderr, "Installing ElixirLS release #{tag}")
IO.puts(:stderr, "Running in #{File.cwd!}")
IO.puts(:stderr, "Running in #{File.cwd!()}")

run_mix_install({:tag, tag}, force?)
end

IO.puts(:stderr, "Install complete")
end

Expand All @@ -540,7 +543,11 @@ defmodule ElixirLS.Installer do
install(false)
catch
kind, error ->
IO.puts(:stderr, "Mix.install failed with #{Exception.format(kind, error, __STACKTRACE__)}")
IO.puts(
:stderr,
"Mix.install failed with #{Exception.format(kind, error, __STACKTRACE__)}"
)

IO.puts(:stderr, "Retrying Mix.install with force: true")
install(true)
end
Expand Down
3 changes: 2 additions & 1 deletion scripts/launch.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Application.put_env(:elixir, :ansi_enabled, false)
Code.eval_file("#{__DIR__}/installer.exs")

Mix.start
Mix.start()

# Put mix into quiet mode so it does not print anything to standard out
# especially it makes it surface git command errors such as reported in
Expand All @@ -16,6 +16,7 @@ ElixirLS.Installer.install_for_launch()
case System.get_env("ELS_MODE") do
"language_server" ->
ElixirLS.LanguageServer.CLI.main()

"debugger" ->
ElixirLS.Debugger.CLI.main()
end
2 changes: 1 addition & 1 deletion scripts/quiet_install.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Application.put_env(:elixir, :ansi_enabled, false)
Code.eval_file("#{__DIR__}/installer.exs")

Mix.start
Mix.start()

# Put mix into quiet mode so it does not print anything to standard out
# especially it makes it surface git command errors such as reported in
Expand Down

0 comments on commit 9a85168

Please sign in to comment.