Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerWitt committed Jan 16, 2025
1 parent 72f0c22 commit 786611a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
4 changes: 3 additions & 1 deletion hex/helpers/lib/check_update.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ defmodule UpdateChecker do
end

defp ensure_hex do
hex_folder = "hex-#{System.get_env("HEX_VERSION")}"

# Mix.ensure_application!(:hex) didn't work for some reason, so we reimplement it here with the specific ebin path
Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", "hex-#{System.get_env("HEX_VERSION")}", "hex-#{System.get_env("HEX_VERSION")}", "ebin"]), cache: true)
Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", hex_folder, hex_folder, "ebin"]), cache: true)
Application.load(:hex)
Mix.ensure_application!(:ssl)
Mix.ensure_application!(:inets)
Expand Down
4 changes: 3 additions & 1 deletion hex/helpers/lib/do_update.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This is necessary because we can't specify :extra_applications to have :hex in other mixfiles.
# Mix.ensure_application!(:hex) didn't work for some reason, so we reimplement it here with the specific ebin path
Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", "hex-#{System.get_env("HEX_VERSION")}", "hex-#{System.get_env("HEX_VERSION")}", "ebin"]), cache: true)
hex_folder = "hex-#{System.get_env("HEX_VERSION")}"

Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", hex_folder, hex_folder, "ebin"]), cache: true)
Application.load(:hex)
Mix.ensure_application!(:ssl)
Mix.ensure_application!(:inets)
Expand Down
4 changes: 3 additions & 1 deletion hex/helpers/lib/parse_deps.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ defmodule Parser do
end

defp ensure_hex do
hex_folder = "hex-#{System.get_env("HEX_VERSION")}"

# Mix.ensure_application!(:hex) didn't work for some reason, so we reimplement it here with the specific ebin path
Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", "hex-#{System.get_env("HEX_VERSION")}", "hex-#{System.get_env("HEX_VERSION")}", "ebin"]), cache: true)
Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", hex_folder, hex_folder, "ebin"]), cache: true)
Application.load(:hex)
Mix.ensure_application!(:ssl)
Mix.ensure_application!(:inets)
Expand Down
12 changes: 0 additions & 12 deletions hex/helpers/lib/run.exs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
defmodule DependencyHelper do
def main() do
# This is necessary because we can't specify :extra_applications to have :hex in other mixfiles.
ensure_hex()

IO.read(:stdio, :all)
|> Jason.decode!()
|> run()
Expand All @@ -22,15 +19,6 @@ defmodule DependencyHelper do
|> handle_result()
end

defp ensure_hex do
# Mix.ensure_application!(:hex) didn't work for some reason, so we reimplement it here with the specific ebin path
Code.append_path(Path.join([System.get_env("MIX_HOME"), "archives", "hex-#{System.get_env("HEX_VERSION")}", "hex-#{System.get_env("HEX_VERSION")}", "ebin"]), cache: true)
Application.load(:hex)
Mix.ensure_application!(:ssl)
Mix.ensure_application!(:inets)
Mix.ensure_application!(:ssh)
end

defp handle_result({:ok, {:ok, result}}) do
encode_and_write(%{"result" => result})
end
Expand Down
2 changes: 1 addition & 1 deletion hex/helpers/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule DependabotCore.Mixfile do
end

def application do
[extra_applications: [:hex, :logger]]
[extra_applications: [:hex, :logger, :ssh]]
end

defp deps() do
Expand Down

0 comments on commit 786611a

Please # to comment.