railroady 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +16 -7
- data/bin/railroady +4 -3
- data/lib/railroady/app_diagram.rb +1 -0
- data/lib/railroady/diagram_graph.rb +10 -5
- data/lib/railroady/options_struct.rb +4 -0
- data/lib/railroady/version.rb +1 -1
- data/railroady.gemspec +1 -1
- data/tasks/railroady.rake +20 -10
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e3747c5c99a23bc76daeb07ba2afee3688a470
|
4
|
+
data.tar.gz: df60108b7a16afdf595baa3ee61464130776f013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e91ce3076f9d0a7a326d50052d50b761340786f581f02a1516b36ac6139a3f443fe7fd1b1bda72455a717103e8f6b7d820c356c0fc0def5d66ca29c70102d2e
|
7
|
+
data.tar.gz: b4debced96a4b045aaaf19ccbaba2dcb33effe84a5233c502962d3d4c775535c480d17f9ea4e518bbbd849f9c1e5cc2115ab328c96fbbebceab274d8696faede
|
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= RailRoady
|
2
2
|
|
3
|
-
RailRoady generates Rails 3/4 model (
|
3
|
+
RailRoady generates Rails 3/4 model (ActiveRecord, Mongoid, Datamapper) and controller UML diagrams as cross-platform .svg files, as well as in the DOT language.
|
4
4
|
|
5
5
|
Code is based on the original "railroad" gem, patched and maintained over the years. Lineage can be traced via GitHub.
|
6
6
|
|
7
|
-
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 v3 projects. Rails v2 is not supported.
|
7
|
+
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 v3 and v4 projects. Rails v2 is not supported.
|
8
8
|
|
9
9
|
= System Requirements
|
10
10
|
|
@@ -15,13 +15,19 @@ You MUST have the the following utilities available at the command line.
|
|
15
15
|
|
16
16
|
= Mac users
|
17
17
|
|
18
|
-
MacPorts users can install in via
|
19
|
-
|
18
|
+
MacPorts users can install in via
|
19
|
+
|
20
|
+
sudo port install graphviz
|
21
|
+
|
22
|
+
Brew user can install via
|
23
|
+
|
24
|
+
brew install graphviz
|
20
25
|
|
21
26
|
= Ubuntu users
|
22
27
|
|
23
|
-
Ubuntu users can install in via
|
28
|
+
Ubuntu users can install in via
|
24
29
|
|
30
|
+
sudo apt-get install graphviz
|
25
31
|
= Usage
|
26
32
|
|
27
33
|
The easiest (and recommend) usage is to include railroady as a development dependency with your Rails 3 Gemfile, like so...
|
@@ -34,7 +40,7 @@ The easiest (and recommend) usage is to include railroady as a development depen
|
|
34
40
|
|
35
41
|
rake diagram:all
|
36
42
|
|
37
|
-
This should generate four doc/*.svg files that can be opened in (most) web browsers as well as
|
43
|
+
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.
|
38
44
|
|
39
45
|
= Alternate Usage
|
40
46
|
|
@@ -57,6 +63,7 @@ Common options:
|
|
57
63
|
-o, --output FILE Write diagram to file FILE
|
58
64
|
-v, --verbose Enable verbose output
|
59
65
|
(produce messages to STDOUT)
|
66
|
+
--alphabetize Sort methods alphabetically
|
60
67
|
|
61
68
|
Models diagram options:
|
62
69
|
-a, --all Include all models
|
@@ -134,7 +141,7 @@ also use Omnigraffle (on Mac OS X).
|
|
134
141
|
|
135
142
|
= Rake Tasks
|
136
143
|
|
137
|
-
As of Preston Lee's Rails 3 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.)
|
144
|
+
As of Preston Lee's Rails 3/4 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.)
|
138
145
|
|
139
146
|
|
140
147
|
= Requirements
|
@@ -143,9 +150,11 @@ RailRoady has been tested with the following Ruby and Rails versions
|
|
143
150
|
|
144
151
|
== Ruby
|
145
152
|
* 1.9.2+
|
153
|
+
* 2.0.0+
|
146
154
|
|
147
155
|
== Rails
|
148
156
|
* 3.0.3+
|
157
|
+
* 4.0.0+
|
149
158
|
|
150
159
|
There are no additional requirements (nevertheless, all your Rails application
|
151
160
|
requirements must be installed).
|
data/bin/railroady
CHANGED
@@ -36,11 +36,12 @@ old_dir = Dir.pwd
|
|
36
36
|
|
37
37
|
Dir.chdir(options.root) if options.root != ''
|
38
38
|
|
39
|
-
|
39
|
+
case options.command
|
40
|
+
when 'models'
|
40
41
|
diagram = ModelsDiagram.new options
|
41
|
-
|
42
|
+
when 'controllers'
|
42
43
|
diagram = ControllersDiagram.new options
|
43
|
-
|
44
|
+
when 'aasm'
|
44
45
|
diagram = AasmDiagram.new(options)
|
45
46
|
else
|
46
47
|
STDERR.print "#{APP_HUMAN_NAME} v#{APP_VERSION}\n" +
|
@@ -10,7 +10,8 @@ class DiagramGraph
|
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
@diagram_type = ''
|
13
|
-
@show_label
|
13
|
+
@show_label = false
|
14
|
+
@alphabetize = false
|
14
15
|
@nodes = []
|
15
16
|
@edges = []
|
16
17
|
end
|
@@ -31,6 +32,10 @@ class DiagramGraph
|
|
31
32
|
@show_label = value
|
32
33
|
end
|
33
34
|
|
35
|
+
def alphabetize= (flag)
|
36
|
+
@alphabetize = flag
|
37
|
+
end
|
38
|
+
|
34
39
|
|
35
40
|
# Generate DOT graph
|
36
41
|
def to_dot
|
@@ -78,7 +83,7 @@ class DiagramGraph
|
|
78
83
|
case type
|
79
84
|
when 'model'
|
80
85
|
options = 'shape=Mrecord, label="{' + name + '|'
|
81
|
-
options += attributes.join('\l')
|
86
|
+
options += attributes.sort_by { |s| @alphabetize ? s : nil }.join('\l')
|
82
87
|
options += '\l}"'
|
83
88
|
when 'model-brief'
|
84
89
|
options = ''
|
@@ -88,9 +93,9 @@ class DiagramGraph
|
|
88
93
|
options = 'shape=box'
|
89
94
|
when 'controller'
|
90
95
|
options = 'shape=Mrecord, label="{' + name + '|'
|
91
|
-
public_methods = attributes[:public].join('\l')
|
92
|
-
protected_methods = attributes[:protected].join('\l')
|
93
|
-
private_methods = attributes[:private].join('\l')
|
96
|
+
public_methods = attributes[:public].sort_by { |s| @alphabetize ? s : nil }.join('\l')
|
97
|
+
protected_methods = attributes[:protected].sort_by { |s| @alphabetize ? s : nil }.join('\l')
|
98
|
+
private_methods = attributes[:private].sort_by { |s| @alphabetize ? s : nil }.join('\l')
|
94
99
|
options += public_methods + '\l|' + protected_methods + '\l|' +
|
95
100
|
private_methods + '\l'
|
96
101
|
options += '}"'
|
@@ -32,6 +32,7 @@ class OptionsStruct < OpenStruct
|
|
32
32
|
:hide_through => false,
|
33
33
|
:transitive => false,
|
34
34
|
:verbose => false,
|
35
|
+
:alphabetize => false,
|
35
36
|
:xmi => false,
|
36
37
|
:command => '',
|
37
38
|
:config_file => 'config/environment',
|
@@ -75,6 +76,9 @@ class OptionsStruct < OpenStruct
|
|
75
76
|
" (for UML tools)") do |x|
|
76
77
|
self.xmi = x
|
77
78
|
end
|
79
|
+
opts.on("--alphabetize", "Sort methods alphabetically") do |a|
|
80
|
+
self.alphabetize = a
|
81
|
+
end
|
78
82
|
opts.separator ""
|
79
83
|
opts.separator "Models diagram options:"
|
80
84
|
opts.on("-a", "--all", "Include all models",
|
data/lib/railroady/version.rb
CHANGED
data/railroady.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = RailRoady::VERSION
|
9
9
|
spec.authors = ["Preston Lee", "Tobias Crawley", "Peter Hoeg", "Javier Smaldone"]
|
10
10
|
spec.description = "Ruby on Rails 3/4 model and controller UML class diagram generator. Originally based on the 'railroad' plugin and contributions of many others. (`sudo port install graphviz` before use!)"
|
11
|
-
spec.email = ["
|
11
|
+
spec.email = ["preston.lee@prestonlee.com", "tcrawley@gmail.com", "peter@hoeg.com", "p.hoeg@northwind.sg", "javier@smaldone.com.ar"]
|
12
12
|
spec.summary = "Ruby on Rails 3/4 model and controller UML class diagram generator."
|
13
13
|
spec.homepage = "http://github.com/preston/railroady"
|
14
14
|
spec.license = "GPLv2"
|
data/tasks/railroady.rake
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# This suite of tasks generate graphical diagrams via code analysis.
|
2
2
|
# A UNIX-like environment is required as well as:
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# * The railroady gem. (http://github.com/preston/railroady)
|
5
5
|
# * The graphviz package which includes the `dot` and `neato` command-line utilities. MacPorts users can install in via `sudo port install graphviz`.
|
6
6
|
# * The `sed` command-line utility, which should already be available on all sane UNIX systems.
|
7
7
|
#
|
8
|
-
# Author: Preston Lee, http://railroady.prestonlee.com
|
8
|
+
# Author: Preston Lee, http://railroady.prestonlee.com
|
9
9
|
|
10
10
|
# wrap helper methods so they don't conflict w/ methods on Object
|
11
11
|
|
@@ -26,7 +26,7 @@ module RailRoady
|
|
26
26
|
def self.sed
|
27
27
|
regex = 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
|
28
28
|
case RbConfig::CONFIG['host_os']
|
29
|
-
when /linux|cygwin/
|
29
|
+
when /linux|cygwin|mingw/
|
30
30
|
return "sed -r '#{regex}'"
|
31
31
|
when /mac|darwin|bsd/
|
32
32
|
return "sed -E '#{regex}'"
|
@@ -40,11 +40,18 @@ end
|
|
40
40
|
|
41
41
|
namespace :diagram do
|
42
42
|
|
43
|
-
@MODELS_ALL
|
44
|
-
@MODELS_BRIEF
|
45
|
-
@CONTROLLERS_ALL
|
46
|
-
@CONTROLLERS_BRIEF
|
47
|
-
@SED
|
43
|
+
@MODELS_ALL = RailRoady::RakeHelpers.full_path("models_complete.#{RailRoady::RakeHelpers.format}").freeze
|
44
|
+
@MODELS_BRIEF = RailRoady::RakeHelpers.full_path("models_brief.#{RailRoady::RakeHelpers.format}").freeze
|
45
|
+
@CONTROLLERS_ALL = RailRoady::RakeHelpers.full_path("controllers_complete.#{RailRoady::RakeHelpers.format}").freeze
|
46
|
+
@CONTROLLERS_BRIEF = RailRoady::RakeHelpers.full_path("controllers_brief.#{RailRoady::RakeHelpers.format}").freeze
|
47
|
+
@SED = RailRoady::RakeHelpers.sed
|
48
|
+
|
49
|
+
namespace :setup do
|
50
|
+
desc 'Perform any setup needed for the gem'
|
51
|
+
task :create_new_doc_folder_if_needed do
|
52
|
+
Dir.mkdir('doc') unless File.exists?('doc')
|
53
|
+
end
|
54
|
+
end
|
48
55
|
|
49
56
|
namespace :models do
|
50
57
|
|
@@ -83,6 +90,9 @@ namespace :diagram do
|
|
83
90
|
end
|
84
91
|
|
85
92
|
desc 'Generates all class diagrams.'
|
86
|
-
task :
|
87
|
-
|
93
|
+
task all: ['diagram:setup:create_new_doc_folder_if_needed',
|
94
|
+
'diagram:models:complete',
|
95
|
+
'diagram:models:brief',
|
96
|
+
'diagram:controllers:complete',
|
97
|
+
'diagram:controllers:brief']
|
88
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railroady
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Preston Lee
|
@@ -11,83 +11,83 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '0'
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: minitest
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: minitest-spec-context
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- -
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: activesupport
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
description: Ruby on Rails 3/4 model and controller UML class diagram generator. Originally
|
87
87
|
based on the 'railroad' plugin and contributions of many others. (`sudo port install
|
88
88
|
graphviz` before use!)
|
89
89
|
email:
|
90
|
-
-
|
90
|
+
- preston.lee@prestonlee.com
|
91
91
|
- tcrawley@gmail.com
|
92
92
|
- peter@hoeg.com
|
93
93
|
- p.hoeg@northwind.sg
|
@@ -97,7 +97,7 @@ executables:
|
|
97
97
|
extensions: []
|
98
98
|
extra_rdoc_files: []
|
99
99
|
files:
|
100
|
-
- .gitignore
|
100
|
+
- ".gitignore"
|
101
101
|
- AUTHORS.rdoc
|
102
102
|
- CHANGELOG.rdoc
|
103
103
|
- Gemfile
|
@@ -141,17 +141,17 @@ require_paths:
|
|
141
141
|
- lib
|
142
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- -
|
149
|
+
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.2.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Ruby on Rails 3/4 model and controller UML class diagram generator.
|