forked from nono/railroad
-
Notifications
You must be signed in to change notification settings - Fork 6
/
README.txt
176 lines (127 loc) · 6.16 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
= RailRoad
RailRoad generates models and controllers diagrams in DOT language for a
Rails application.
= Usage
Run RailRoad on 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.
railroad [options] command
== Options
Common options:
-b, --brief Generate compact diagram
(no attributes nor methods)
-e, --exclude file1[,fileN] Exclude given files
-c, --class-map file1,MyClass1[,fileN,MyClassN]
Map files to classes they contain
-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
-v, --verbose Enable verbose output
(produce messages to STDOUT)
-u, --yuml Produce yuml instead of DOT
(for http://yuml.me)
Models diagram options:
-a, --all Include all models
(not only ActiveRecord::Base derived)
--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
-y, --libraries Include application library
-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
Other options:
-h, --help Show this message
--version Show version and copyright
== Commands
-M, --models Generate models diagram
-C, --controllers Generate controllers diagram
-A, --aasm Generate "acts as state machine" diagram
-L, --lifecycle Generate Hobo::Lifecycle state machine diagram
== Examples
railroad -o models.dot -M
Produces a models diagram to the file 'models.dot'
railroad -a -i -o full_models.dot -M
Models diagram with all classes showing inheritance relations
railroad -M | dot -Tsvg > models.svg
Model diagram in SVG format
railroad -M -u
Print yuml format diagram, used by http://yuml.me
railroad -C | neato -Tpng > controllers.png
Controller diagram in PNG format
railroad -h
Shows usage help
= Processing DOT files
To produce a PNG image from model diagram generated by RailRoad 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
sed -i 's/font-size:14.00/font-size:11px/g' file.svg # alternative
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).
= validation_reflection
If you have the
[validation_reflection](http://github.com/redinger/validation_reflection/tree/master)
plugin installed, your model ERD diagrams will properly distinguish
between required and optional associations.
Required associations are those that contain a
*validates_presence_of*, *validates_existence_of*,
*validates_associated*, or *validates_length_of* validation.
= RailRoad as a rake task
This version of railroad also works as a plugin.
script/plugin install git://github.com/bryanlarsen/railroad.git
`rake doc:diagrams` produces 'doc/diagrams/models.svg',
'doc/diagrams/controllers.svg', and 'doc/diagrams/states.svg' and
'doc/diagrams/lifecycle.svg'
Update 'lib/railroad/tasks/diagrams.rake' to change the options for
your diagrams.
Running RailRoad as a rake task ensures that all of your plugins are
loaded correctly, and may work when railroad from the command line
fails.
These rake tasks are also available if you install railroad as a gem.
In that case, add to your top-level Rakefile:
require 'railroad/tasks/diagrams'
= Requirements
RailRoad has been tested with Ruby 1.8.5 and Rails 1.1.6 to 1.2.3
applications. There is 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://railroad.rubyforge.org
= License
RailRoad 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.
= Author
Javier Smaldone
(javier -at- smaldone -dot- com -dot- ar, http://blog.smaldone.com.ar )
== Contributors
Thomas Ritz http://www.galaxy-ritz.de
Tien Dung http://github.com/tiendung
Factory Design Labs http://github.com/factorylabs
Mike Mondragon http://github.com/monde
Tero Tilus http://github.com/terotil
Bruno Michel http://github.com/nono
Bryan Larsen http://github.com/bryanlarsen
Allen Wei http://github.com/allenwei