Skip to content

57 add igniter installer#59

Merged
dawidsawczuk merged 8 commits intomasterfrom
57-add-igniter-installer
Apr 27, 2026
Merged

57 add igniter installer#59
dawidsawczuk merged 8 commits intomasterfrom
57-add-igniter-installer

Conversation

@dawidsawczuk
Copy link
Copy Markdown
Contributor

Pull Request

Description

This PR adds Igniter installer support to permit, enabling mix igniter.install permit for project setup. The main permit.install task acts as the orchestrator, composing sub tasks from permit_ecto and permit_phoenix based on flags.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Test improvements
  • CI/CD improvements

Related Issues

Closes #57

Changes Made

  • Added {:igniter, "~> 0.5", optional: true} to deps.
  • Added Mix.Tasks.Permit.Install Igniter task (lib/mix/tasks/permit.install.ex):
  • Supports --phoenix flag to compose permit_phoenix.install.
  • Supports --no-ecto flag for base Permit-only setup (no Ecto dependency).
  • Default mode (without --no-ecto) composes permit_ecto.install.
  • All module names customizable via --authorization-module, --permissions-module, --actions-module, --repo, --router.
  • Falls back gracefully with a helpful error message when Igniter is not installed.
  • In --no-ecto mode, directly generates:
  • .Authorization module with use Permit
  • .Authorization.Permissions module with use Permit.Permissions and a stub can/1
  • Added 6 Igniter tests covering --no-ecto generation, custom module names, and composition.

Testing

Test Environment

  • Elixir version: 1.18.4
  • OTP version: 28

Test Cases

  • All existing tests pass
  • New tests added for new functionality at appropriate levels
  • Manual testing performed

Test Commands Run

mix test
mix credo --strict
mix dialyzer

Documentation

  • Updated README.md (if applicable)
  • Updated documentation comments (with examples for new features)
  • Updated CHANGELOG.md (if applicable)

Code Quality

  • Code follows the existing style conventions
  • Self-review of the code has been performed
  • Code has been commented, particularly in hard-to-understand areas
  • No new linting warnings introduced
  • No new Dialyzer warnings introduced

Backward Compatibility

  • This change is backward compatible
  • This change includes breaking changes (please describe below)
  • Migration guide provided for breaking changes

Breaking Changes

Performance Impact

  • No performance impact
  • Performance improvement
  • Potential performance regression (please describe)

Performance Notes

Security Considerations

  • No security impact
  • Security improvement
  • Potential security impact (please describe)

Additional Notes

Screenshots/Examples

Full install with Ecto + Phoenix

mix igniter.install permit --phoenix

Install base Permit only (no Ecto)

mix igniter.install permit --no-ecto

With custom module names

mix igniter.install permit --authorization-module MyApp.Auth

Generated lib/my_app/authorization.ex (--no-ecto mode):

  defmodule MyApp.Authorization do
    use Permit, permissions_module: MyApp.Authorization.Permissions
  end

  Generated lib/my_app/authorization/permissions.ex (--no-ecto mode):
  defmodule MyApp.Authorization.Permissions do
    use Permit.Permissions, actions_module: Permit.Actions.CrudActions

    def can(_user) do
      permit()
    end
  end

Checklist

  • I have read the Contributing Guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Reviewer Notes

The permit.install task composes permit_ecto.install and permit_phoenix.install from the sibling packages. The sub tasks must be present (i.e., the user has those deps) for composition to work.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 78.78788% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/mix/tasks/permit.install.ex 78.78% 7 Missing ⚠️
Files with missing lines Coverage Δ
lib/mix/tasks/permit.install.ex 78.78% <78.78%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dawidsawczuk dawidsawczuk marked this pull request as ready for review March 30, 2026 10:05
Copy link
Copy Markdown
Collaborator

@vincentvanbush vincentvanbush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency declaration should be changed to dev-only, and I would also request the README to be updated to encourage users to use the provided mix tasks as the preferred installation method.

Comment thread mix.exs Outdated
@dawidsawczuk dawidsawczuk merged commit 35737b6 into master Apr 27, 2026
16 checks passed
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.

[Feature]: Add Igniter installer

2 participants