procore-oss / blueprinter

Simple, Fast, and Declarative Serialization Library for Ruby
MIT License
1.1k stars 108 forks source link

Run blueprint generator whith another generator commands in Rails. #431

Open a-chacon opened 2 months ago

a-chacon commented 2 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe

Is just for make the creation of a project easier.

Describe the feature you'd like to see implemented

I would like to run something like rails g scaffold teacher name:string email:string and after all rails generators, run the blueprint generator too.

Something like this:

 rails g scaffold teacher name:string email:string
      invoke  active_record
      create    db/migrate/20240624222343_create_teachers.rb
      create    app/models/teacher.rb
      create    app/blueprints/teacher_blueprint.rb            <-------------------- HERE
      invoke    test_unit
      create      test/models/teacher_test.rb
      invoke      factory_bot
      create        test/factories/teachers.rb
      invoke  resource_route
       route    resources :teachers
      invoke  scaffold_controller
      create    app/controllers/teachers_controller.rb
      invoke    resource_route
      invoke    test_unit
      create      test/controllers/teachers_controller_test.rb

Describe alternatives you've considered

Just run rails g blueprinter:blueprint teacher

Additional context

No response

lessthanjacob commented 1 month ago

Hey Andrés! Thanks for opening this.

We're thinking of moving the existing generator code outside of the this repository, and include it in blueprinter-activerecord instead. After we make a decision there, we can investigate the lift for including a Railtie that can provide this functionality.