Skip to content

Commit ec11052

Browse files
committed
Stub igniter installer
1 parent f55571a commit ec11052

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

lib/mix/tasks/desktop.install.ex

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
defmodule Mix.Tasks.Desktop.Install do
2+
@shortdoc "Add Elixir Desktop support to a project"
3+
4+
@moduledoc """
5+
#{@shortdoc}
6+
"""
7+
8+
use Igniter.Mix.Task
9+
10+
@impl Igniter.Mix.Task
11+
def info(_argv, _composing_task) do
12+
%Igniter.Mix.Task.Info{
13+
# Groups allow for overlapping arguments for tasks by the same author
14+
# See the generators guide for more.
15+
group: :desktop,
16+
# *other* dependencies to add
17+
# i.e `{:foo, "~> 2.0"}`
18+
adds_deps: [],
19+
# *other* dependencies to add and call their associated installers, if they exist
20+
# i.e `{:foo, "~> 2.0"}`
21+
installs: [],
22+
# An example invocation
23+
# example: __MODULE__.Docs.example(),
24+
# A list of environments that this should be installed in.
25+
only: nil,
26+
# a list of positional arguments, i.e `[:file]`
27+
positional: [],
28+
# Other tasks your task composes using `Igniter.compose_task`, passing in the CLI argv
29+
# This ensures your option schema includes options from nested tasks
30+
composes: [],
31+
# `OptionParser` schema
32+
schema: [],
33+
# Default values for the options in the `schema`
34+
defaults: [],
35+
# CLI aliases
36+
aliases: [],
37+
# A list of options in the schema that are required
38+
required: []
39+
}
40+
end
41+
42+
@impl Igniter.Mix.Task
43+
def igniter(igniter) do
44+
igniter
45+
|> Igniter.compose_task("igniter.add", ["desktop"])
46+
end
47+
end

mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ defmodule Desktop.MixProject do
8686
{:phoenix, "> 1.7.10"},
8787
{:phoenix_live_view, "> 1.0.0"},
8888
{:plug, "> 1.0.0"},
89-
{:gettext, "> 0.10.0"}
89+
{:gettext, "> 0.10.0"},
90+
{:igniter, "~> 0.6", only: [:dev, :test]}
9091
]
9192

9293
if Mix.target() in [:android, :ios] do
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
defmodule Mix.Tasks.Desktop.InstallTest do
2+
use ExUnit.Case, async: true
3+
import Igniter.Test
4+
5+
test "it installs desktop dependency" do
6+
test_project()
7+
|> Igniter.compose_task("desktop.install", [])
8+
|> assert_has_patch("mix.exs", """
9+
+ | {:desktop,
10+
""")
11+
end
12+
end

0 commit comments

Comments
 (0)