File tree Expand file tree Collapse file tree 2 files changed +25
-14
lines changed
Expand file tree Collapse file tree 2 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -26,15 +26,32 @@ defmodule Mix.CLI do
2626 run_task ( task , args )
2727 end
2828
29+ @ hex_requirement ">= 0.1.0-dev"
30+
2931 defp load_remote do
30- try do
31- Code . ensure_loaded? ( Hex ) and Hex . start
32- catch
33- kind , reason ->
34- stacktrace = System . stacktrace
35- Mix . shell . error "Could not start Hex. Try fetching a new version with " <>
36- "`mix local.hex` or uninstalling it with `mix local.uninstall hex`"
37- :erlang . raise ( kind , reason , stacktrace )
32+ if Code . ensure_loaded? ( Hex ) do
33+ unless Version . match? ( Hex . version , @ hex_requirement ) do
34+ update_hex ( )
35+ end
36+
37+ try do
38+ Hex . start
39+ catch
40+ kind , reason ->
41+ stacktrace = System . stacktrace
42+ Mix . shell . error "Could not start Hex. Try fetching a new version with " <>
43+ "`mix local.hex` or uninstalling it with `mix local.uninstall hex`"
44+ :erlang . raise ( kind , reason , stacktrace )
45+ end
46+ end
47+ end
48+
49+ defp update_hex do
50+ Mix . shell . info "Mix requires hex #{ @ hex_requirement } but you have #{ Hex . version } "
51+
52+ if Mix . shell . yes? ( "Shall I abort the current command and update hex?" ) do
53+ Mix.Tasks.Local.Hex . run [ "--force" ]
54+ exit ( 0 )
3855 end
3956 end
4057
Original file line number Diff line number Diff line change @@ -63,12 +63,6 @@ defmodule Mix.Dep.Converger do
6363 # Run remote converger if one is available and rerun mix's
6464 # converger with the new information
6565 if converger do
66- Code . ensure_loaded? ( converger )
67-
68- unless function_exported? ( converger , :deps , 2 ) do
69- raise Mix.Error , message: "Update Hex to the latest version"
70- end
71-
7266 # If there is a lock, it means we are doing a get/update
7367 # and we need to hit the remote converger which do external
7468 # requests and what not. In case of deps.check, deps and so
You can’t perform that action at this time.
0 commit comments