Skip to content

Commit e9ea9de

Browse files
wojtekmachjosevalim
authored andcommitted
Add --repo to archive.install and escript.install (#10121)
1 parent 1feef9c commit e9ea9de

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

lib/mix/lib/mix/local/installer.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ defmodule Mix.Local.Installer do
233233

234234
dep_opts =
235235
opts
236-
|> Keyword.take([:organization])
236+
|> Keyword.take([:organization, :repo])
237237
|> Keyword.put(:hex, String.to_atom(package_name))
238238

239239
{:fetcher, {String.to_atom(app_name), version, dep_opts}}

lib/mix/lib/mix/tasks/archive.install.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ defmodule Mix.Tasks.Archive.Install do
5151
from Git, GitHub, or Hex
5252
5353
* `--organization` - specifies an organization to use if fetching the package
54-
from a private Hex repository
54+
from a private Hex repository. Setting `--organization acme` has the same
55+
effect as `--repo hexpm:acme`
56+
57+
* `--repo` - specifies a repo to use when using Hex
5558
5659
"""
5760

@@ -63,6 +66,7 @@ defmodule Mix.Tasks.Archive.Install do
6366
submodules: :boolean,
6467
app: :string,
6568
organization: :string,
69+
repo: :string,
6670
timeout: :integer
6771
]
6872

lib/mix/lib/mix/tasks/escript.install.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ defmodule Mix.Tasks.Escript.Install do
5151
from Git, GitHub, or Hex
5252
5353
* `--organization` - specifies an organization to use if fetching the package
54-
from a private Hex repository
54+
from a private Hex repository. Setting `--organization acme` has the same
55+
effect as `--repo hexpm:acme`
56+
57+
* `--repo` - specifies a repo to use when using Hex
5558
5659
"""
5760

@@ -66,6 +69,7 @@ defmodule Mix.Tasks.Escript.Install do
6669
submodules: :boolean,
6770
app: :string,
6871
organization: :string,
72+
repo: :string,
6973
timeout: :integer
7074
]
7175

lib/mix/test/mix/local/installer_test.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,9 @@ defmodule Mix.Local.InstallerTest do
9797
assert Mix.Local.Installer.parse_args(["hex", "a_package"], organization: "my_org") ==
9898
{:fetcher, {:a_package, ">= 0.0.0", [hex: :a_package, organization: "my_org"]}}
9999
end
100+
101+
test "parse_args Hex with repo" do
102+
assert Mix.Local.Installer.parse_args(["hex", "a_package"], repo: "my_repo") ==
103+
{:fetcher, {:a_package, ">= 0.0.0", [hex: :a_package, repo: "my_repo"]}}
104+
end
100105
end

0 commit comments

Comments
 (0)