Skip to content

Igniter installer #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Igniter installer #149

wants to merge 2 commits into from

Conversation

crbelaus
Copy link
Contributor

@crbelaus crbelaus commented Apr 6, 2025

This pull request adds a mix error_tracker.install task that installs the error tracker using Igniter. This task automates the installation and configuration steps detailed in the Getting Started guide by:

  1. Adding ErrorTracker as a dependency
  2. Updating config.exs to configure the ErrorTracker application
  3. Create a new DB migration to set up the ErrorTracker tables
  4. Update the router.ex file to mount the ErrorTracker dashboard
Here is the output mix igniter.install error_tracker in a project named wadus
Updating project's igniter dependency ✔
checking for igniter in project ✔
compiling igniter ✔
setting up igniter ✔

Update: mix.exs

     ...|
34 34   |  defp deps do
35 35   |    [
   36 + |      {:error_tracker, [path: "/Users/crbelaus/Developer/error-tracker", override: true]},
36 37   |      {:igniter, "~> 0.5", only: [:dev, :test]},
37 38   |      {:phoenix, "~> 1.7.21"},
     ...|


These dependencies should be installed before continuing. Modify mix.exs and install? [Y/n] Y
compiling error_tracker ✔
`error_tracker.install` ✔

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

Update: config/config.exs

     ...|
 8  8   |import Config
 9  9   |
   10 + |config :error_tracker, repo: Wadus.Repo, otp_app: :wadus, enabled: true
   11 + |
10 12   |config :wadus,
11 13   |  ecto_repos: [Wadus.Repo],
     ...|


Update: lib/wadus_web/router.ex

     ...|
19 19   |
20 20   |    get "/", PageController, :home
   21 + |    # TODO: This path should be protected from unauthorized user access
   22 + |    error_tracker_dashboard("/errors")
21 23   |  end
22 24   |
     ...|


Create: priv/repo/migrations/20250405160735_add_error_tracker.exs

1 |defmodule Wadus.Repo.Migrations.AddErrorTracker do
2 |  use Ecto.Migration
3 |
4 |  def up, do: ErrorTracker.Migration.up()
5 |  def down, do: ErrorTracker.Migration.down(version: 1)
6 |end
7 |


Proceed with changes? [Y/n] Y

Successfully installed:

* error_tracker

This task can be used in two ways:

  1. If you already have an existing Phoenix project run mix igniter.install error_tracker
    Take a look at the mix igniter.install docs
  2. If you are creating a new Phoenix project run mix igniter.new app_name --install error_tracker --with phx.new
    Take a look at the mix igniter.new docs

@crbelaus crbelaus self-assigned this Apr 6, 2025
@crbelaus
Copy link
Contributor Author

crbelaus commented Apr 6, 2025

I want to add a few tests to ensure that we don't break this in the future before removing the draft state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant