Skip to content

Add Devise compiler#6

Open
andyw8 wants to merge 5 commits intoangellist:mainfrom
andyw8:andyw8/add-devise-compiler
Open

Add Devise compiler#6
andyw8 wants to merge 5 commits intoangellist:mainfrom
andyw8:andyw8/add-devise-compiler

Conversation

@andyw8
Copy link

@andyw8 andyw8 commented Feb 22, 2025

This adds a compiler for Devise's helpers:

https://github.com/heartcombo/devise/blob/fec67f98f26fcd9a79072e4581b1bd40d0c7fa1d/lib/devise/controllers/helpers.rb#L89

I don't have a lot of experience writing DSL compilers so feedback is welcome.

Copy link
Member

@stathis-alexander stathis-alexander left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! A couple of quick to address comments below, then we can go ahead and merge and I can push a new release.


sig { override.returns(T::Enumerable[Module]) }
def gather_constants
return [] unless defined?(::Devise)
Copy link
Member

Choose a reason for hiding this comment

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

It's more common to skip the definition of the compiler completely if the corresponding gem or classes are not defined. See this example: https://github.com/Shopify/tapioca/blob/main/lib/tapioca/dsl/compilers/graphql_input_object.rb#L4

@andyw8 andyw8 force-pushed the andyw8/add-devise-compiler branch from f8dbd48 to b3cb1d4 Compare February 23, 2025 15:57
@andyw8
Copy link
Author

andyw8 commented Feb 23, 2025

Fixing the typechecking...

@stathis-alexander
Copy link
Member

We may not currently add all the rails packages required (application controller). I can take a look too if you get stuck. Let me know!

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.

2 participants