Giter Site home page Giter Site logo

preston / railroady Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tobias/railroad

1.7K 35.0 142.0 282 KB

Ruby on Rails 3/4/5 model and controller UML class diagram generator. (`brew/port/apt-get install graphviz` before use!)

License: Other

Ruby 100.00%

railroady's Introduction

RailRoady

Build Status

RailRoady generates Rails model (ActiveRecord, Mongoid, Datamapper) and controller UML diagrams as cross-platform .svg files, as well as in the DOT language.

Code is based on the original "railroad" gem, patched and maintained over the years. Lineage can be traced via GitHub.

I (Preston Lee) am not trying to hijack Peter Hoeg or Javier's project, but rather create a dedicated, lean gem that can be used without major issue on Rails projects.

System Requirements

You MUST have the the following utilities available at the command line.

  • dot and neato.

  • sed, which should already be available on all sane UNIX systems.

Mac users

Brew users can install via:

brew install graphviz

MacPorts users can install in via

sudo port install graphviz

Ubuntu users

Ubuntu users can install in via

sudo apt-get install graphviz

Usage

The easiest (and recommend) usage is to include railroady as a development dependency with your Rails 3 Gemfile, like so...

group :development, :test do
    gem 'railroady'
end

...and then run the master rake task...

rake diagram:all

