No description
Find a file
2024-06-12 18:36:32 -04:00
.github ci: skip spark related CI steps 2024-05-31 23:06:20 -04:00
config improvement: add CI/build and get it passing locally 2024-05-31 22:59:36 -04:00
installer WIP 2024-06-03 23:14:36 -04:00
lib improvement: draw the rest of the owl 2024-06-12 18:22:08 -04:00
logos docs: improve logo 2024-06-12 18:36:32 -04:00
test improvement: draw the rest of the owl 2024-06-12 18:22:08 -04:00
.check.exs improvement: add CI/build and get it passing locally 2024-05-31 22:59:36 -04:00
.credo.exs improvement: add CI/build and get it passing locally 2024-05-31 22:59:36 -04:00
.formatter.exs improvement: add CI/build and get it passing locally 2024-05-31 22:59:36 -04:00
.gitignore improvement: add installer archive 2024-06-03 13:13:49 -04:00
.tool-versions improvement: draw the rest of the owl 2024-06-12 18:22:08 -04:00
FUNDING.yml improvement: add CI/build and get it passing locally 2024-05-31 22:59:36 -04:00
LICENSE improvement: add CI/build and get it passing locally 2024-05-31 22:59:36 -04:00
mix.exs improvement: draw the rest of the owl 2024-06-12 18:22:08 -04:00
mix.lock improvement: draw the rest of the owl 2024-06-12 18:22:08 -04:00
README.md docs: improve logo 2024-06-12 18:36:32 -04:00

Logo Light Logo Dark

CI Hex version badge Hexdocs badge

Igniter

Igniter is a code generation and project patching framework.

Installation

Igniter can be added to an existing elixir project by adding it to your dependencies:

{:igniter, "~> 0.1", only: [:dev]}

You can also generate new projects with igniter preinstalled, and run installers in the same command.

The archive is not published yet, so these instructions are ommitted, but once it is, you will be able to install the archive, and say:

mix igniter.new app_name --install ash

Patterns

Mix tasks built with igniter are both individually callable, and composable. This means that tasks can call eachother, and also end users can create and customize their own generators composing existing tasks.

Installers

Igniter will look for a task called <your_package>.install when the user runs mix igniter.install <your_package>, and will run it after installing and fetching dependencies.

Generators/Patchers

These can be run like any other mix task, or composed together. For example, lets say that you wanted to have your own Ash.Resource generator, that starts with the default mix ash.gen.resource task, but then adds or modifies files:

# in lib/mix/tasks/my_app.gen.resource.ex
defmodule Mix.Tasks.MyApp.Gen.Resource do
  use Igniter.Mix.Task

  def igniter(igniter, [resource | _] = argv) do
    resource = Igniter.Code.Module.parse(resource)
    my_special_thing = Module.concat([resource, SpecialThing])
    location = Igniter.Code.Module.proper_location(my_special_thing)

    igniter
    |> Igniter.compose_task("ash.gen.resource", argv)
    |> Igniter.create_new_elixir_file(location, """
    defmodule #{inspect(my_special_thing)} do
      # this is the special thing for #{inspect()}
    end
    """)
  end
end