Skip to content

Commit 30331b2

Browse files
committed
Do not allow deps names on mix deps.get
Closes #2507.
1 parent f5bf9d9 commit 30331b2

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

lib/mix/lib/mix/tasks/deps.get.ex

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ defmodule Mix.Tasks.Deps.Get do
1414
"""
1515
def run(args) do
1616
Mix.Project.get! # Require the project to be available
17-
{opts, rest, _} = OptionParser.parse(args, switches: [quiet: :boolean, only: :string])
17+
{opts, _, _} = OptionParser.parse(args, switches: [quiet: :boolean, only: :string])
1818

1919
# Fetch all deps by default unless --only is given
2020
fetch_opts = if only = opts[:only], do: [env: :"#{only}"], else: []
2121

22-
apps =
23-
if rest != [] do
24-
Mix.Dep.Fetcher.by_name(rest, %{}, Mix.Dep.Lock.read, fetch_opts)
25-
else
26-
Mix.Dep.Fetcher.all(%{}, Mix.Dep.Lock.read, fetch_opts)
27-
end
22+
apps = Mix.Dep.Fetcher.all(%{}, Mix.Dep.Lock.read, fetch_opts)
2823

2924
if apps == [] && !opts[:quiet] do
3025
Mix.shell.info "All dependencies up to date"

lib/mix/lib/mix/tasks/deps.unlock.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Mix.Tasks.Deps.Unlock do
1212

1313
def run(args) do
1414
Mix.Project.get! # Require the project to be available
15-
{opts, args, _} = OptionParser.parse(args, switches: [unlock: :boolean, all: :boolean])
15+
{opts, args, _} = OptionParser.parse(args, switches: [all: :boolean])
1616

1717
cond do
1818
opts[:all] ->

lib/mix/lib/mix/utils.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule Mix.Utils do
1111
1212
Developers should only store entries in the
1313
`MIX_HOME` directory which are guaranteed to
14-
work accross multiple Elixir versions, as it is
14+
work across multiple Elixir versions, as it is
1515
not recommended to swap the `MIX_HOME` directory
1616
as configuration and other important data may be
1717
stored there.
@@ -317,13 +317,13 @@ defmodule Mix.Utils do
317317
end
318318

319319
defp do_symlink_or_copy(source, target) do
320-
320+
321321
# relative symbolic links on windows are broken
322322
source_path = case :os.type do
323323
{:win32, _} -> source
324324
_ -> make_relative_path(source, target)
325325
end
326-
326+
327327
case :file.make_symlink(source_path, target) do
328328
:ok -> :ok
329329
{:error, _} -> {:ok, File.cp_r!(source, target)}

lib/mix/test/mix/tasks/deps_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ defmodule Mix.Tasks.DepsTest do
295295

296296
in_fixture "deps_status", fn ->
297297
assert_raise Mix.Error, ~r/Unknown dependency invalid for environment dev/, fn ->
298-
Mix.Tasks.Deps.Get.run ["invalid"]
298+
Mix.Tasks.Deps.Update.run ["invalid"]
299299
end
300300
end
301301
end

0 commit comments

Comments
 (0)