This should generate four doc/*.svg files that can be opened in (most) web browsers as well as dedicated document viewers supporting the Scalable Vector Graphics format.

Support for Engines

Generate diagram for models and controllers including those in the engines.

rake diagram:all_with_engines

Alternate Usage

Alternatively, you may run the 'railroady' command-line program at the Rails application's root directory. You can redirect its output to a .dot file or pipe it to the dot or neato utilities to produce a graphic. Model diagrams are intended to be processed using dot and controller diagrams are best processed using neato.

railroady [options] command

Options

Common options:
  	-b, --brief                      Generate compact diagram
                                     (no attributes nor methods)
  	-s, --specify file1[,fileN]      Specify only given files
  	-e, --exclude file1[,fileN]      Exclude given files
  	-i, --inheritance                Include inheritance relations
  	-l, --label                      Add a label with diagram information
                                     (type, date, migration, version)
  	-o, --output FILE                Write diagram to file FILE
  	-r, --root PATH                  Set PATH as the application root
  	-v, --verbose                    Enable verbose output
                                     (produce messages to STDOUT)
  	-x, --xmi                        Produce XMI instead of DOT
                                     (for UML tools)
    --alphabetize                Sort methods alphabetically

Models diagram options:
  	-a, --all                        Include all models
                                     (not only ActiveRecord::Base derived)
      	--show-belongs_to            Show belongs_to associations
      	--hide-through               Hide through associations
      	--all-columns                Show all columns (not just content columns)
      	--hide-magic                 Hide magic field names
      	--hide-types                 Hide attributes type
  	-j, --join                       Concentrate edges
  	-m, --modules                    Include modules
  	-p, --plugins-models             Include plugins models
  	-z, --engine-models              Include engine models
      	--include-concerns           Include models in concerns subdirectory
  	-t, --transitive                 Include transitive associations
                                   	(through inheritance)

Controllers diagram options:
      	--hide-public                Hide public methods
      	--hide-protected             Hide protected methods
      	--hide-private               Hide private methods
      	--engine-controllers         Include engine controllers

Other options:
  	-h, --help                       Show this message
      	--version                    Show version and copyright

  	-c, --config FILE                File to load environment (defaults to config/environment)

Commands

You must supply one of these:

-M, --models                     Generate models diagram
-C, --controllers                Generate controllers diagram
-A, --aasm                       Generate "acts as state machine" diagram

Examples

railroady -o models.dot -M
  Produces a models diagram to the file 'models.dot'
railroady -a -i -o full_models.dot -M
  Models diagram with all classes showing inheritance relations
railroady -M | dot -Tsvg > models.svg
  Model diagram in SVG format
railroady -C | neato -Tpng > controllers.png
  Controller diagram in PNG format
railroady -h
  Shows usage help

Processing DOT files

To produce a PNG image from model diagram generated by RailRoady you can issue the following command:

dot -Tpng models.dot > models.png

If you want to do the same with a controller diagram, use neato instead of dot:

neato -Tpng controllers.dot > controllers.png

If you want to produce SVG (vectorial, scalable, editable) files, you can do the following:

dot -Tsvg models.dot > models.svg
neato -Tsvg controllers.dot > controllers.svg

Important: There is a bug in Graphviz tools when generating SVG files that cause a text overflow. You can solve this problem editing (with a text editor, not a graphical SVG editor) the file and replacing around line 12 "font-size:14.00;" by "font-size:11.00;", or by issuing the following command (see "man sed"):

sed -i 's/font-size:14.00/font-size:11.00/g' file.svg

Note: For viewing and editing SVG there is an excellent opensource tool called Inkscape (similar to Adobe Illustrator. For DOT processing you can also use Omnigraffle (on Mac OS X).

= Rake Tasks

As of Preston Lee's Rails 3/4/5 modifications, including RailRoady as a project development dependency will automatically add a set of rake tasks to your project. Sweet! (Run rake -T to check them out.)

Requirements

RailRoady has been tested with the following Ruby and Rails versions

Ruby

  • 1.9.2+
  • 2.0.0+

Rails

  • 3.0.3+
  • 4.0.0+
  • 5.0.0+

There are no additional requirements (nevertheless, all your Rails application requirements must be installed).

In order to view/export the DOT diagrams, you'll need the processing tools from Graphviz.

= Website and Project Home

http://railroady.prestonlee.com

License

RailRoady is distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

See LICENSE for details.

Copyright

Copyright (c) 2007-2008 Javier Smaldone Copyright (c) 2009 Peter Hoeg Copyright (c) 2010-2016 Preston Lee

See LICENSE for details.

Authors

Authors/Contributors (in approximate order of appearance):

  • Javier Smaldone (javier |at| smaldone |dot| com |dot| ar)
  • Elliot Smith
  • Juan Ignacio Pumarino
  • Hajime Baba
  • Ana Nelson
  • Peter Hoeg
  • John McCaffrey
  • David Jones
  • Mike Dalessio
  • Preston Lee and Lee Does, the vendor providing maintenance.
  • Tim Harvey
  • Atli Christiansen
  • John Bintz (http://www.coswellproductions.com/)

And of course, many thanks to the many patch submitters and testers that make this possible!

railroady's People

Contributors

agnel avatar antonrogov avatar atli-c avatar avaynshtok avatar coderguy avatar douglasmeyer avatar eutopian avatar flavorjones avatar gekola avatar gshankar avatar hjdivad avatar jmccaffrey avatar johnbintz avatar melnikaite avatar mikedillion avatar mparramont avatar nbdy avatar nielsad avatar olleolleolle avatar peterhoeg avatar preston avatar primableatom avatar robertmaaskant avatar sadfuzzy avatar sandipransing avatar strangematter avatar tobias avatar unixmonkey avatar volontarian avatar zetavg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

railroady's Issues

rails 4 has_and_belongs_to_many not showing up correctly in models diagram

see app model:
class App < ActiveRecord::Base
has_and_belongs_to_many :gateways

see gateway model:
class Gateway < ActiveRecord::Base
has_and_belongs_to_many :apps

in between these 2 models is a join table 'apps_gateways' with no ID

on the diagram the apps_gateways shows up as 2 models/tables

  1. for app association shows 'AppsGateway' with an app has many relationship to it
  2. for gateway association shows 'GatewaysApp' with a gateway has many relationship to it

the join table should show up between the 2 models instead...only once!

Namespaced models produce unexpected results in has_many relationship.

Using mongoid v3.x and railroady v1.1.0.
Here is an example:

class Shop::Apple
  include Mongoid::Document
  # etc..

  has_many :bugs
end

class Bug
  include Mongoid::Document
  #etc..
  belongs_to :apple, class_name: "Shop::Apple"
end 

The following would produce a has_many arrow pointing to a "Shop::Bug" model when it should point to the (also drawn) "Bug" model. This also occurs for embedded relationships and so the problem is probably valid across the board.

Error while trying to run rake task

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
Rails 4.1.11

rake diagram:all --trace
** Invoke diagram:all (first_time)
** Invoke diagram:setup:create_new_doc_folder_if_needed (first_time)
** Execute diagram:setup:create_new_doc_folder_if_needed
** Invoke diagram:models:complete (first_time)
** Execute diagram:models:complete
Generating /Users/luiz/prott-api/doc/models_complete.svg
railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/luiz/prott-api/doc/models_complete.svg
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-rewrite-1.5.0/lib/rack/rewrite/rule.rb:172: warning: duplicated key at line 173 ignored: "Content-Type"
Error: <stdin>: syntax error in line 1 near 'W'
Warning: syntax ambiguity - badly delimited number '-03T' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '-03T' in line 2 of <stdin> splits into two tokens
rake aborted!
Command failed with status (1): [railroady -lamM | sed -E 's/\x1B\[([0-9]{1...]
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:66:in `block in create_shell_runner'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:57:in `call'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:57:in `sh'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils_ext.rb:37:in `sh'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railroady-1.4.2/tasks/railroady.rake:64:in `block (3 levels) in <top (required)>'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:201:in `block in invoke_prerequisites'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:199:in `each'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:199:in `invoke_prerequisites'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:178:in `block in invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/usr/local/var/rbenv/versions/2.2.2/bin/rake:33:in `<main>'
Tasks: TOP => diagram:all => diagram:models:complete

No dependencies specified in gemspec

This makes it hell to work with.
Yes, you use plaintext to specify required rails versions, but no more than that, allowing this to be installed in a rails 2.3.x system (which I'm running, and trying to use bundler to find me compatible diagram makers).

Sed does not accept -r option under OS X

I get an error when trying to launch it under OS X. Seems that the OSX's BSD sed does not have the -r option. Under BSD it's sed -E to have extended regexps…

$ rake diagram:all     
Generating /Users/sunny/code/foobar/doc/models_complete.svg
railroady -ilamM | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | dot -Tsvg > /Users/sunny/code/foobar/doc/models_complete.svg
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
…

Introduced in 1997e5e

Diagram for model vs subdirectory model is not generated correctly

hello, i have found if you have models like these two below

class System::User < ActiveRecord::Base
has_many :patients, foreign_key: "system_user_id"
end

class Patient < ActiveRecord::Base
belongs_to :system_user, :class_name => 'System::User', foreign_key: "system_user_id"
end

on diagram, model patient is not linked with model System::User instead new(non existing) model System::Patient is shown.

screen shot 2014-05-25 at 12 50 04

Carrier wave conflict

When I run rake diagram:all, the following error occurs

/home/amr/bedopedia/doc/models_complete.svg
/home/amr/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/orm/activerecord.rb:9:in `module:ActiveRecord': uninitialized constant CarrierWave::Mount (NameError)

What do you think is happening here ?

Issues running on x64_mingw

Hi,

Im receiving the following error message when attempting to run rake diagram:all on x64_mingw platform. GraphViz is installed and on PATH.

Here is the trace:

** Invoke diagram:all (first_time)
** Invoke diagram:setup:create_new_doc_folder_if_needed (first_time)
** Execute diagram:setup:create_new_doc_folder_if_needed
** Invoke diagram:models:complete (first_time)
** Execute diagram:models:complete
railroady -lamM | sed -r 's/\x1B[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > C:/Users/Maxime/Documents/wild-compass/doc/models_complete.svg
'K]' is not recognized as an internal or external command,
operable program or batch file.
rake aborted!
Command failed with status (255): [railroady -lamM | sed -r 's/\x1B[([0-9]{1...]
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/file_utils.rb:66:in block in create_shell_runner' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/file_utils.rb:57:incall'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/file_utils.rb:57:in sh' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/file_utils_ext.rb:37:insh'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/bundler/gems/railroady-490a01646523/tasks/railroady.rake:65:in block (3 levels) in <top (required)>' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:incall'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in block in execute' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:ineach'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in execute' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:inblock in invoke_with_call_chain'
c:/Ruby21-x64/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:ininvoke_with_call_chain'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:201:in block in invoke_prerequisites' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:199:ineach'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:199:in invoke_prerequisites' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:178:inblock in invoke_with_call_chain'
c:/Ruby21-x64/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:ininvoke_with_call_chain'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in invoke' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:ininvoke_task'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in block (2 levels) in top_level' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:ineach'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in block in top_level' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:inrun_with_threads'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in top_level' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:inblock in run'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in standard_exception_handling' c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:inrun'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in <top (required)>' c:/Ruby21-x64/bin/rake:23:inload'
c:/Ruby21-x64/bin/rake:23:in `

'
Tasks: TOP => diagram:all => diagram:models:complete
Generating C:/Users/Maxime/Documents/wild-compass/doc/models_complete.svg

Generating AASM diagram fails

Model:

class SomeModel < ActiveRecord::Base
  include AASM
end

Error:

$ bundle exec railroady --verbose -A
Loading application environment
Loading application classes as we go
Generating AASM diagram
    Processing SomeModel
        processing as acts_as_state_machine
~/.rvm/gems/ruby-2.1.1@gemset/gems/activerecord-4.1.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `read_inheritable_attribute' for #<Class:0x007ff8eee795e8> (NoMethodError)
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:68:in `block in process_acts_as_state_machine_class'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:67:in `each'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:67:in `process_acts_as_state_machine_class'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:58:in `process_class'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:26:in `block in generate'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:25:in `each'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/lib/railroady/aasm_diagram.rb:25:in `generate'
    from ~/.rvm/gems/ruby-2.1.1@gemset/gems/railroady-1.1.2/bin/railroady:54:in `<top (required)>'
    from ~/.rvm/gems/ruby-2.1.1@gemset/bin/railroady:23:in `load'
    from ~/.rvm/gems/ruby-2.1.1@gemset/bin/railroady:23:in `<main>'
    from ~/.rvm/gems/ruby-2.1.1@gemset/bin/ruby_executable_hooks:15:in `eval'
    from ~/.rvm/gems/ruby-2.1.1@gemset/bin/ruby_executable_hooks:15:in `<main>'

Installed gems:

rails (4.1.6)
aasm (3.3.3)
railroady (1.1.2)

Any ideas how to fix it?

*_id columns are removed even if not used as a reference

When I run the rake diagram:all command, and view the "complete model" file, I see all my tables, but there seems to be an issue with naming columns *_id when you are not referencing to another table but simply want to name that column myname_id.

f.e.

Account
title:string

Page
title:string
page_order:integer
parent_id:integer
account_id:integer

In this case the print-out would show:

Account
title:string
o
|
|
/\
Page
title:string
page_order:integer

Obviously it removes "account_id" in favor of the relationship "arrow", but it also removed "parent_id", which is not meant to specify a relationship but is in fact used to tell the app that the page with ID = X is the parent of the current page.

Printing large svg diagrams

Hi, I'm having problems printing the models_complete.svg file as it spans many pages.

I'm not sure if its just me (well could be), or if some markup needs to be changed in the svg file?
Here are the size/dimensions parts within the file :

<svg width="6137pt" height="3092pt" viewBox="0.00 0.00 6137.00 3092.00">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 3088)">
<polygon fill="white" stroke="white" points="-4,5 -4,-3088 6134,-3088 6134,5 -4,5"/>

Which no mater how I try to print it, within either InkScape/Firefox, either comes out very small on one page, or only prints 1 page of it full size!

Any clues/help? Cheers

issue when using rake diagram:all_with_engines

Currently tinkering railroady with spreecommerce and im getting a lot of uninitialized constant errors when generating the model using the all engines option. The model graph is blank but the controllers are generated with no problems.

Class name address singularized to addres

Hi,

there may a bug in lib / railroady / models_diagram.rb, line 125: assoc.class_name.underscore.singularize.camelize

Can you explain why you would singularize a class name, which should be always singularized? I have a Model Address (table name addresses), with railroady I get 'Addres' without any attributes and a second 'Address' with attributes, but completely standalone (no graphic relations).

I removed 'singularize' in line 125 and all goes right for me.

Does not pick up decorators

It looks like this is basing itself only on the actual files that exist in my app folder. I'd like to get a view of the models of the entire app, including models (lots of them) that are included by the various engines I have in my app via Gemfile. I also have piles of decorators that change the behavior of those included models.

Models in folders model/folder/folder/model.rb

Hi,

I do use this in my configuration. It doesn't mean the models are defined as Folder::Folder2::ModelName.

I did create a "fix" for this simply by grabbing the simple class name (last part), like this:

AppDiagram.rb

def extract_class_name_last_part(filename)
filename.split('/')[2..-1].collect { |i| i.camelize }.last.chomp(".rb")
end

ModelsDiagram.rb

def generate
STDERR.print "Generating models diagram\n" if @options.verbose
get_files.each do |f|
begin
process_class extract_class_name(f).constantize
rescue Exception
begin
process_class extract_class_name_last_part(f).constantize
rescue
STDERR.print "Warning: exception #{$!} raised while trying to load model class #{f}\n"
end
end

end

end

That's just a suggestion. It worked for me.

Thanks!

Marcos

Controller Inheritance

We have an app with lots of controller inheritance, would it be possible for railroady to show this?

rake -T barking NotImplementedError on Windows 7 (32-bit)

Sed on windows (GNU or installed along with git) wants option -r for extended Regex.

The railroady.rake task does not check for any other host_os except /linux | cygwin/
or /mac | darwin | bsd/.
Quick workaround was to simply add mingw32.

def self.sed
      regex = 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
      case RbConfig::CONFIG['host_os']
      when /linux|cygwin|mingw32/   # <<< patched 
        return "sed -r '#{regex}'"
      when /mac|darwin|bsd/
        return "sed -E '#{regex}'"
      else
        raise NotImplementedError
      end
    end

Not sure to include other host_os like /mswin|win|mingw/
or even Solaris likewise.

Also dunno when people use MS Visual C to compile gem extensions instead of mingw.

Fails when there's unexpected stdout

On my system, some Rails plugin appends to stdout output. E.g. this ends up in the .dot output:

Loaded suite /usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/bin/railroady
Started

Finished in 0.002417 seconds.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 56292

Then dot doesn't work. One workaround is to save the the output to a file first, and have dot work on that. Maybe RailRoady rake tasks could output their dot files, such as to tmp/railroady, to avoid problems like this and also make troubleshooting easier.

Update information on installing graphviz on osx

There are several competing package systems. The current front-runner seems to be Homebrew, which is what I in fact use.

To install graphviz on os-x using Homebrew:

brew install graphviz

Note that with Homebrew, there is no need (and it is not generally allowed) to use root, so no "sudo."

Breaks rails generate scaffold

Hi,

As mentioned here: http://www.ruby-forum.com/topic/701337 ... railroady seems to break the rails generate scaffold command (rails 3.0.4).

Another stack trace...

$ rails generate scaffold Widgets name:string
Plural version of the model detected, using singularized version. Override with --force-plural.
      invoke  active_record
      create    db/migrate/20110218131719_create_widgets.rb
      create    app/models/widget.rb
      invoke    rspec
      create      spec/models/widget_spec.rb
      invoke      factory_girl
      create        test/factories/widgets.rb
       route  resources :widgets
      invoke  scaffold_controller
      create    app/controllers/widgets_controller.rb
(erb):5:in `template': undefined method `all' for ActiveModel:Module (NoMethodError)
    from {ruby 1.9.2}/lib/ruby/1.9.1/erb.rb:753:in `eval'
    from {ruby 1.9.2}/lib/ruby/1.9.1/erb.rb:753:in `result'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:111:in `block in template'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `call'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `render'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `open'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block in invoke!'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `call'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:61:in `invoke!'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions.rb:95:in `action'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/create_file.rb:26:in `create_file'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:110:in `template'
    from {ruby 1.9.2 gems}/gems/railties-3.0.4/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb:14:in `create_controller_files'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/shell.rb:74:in `with_padding'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_scaffold_controller'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from {ruby 1.9.2 gems}/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from {ruby 1.9.2 gems}/gems/railties-3.0.4/lib/rails/generators.rb:163:in `invoke'
    from {ruby 1.9.2 gems}/gems/railties-3.0.4/lib/rails/commands/generate.rb:10:in `<top (required)>'
    from {ruby 1.9.2 gems}/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
    from {ruby 1.9.2 gems}/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `block in require'
    from {ruby 1.9.2 gems}/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from {ruby 1.9.2 gems}/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from {ruby 1.9.2 gems}/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
    from {ruby 1.9.2 gems}/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
    from {ruby 1.9.2 gems}/gems/railties-3.0.4/lib/rails/commands.rb:17:in `<top (required)>'    
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Jits

Exclude Typical plugins

Hello,

How can I disable the ActiveRecord:Base Inheritance (all my models are derived from it ofcourse) and the Verion model (this is from paper_trail gem). I tried to use the exclude file options (but nothing seems to work). My model view is quite complex and those two would make it a bit easier.

Thanks,

Regards

Exception: 'Expected X.rb to define X raised while trying to load model class'.

Trying railroady for the first time; fresh install:

$ mkdir doc
$ rake diagram:all
Generating /home/test/doc/models_complete.svg
railroady -ilamM | sed -r 's/\x1B[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /home/test/doc/models_complete.svg
Warning: exception Expected /home/test/app/models/A/B/X.rb to define A::B::X raised while trying to load model class app/models/A/B/X.rb
...
Same error for other classes...
...

Note: Loading class X in rails console produces no errors:
$ rails c -s

X
X


CentOS (2.6.32-358.el6.x86_64)
RailRoady v1.1.1
Rails 3.2.13

Gem not working for Rails 4

Generating /Users/sheerun/Projects/team-project/doc/models_complete.svg
railroady -ilamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/sheerun/Projects/team-project/doc/models_complete.svg
sh: /Users/sheerun/Projects/team-project/doc/models_complete.svg: No such file or directory
rake aborted!
Command failed with status (1): [railroady -ilamM | sed -E 's/\x1B\[([0-9]{...]

Tasks: TOP => diagram:all => diagram:models:complete
(See full trace by running task with --trace)

Error when including concern in model

I have a model Project which I includes concern:

class Project < ActiveRecord::Base
    include AuthorSettings
end
module AuthorSettings   
    extend ActiveSupport::Concern

    included do
        before_validation :set_up_author
    end

    def set_up_author
        self.created_by = 'Admin'
        self.updated_by = 'Admin'
    end

end

When I'm trying to invoke rake diagram:all I got an error:

** Invoke diagram:all (first_time)
** Invoke diagram:models:complete (first_time)
** Execute diagram:models:complete
Generating /Users/ograbek/Documents/my_projects/fpcalculator/doc/models_complete.svg
railroady -ilamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/ograbek/Documents/my_projects/fpcalculator/doc/models_complete.svg
sh: /Users/ograbek/Documents/my_projects/fpcalculator/doc/models_complete.svg: No such file or directory
Warning: exception Unable to autoload constant Concerns::AuthorSettings, expected /Users/ograbek/Documents/my_projects/fpcalculator/app/models/concerns/author_settings.rb to define it raised while trying to load model class app/models/concerns/author_settings.rb
rake aborted!
Command failed with status (1): [railroady -ilamM | sed -E 's/\x1B\[([0-9]{...]
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/file_utils.rb:54:in `block in create_shell_runner'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in `call'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in `sh'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/railroady-1.1.1/tasks/railroady.rake:55:in `block (3 levels) in <top (required)>'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/ograbek/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:195:in `each'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:195:in `invoke_prerequisites'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/Users/ograbek/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/bin/rake:23:in `load'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/bin/rake:23:in `<main>'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/bin/ruby_executable_hooks:15:in `eval'
/Users/ograbek/.rvm/gems/ruby-2.0.0-p247@fpcalculator/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => diagram:all => diagram:models:complete

Didn't automatically get Rake Tasks...

First: Thanks for the gem. The cli works like a champ. The write-up in the README is really good.

However, when I added railroady as a development dependency:

group :development do
  gem 'annotate',           '~> 2.6.5'
  gem 'capistrano-rails',   '~> 1.1.1'
  gem 'better_errors',      '~> 2.0.0'
  gem 'binding_of_caller',  '~> 0.7.2'
  gem 'railroady',          '~> 1.1.2'
end

I didn't get the diagram rake tasks.

I didn't get them until I copied railroady.rake from the gem into my lib/tasks folder; not ideal.

My Environment:

Mac OS X 10.9.5
rbEnv
Ruby 2.1.2
Rails 4.1.6
Bundler 1.7.3
Rake 10.3.2
Gem 2.4.1

I assume it's because I didn't do something. Any help will be greatly appreciated.

get error Command failed with status (2) when run 'rake diagram:all'

Hi, I have installed railroady, but I get the error: 'Command failed with status (2)' when run 'rake diagram:all'. I am using rails v4.2.0. It creates the /doc file without any problems.

Here is the full error message:

sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
rake aborted!
Command failed with status (2): [railroady -lamM | sed -E 's/\x1B[([0-9]{1...]

rake aborted!

I can't run rake diagrame:all
The outpout is:

rake aborted!
Don't know how to build task 'diagram:all'

'neato' and 'dot' are available in the commande line..
( I am on ubuntu 14.04, rails 4.2.0 )

sh: dot: command not found and Command failed with status (127)

If I execute rake diagram:all using Rails 4.1.1 with Ruby 2.1.2p95 I get the following output:

MBAir:ticketee-app-d2393ce208c426bcd737d685e9648686546be584 simonweber$ bundle exec rake diagram:all --trace
** Invoke diagram:all (first_time)
** Invoke diagram:setup:create_new_doc_folder_if_needed (first_time)
** Execute diagram:setup:create_new_doc_folder_if_needed
** Invoke diagram:models:complete (first_time)
** Execute diagram:models:complete
Generating /Users/simonweber/Downloads/ticketee-app-d2393ce208c426bcd737d685e9648686546be584/doc/models_complete.svg
railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/simonweber/Downloads/ticketee-app-d2393ce208c426bcd737d685e9648686546be584/doc/models_complete.svg
sh: dot: command not found
rake aborted!
Command failed with status (127): [railroady -lamM | sed -E 's/\x1B\[([0-9]{1...]
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb:54:in `block in create_shell_runner'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb:45:in `call'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb:45:in `sh'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railroady-1.3.0/tasks/railroady.rake:65:in `block (3 levels) in <top (required)>'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:199:in `each'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:199:in `invoke_prerequisites'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Users/simonweber/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/Users/simonweber/.rbenv/versions/2.1.2/bin/rake:23:in `load'
/Users/simonweber/.rbenv/versions/2.1.2/bin/rake:23:in `<main>'
Tasks: TOP => diagram:all => diagram:models:complete

uninitialized constant exception with namespaced models

Hi all !

I use namespaces in my application. My models are like this :
School::Teacher in models/school/teacher.rb
School::Student in models/school/student.rb
School::Lesson in models/school/lesson.rb

When I try to generate diagrams, it raises the following exceptions for each model

Warning: exception uninitialized constant Student raised while trying to load model class app/models/school/student.rb

I think it's linked to this pull request : singlebrook#1

Is there a way to tell railroady to consider the parent folder name as a prefix to my models ?

Thanks!

Problem with including classes from other gems

When I had some gems In my application root folder for example:

-app
-some_gem
-some_other_gem
-...

Even if I use options to include all classes (-m -a -p and so on) I get only classes from app folder.

Error in windows

Hello,

I have problem to get railroady working on my Windows Vista 64 machine.

I'm getting this:

$ railroady -a -M
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railroady-1.0.7/lib/railroady/app_diagram.rb:69:in `reopen': No such file or directory - /dev/null (Errno::ENOENT)
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railroady-1.0.7/lib/railroady/app_diagram.rb:69:in `disable_stdout'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railroady-1.0.7/lib/railroady/app_diagram.rb:54:in `load_environment'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railroady-1.0.7/lib/railroady/app_diagram.rb:45:in `process'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railroady-1.0.7/bin/railroady:52:in `<top (required)>'
    from c:/Ruby193/bin/railroady:19:in `load'
    from c:/Ruby193/bin/railroady:19:in `<main>'

Error: <stdin>:1: syntax error near line 1

When I run diagram:all, and then even just

rake diagram:models:brief

I get an error:

rake diagram:models:brief
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
Generating /wherever/doc/models_brief.svg
railroady -bilamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /wherever/doc/models_brief.svg
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
Error: <stdin>:1: syntax error near line 1
context:   >>>   (0.4ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" 
Warning: <stdin>:1: ambiguous "1m" splits into two names: "1" and "m"
Warning: <stdin>:1: ambiguous "36m" splits into two names: "36" and "m"
Warning: <stdin>:1: ambiguous "0.4ms" splits into two names: "0.4" and "ms"
Warning: <stdin>:1: ambiguous "0m" splits into two names: "0" and "m"
Warning: <stdin>:1: ambiguous "1mSELECT" splits into two names: "1" and "mSELECT"
Warning: <stdin>:1: ambiguous "0m" splits into two names: "0" and "m"
rake aborted!
Command failed with status (1): [railroady -bilamM | sed -E 's/\x1B\[([0-9]...]

Tasks: TOP => diagram:models:brief
(See full trace by running task with --trace)

so with trace,

rake diagram:models:brief --trace
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
** Invoke diagram:models:brief (first_time)
** Execute diagram:models:brief
Generating /wherever/doc/models_brief.svg
railroady -bilamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /wherever/doc/models_brief.svg
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
Error: <stdin>:1: syntax error near line 1
context:   >>>   (0.6ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" 
Warning: <stdin>:1: ambiguous "1m" splits into two names: "1" and "m"
Warning: <stdin>:1: ambiguous "36m" splits into two names: "36" and "m"
Warning: <stdin>:1: ambiguous "0.6ms" splits into two names: "0.6" and "ms"
Warning: <stdin>:1: ambiguous "0m" splits into two names: "0" and "m"
Warning: <stdin>:1: ambiguous "1mSELECT" splits into two names: "1" and "mSELECT"
Warning: <stdin>:1: ambiguous "0m" splits into two names: "0" and "m"
rake aborted!
Command failed with status (1): [railroady -bilamM | sed -E 's/\x1B\[([0-9]...]
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@rails322Platypus/gems/railroady-1.1.0/tasks/railroady.rake:62:in `block (3 levels) in <top (required)>'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/MYUSER/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/bin/rake:19:in `load'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@global/bin/rake:19:in `<main>'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@rails322Platypus/bin/ruby_noexec_wrapper:14:in `eval'
/MYUSER/.rvm/gems/ruby-1.9.3-p125@rails322Platypus/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => diagram:models:brief

Any suggestions? Thanks for your hard work on this.

Leave ActiveRecord::Base out of diagrams?

Hi,

Really love the diagrams that railroady is producing. Great Work!

Was just wondering if its possible to exclude ActiveRecord::Base out of the diagrams as it is associated with every model in the models and cluttering it up a little.

Thanks

Execute on db:migrate or generate controller

This is a feature request and I don't know how feasible it is but…

To keep the diagrams in sync with the controllers and models, could their generations somehow be hooked onto the the appropriate generators or db:migrate so the diagrams update whenever what they represent gets updated?

Rails SQL log spam when calling railroady

Whenever I run railroady through the rake task in dev mode the very first thing that happens is rails prints out some SQL log messages, followed by the actual output. These then get piped to dot, which rightfully errors out. See below for example output:

image

I can work around the issue in bin/railroady:53 by adding the following code:

     diagram.process
     ActiveRecord::Base.logger.level = 1 if defined?(ActiveRecord)
     diagram.generate

Unfortunately this feels like a bit of a hack so I am hesitant so submit a patch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.