preston / railroady

Ruby on Rails 3/4/5 model and controller UML class diagram generator. (`brew/port/apt-get install graphviz` before use!)
Other
1.71k stars 142 forks source link

Fix AASM diagrams with namespaced classes #123

Closed swrobel closed 3 years ago

swrobel commented 6 years ago

Before:

railroady -A | dot -Tsvg > doc/arch/state_machines.svg
Error: <stdin>: syntax error in line 11 near ':'

Invalid output:

subgraph cluster_applets::onetimeevent {
    label = "Applets::OneTimeEvent"
    applets::onetimeevent_pending [label=pending , peripheries = 2];
  applets::onetimeevent_active [label=active ];
  applets::onetimeevent_disabled [label=disabled ];}

Valid output:

subgraph cluster_applets_onetimeevent {
    label = "Applets::OneTimeEvent"
    applets_onetimeevent_pending [label=pending , peripheries = 2];
  applets_onetimeevent_active [label=active ];
  applets_onetimeevent_disabled [label=disabled ];}

Code to fix this was cribbed from ActiveSupport::Inflector#parameterize

I also removed support for acts_as_state_machine because that code didn't look like it would work (had references to aasm in it) and that gem hasn't been updated in eons.

ranska commented 3 years ago

Hello, is there any plan to merge this PR ? I currently got the same issue.

If there is anything to do to help ?

preston commented 3 years ago

@ranska I'd be happy to but it has conflicts. Could you please resubmit a clean PR? I'll get it merged in and released ASAP.

swrobel commented 3 years ago

@preston done!

preston commented 3 years ago

Note that aasm is very much actively maintained.. perhaps no one really needs railroady for that? Personally I don't use it.

https://github.com/aasm/aasm

swrobel commented 3 years ago

@preston correct. This PR actually fixes the AASM integration when your classes are namespaced. I removed the support for acts_as_state_machine which is very much ... not ... actively maintained.

preston commented 3 years ago

@swrobel Ok gotcha. The command line processing is still present, however. Looks like that can also be removed?

swrobel commented 3 years ago

command-line processing is still necessary to trigger AASM support. That flag just also looked for acts_as_state_machine hooks, so I removed that check/method.

preston commented 3 years ago

I just released v1.6.0. Give that a shot!