Katee/aasm-diagram

Feature Proposal: create railtie.rb and make `rake aasm:diagram[ModelName]` command available on rails?

Closed this issue · 1 comments

Hi. First, thank you for this great gem.

I thought it would be useful if lib/aasm_diagram/railtie.rb is created, and in there, define the rake task for generating the png file, using the AASMDiagram::Diagram.new(ModelName.new.aasm, Rails.root / (ModelName) + '.png' ). I think the synopsis of such command will be something like: rake aasm:diagram[ModelName]. Since it will be defined as a railtie, those who are not using rails will not be affected.

Any opinion?

If this sounds good, I can implement it and create such PR.

Katee commented

Sorry @Yuki-Inoue, I did not see this issue. Yes, that is a great idea. @mihaimuntenas added a rake task called generate and documented it in the Readme. It's slightly different from what you proposed (it writes the generated files to /tmp). If you'd like to update it to also accept a filename I'd be happy to merge that.