alfredfriedrich

alfredfriedrich

Igniter installer has no content changes

Hello again fine folks of the elixir community,

I am struggling to write a small mix install task with Igniter. Basically I want to create some files in the install task, but if I create a new mix project with igniter.new foo --install my_app no matter what I try, my task does not seem to get called.

I a nutshell this is what I am trying to do:

$ mix igniter.new my_app
$ cd my_app
$ mix igniter.gen.task my_app.install

Inside the my_app.install.ex file I changed the igniter(igniter) function to look like this:

@impl Igniter.Mix.Task
def igniter(igniter) do
  # Do your work here and return an updated igniter
  igniter
  |> Igniter.create_new_file(Path.expand("lib/foo.ex"), foo_ex())
  |> Igniter.add_notice("mix my_app.install finished.")
end

defp foo_ex() do
  """
  defmodule MyApp.Foo do
  end
  """
end

When I try to run the installer in a new mix project (with igniter.new --install or with igniter.new + igniter.install afterwards) I always get the message No proposed content changes! :

mix igniter.new dummy --install my_app@path:../../my_app --verbose
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating lib
* creating lib/dummy.ex
* creating test
* creating test/test_helper.exs
* creating test/dummy_test.exs

Your Mix project was created successfully.
You can use "mix" to compile it, test it, and more:

    cd dummy
    mix test

Run "mix help" for more commands.
Fetching and compiling dependencies ✔
Updating project's igniter dependency:
Updating project's igniter dependency: ✔
installing igniter:
installing igniter: ✔
compiling igniter:
===> Analyzing applications...
===> Compiling telemetry
compiling igniter: ✔
setting up igniter:
setting up igniter: ✔
compiling my_app ✔
`my_app.install` ✔

The following installer was found and executed: `my_app.install`:

    No proposed content changes!


Successfully installed:

* my_app

I also tried with a git URI instead of a local file URI for the dependency but same result.

When I call the mix my_app.install task directly from the my_app project I do get the desired output:

Igniter:

Create: lib/my_app/foo.ex

1 |defmodule MyApp.Foo do
2 |end
3 |

What do I miss? I am grateful for any pointers and hints.

Marked As Solved

zachdaniel

zachdaniel

Creator of Ash

You need to remove the only and have it just be optional: true :slight_smile:

Also Liked

alfredfriedrich

alfredfriedrich

That did the trick, thanks a lot Zach, much appreciate your help!

In hindsight, I should have read the :env part on the mix deps task documentation more thoroughly:

:env - the environment (as an atom) to run the dependency on; defaults to :prod. 

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement