Skip to content

Commit ecfacdc

Browse files
committed
fix: properly honor explicitly passed --only flag over other only configs
1 parent 691c1d4 commit ecfacdc

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

lib/igniter/util/info.ex

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,22 @@ defmodule Igniter.Util.Info do
9191

9292
{dep, dep_opts} when is_list(dep_opts) ->
9393
if dep in @known_only_keys || opts[:only] do
94-
{dep, Keyword.put_new(dep_opts, :only, opts[:only] || @known_only_options[dep])}
94+
if opts[:only] do
95+
{dep, Keyword.put(dep_opts, :only, opts[:only])}
96+
else
97+
{dep, Keyword.put_new(dep_opts, :only, @known_only_options[dep])}
98+
end
9599
else
96100
{dep, dep_opts}
97101
end
98102

99103
{dep, val, dep_opts} when dep in @known_only_keys ->
100104
if dep in @known_only_keys || opts[:only] do
101-
{dep, val,
102-
Keyword.put_new(dep_opts, :only, opts[:only] || @known_only_options[dep])}
105+
if opts[:only] do
106+
{dep, val, Keyword.put(dep_opts, :only, opts[:only])}
107+
else
108+
{dep, val, Keyword.put_new(dep_opts, :only, @known_only_options[dep])}
109+
end
103110
else
104111
{dep, val, dep_opts}
105112
end
@@ -117,7 +124,7 @@ defmodule Igniter.Util.Info do
117124
|> Igniter.apply_and_fetch_dependencies(
118125
Keyword.put(opts, :operation, "compiling #{names_message}")
119126
)
120-
|> maybe_set_dep_options(install_names, argv, task_name)
127+
|> maybe_set_dep_options(install_names, argv, task_name, opts)
121128

122129
acc = insert_installs(acc, install_names, insert_before)
123130
adds_deps = schema.adds_deps
@@ -248,7 +255,7 @@ defmodule Igniter.Util.Info do
248255
end
249256
end
250257

251-
defp maybe_set_dep_options(igniter, install_names, argv, parent) do
258+
defp maybe_set_dep_options(igniter, install_names, argv, parent, opts) do
252259
Enum.reduce(install_names, igniter, fn install, igniter ->
253260
composing_task = "#{install}.install"
254261

@@ -257,7 +264,7 @@ defmodule Igniter.Util.Info do
257264
composing_schema when not is_nil(composing_schema) <-
258265
composing_task.info(argv, parent) do
259266
options =
260-
if composing_schema.only do
267+
if composing_schema.only && !opts[:only] do
261268
Keyword.put(composing_schema.dep_opts, :only, composing_schema.only)
262269
else
263270
composing_schema.dep_opts

0 commit comments

Comments
 (0)