railroady 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +13 -16
- data/Guardfile +50 -0
- data/README.rdoc +8 -1
- data/lib/railroady/aasm_diagram.rb +7 -6
- data/lib/railroady/app_diagram.rb +16 -0
- data/lib/railroady/controllers_diagram.rb +12 -0
- data/lib/railroady/models_diagram.rb +14 -2
- data/lib/railroady/options_struct.rb +12 -0
- data/lib/railroady/version.rb +1 -1
- data/railroady.gemspec +0 -1
- data/tasks/railroady.rake +50 -2
- data/test/file_fixture/app/models/concerns/taggable.rb +0 -0
- data/test/file_fixture/lib/app/controllers/dummy/dummy_controller.rb +0 -0
- data/test/file_fixture/lib/app/models/dummy1.rb +0 -0
- data/test/lib/railroady/aasm_diagram_spec.rb +7 -0
- data/test/lib/railroady/controllers_diagram_spec.rb +10 -0
- data/test/lib/railroady/diagram_graph_spec.rb +11 -11
- data/test/lib/railroady/models_diagram_spec.rb +16 -0
- data/test/spec_helper.rb +1 -1
- metadata +10 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5ab1921e48623ca0993f9c7ca08186802204b3
|
4
|
+
data.tar.gz: eb23360fc687b72eddcba86d3eba896a2b3d791c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5956104262321ebcde50f24d5eee2b6a043f9a7972b613a041270d55851b811cc169ee32d8ef5fecbbe67a1e3d5a8abc86ae78efa0e8cd35a456b76289d24841
|
7
|
+
data.tar.gz: c64b8551d6d1824a01193862f1b188166197b3825d12576aa08eba471d7e6ea0df8f1c25747d592a29c32fc6c5d7b0fcb557728f39edfb232d3c6ef70500369d
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,26 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
railroady (1.
|
4
|
+
railroady (1.3.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (4.
|
10
|
-
i18n (~> 0.
|
11
|
-
|
12
|
-
|
9
|
+
activesupport (4.2.0)
|
10
|
+
i18n (~> 0.7)
|
11
|
+
json (~> 1.7, >= 1.7.7)
|
12
|
+
minitest (~> 5.1)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
i18n (0.7.0)
|
16
|
+
json (1.8.1)
|
17
|
+
minitest (5.5.0)
|
18
|
+
rake (10.4.2)
|
19
|
+
thread_safe (0.3.4)
|
20
|
+
tzinfo (1.2.2)
|
13
21
|
thread_safe (~> 0.1)
|
14
|
-
tzinfo (~> 0.3.37)
|
15
|
-
atomic (1.1.10)
|
16
|
-
i18n (0.6.4)
|
17
|
-
minitest (4.7.5)
|
18
|
-
minitest-spec-context (0.0.3)
|
19
|
-
multi_json (1.7.7)
|
20
|
-
rake (10.1.0)
|
21
|
-
thread_safe (0.1.2)
|
22
|
-
atomic
|
23
|
-
tzinfo (0.3.37)
|
24
22
|
|
25
23
|
PLATFORMS
|
26
24
|
ruby
|
@@ -29,6 +27,5 @@ DEPENDENCIES
|
|
29
27
|
activesupport
|
30
28
|
bundler
|
31
29
|
minitest
|
32
|
-
minitest-spec-context
|
33
30
|
railroady!
|
34
31
|
rake
|
data/Guardfile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec feature)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
16
|
+
## Note: if you are using the `directories` clause above and you are not
|
17
|
+
## watching the project directory ('.'), the you will want to move the Guardfile
|
18
|
+
## to a watched dir and symlink it back, e.g.
|
19
|
+
#
|
20
|
+
# $ mkdir config
|
21
|
+
# $ mv Guardfile config/
|
22
|
+
# $ ln -s config/Guardfile .
|
23
|
+
#
|
24
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
|
+
|
26
|
+
guard :minitest do
|
27
|
+
# with Minitest::Unit
|
28
|
+
# watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
29
|
+
# watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
30
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
31
|
+
|
32
|
+
# with Minitest::Spec
|
33
|
+
# watch(%r{^spec/(.*)_spec\.rb$})
|
34
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
35
|
+
# watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
36
|
+
|
37
|
+
watch(%r{^test/(.*)_spec\.rb$})
|
38
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_spec.rb" }
|
39
|
+
watch(%r{^test/spec_helper\.rb$}) { 'test' }
|
40
|
+
|
41
|
+
# Rails 4
|
42
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
43
|
+
# watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
|
44
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
|
45
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
46
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
|
47
|
+
# watch(%r{^test/.+_test\.rb$})
|
48
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
49
|
+
|
50
|
+
end
|
data/README.rdoc
CHANGED
@@ -42,6 +42,12 @@ The easiest (and recommend) usage is to include railroady as a development depen
|
|
42
42
|
|
43
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.
|
44
44
|
|
45
|
+
= Support for Engines
|
46
|
+
|
47
|
+
Generate diagram for models and controllers including those in the engines.
|
48
|
+
|
49
|
+
rake diagram:all_with_engines
|
50
|
+
|
45
51
|
= Alternate Usage
|
46
52
|
|
47
53
|
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.
|
@@ -76,6 +82,7 @@ Models diagram options:
|
|
76
82
|
-j, --join Concentrate edges
|
77
83
|
-m, --modules Include modules
|
78
84
|
-p, --plugins-models Include plugins models
|
85
|
+
-z, --engine-models Include engine models
|
79
86
|
-t, --transitive Include transitive associations
|
80
87
|
(through inheritance)
|
81
88
|
|
@@ -83,7 +90,7 @@ Controllers diagram options:
|
|
83
90
|
--hide-public Hide public methods
|
84
91
|
--hide-protected Hide protected methods
|
85
92
|
--hide-private Hide private methods
|
86
|
-
|
93
|
+
--engine-controllers Show engine controllers
|
87
94
|
Other options:
|
88
95
|
-h, --help Show this message
|
89
96
|
--version Show version and copyright
|
@@ -28,8 +28,9 @@ class AasmDiagram < AppDiagram
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def get_files(prefix ='')
|
31
|
-
files = !@options.specify.empty? ? Dir.glob(@options.specify) : Dir.glob(prefix
|
31
|
+
files = !@options.specify.empty? ? Dir.glob(@options.specify) : Dir.glob(prefix + "app/models/**/*.rb")
|
32
32
|
files += Dir.glob("vendor/plugins/**/app/models/*.rb") if @options.plugins_models
|
33
|
+
files -= Dir.glob(prefix + "app/models/concerns/**/*.rb") unless @options.include_concerns
|
33
34
|
files -= Dir.glob(@options.exclude)
|
34
35
|
files
|
35
36
|
end
|
@@ -62,7 +63,7 @@ class AasmDiagram < AppDiagram
|
|
62
63
|
def process_acts_as_state_machine_class(current_class)
|
63
64
|
node_attribs = []
|
64
65
|
node_type = 'aasm'
|
65
|
-
|
66
|
+
|
66
67
|
STDERR.print "\t\tprocessing as acts_as_state_machine\n" if @options.verbose
|
67
68
|
current_class.states.each do |state_name|
|
68
69
|
state = current_class.read_inheritable_attribute(:states)[state_name]
|
@@ -88,14 +89,14 @@ class AasmDiagram < AppDiagram
|
|
88
89
|
node_type = 'aasm'
|
89
90
|
|
90
91
|
STDERR.print "\t\tprocessing as aasm\n" if @options.verbose
|
91
|
-
current_class.
|
92
|
-
node_shape = (current_class.
|
92
|
+
current_class.aasm.states.each do |state|
|
93
|
+
node_shape = (current_class.aasm.initial_state === state.name) ? ", peripheries = 2" : ""
|
93
94
|
node_attribs << "#{current_class.name.downcase}_#{state.name} [label=#{state.name} #{node_shape}];"
|
94
95
|
end
|
95
96
|
@graph.add_node [node_type, current_class.name, node_attribs]
|
96
97
|
|
97
|
-
current_class.
|
98
|
-
event.
|
98
|
+
current_class.aasm.events.each do |event_name, event|
|
99
|
+
event.transitions.each do |transition|
|
99
100
|
@graph.add_edge [
|
100
101
|
'event',
|
101
102
|
current_class.name.downcase + "_" + transition.from.to_s,
|
@@ -46,6 +46,22 @@ class AppDiagram
|
|
46
46
|
load_environment
|
47
47
|
end
|
48
48
|
|
49
|
+
# get all engines
|
50
|
+
def engines
|
51
|
+
engines = []
|
52
|
+
|
53
|
+
if defined?(Rails)
|
54
|
+
engines = if Rails::Application::Railties.respond_to?(:engines)
|
55
|
+
Rails::Application::Railties.engines
|
56
|
+
else
|
57
|
+
# rails 4 way of getting engines
|
58
|
+
Rails::Engine.subclasses.map(&:instance)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
engines
|
62
|
+
end
|
63
|
+
|
64
|
+
|
49
65
|
private
|
50
66
|
|
51
67
|
# Load Rails application's environment
|
@@ -39,10 +39,22 @@ class ControllersDiagram < AppDiagram
|
|
39
39
|
|
40
40
|
def get_files(prefix ='')
|
41
41
|
files = !@options.specify.empty? ? Dir.glob(@options.specify) : Dir.glob(prefix << "app/controllers/**/*_controller.rb")
|
42
|
+
files += get_engine_files if @options.engine_controllers
|
42
43
|
files -= Dir.glob(@options.exclude)
|
43
44
|
files
|
44
45
|
end
|
46
|
+
|
47
|
+
def get_engine_files
|
48
|
+
engines.collect { |engine| Dir.glob("#{engine.root.to_s}/app/controllers/**/*_controller.rb")}.flatten
|
49
|
+
end
|
50
|
+
|
51
|
+
def extract_class_name(filename)
|
52
|
+
controller_index = filename.split('/').index("controllers") + 1
|
53
|
+
filename.split('/')[controller_index..-1].collect { |i| i.camelize }.join('::').chomp(".rb")
|
54
|
+
end
|
55
|
+
|
45
56
|
|
57
|
+
|
46
58
|
private
|
47
59
|
# Load controller classes
|
48
60
|
def load_classes
|
@@ -24,17 +24,29 @@ class ModelsDiagram < AppDiagram
|
|
24
24
|
rescue Exception
|
25
25
|
STDERR.puts "Warning: exception #{$!} raised while trying to load model class #{f}"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def get_files(prefix ='')
|
32
|
-
files = !@options.specify.empty? ? Dir.glob(@options.specify) : Dir.glob(prefix
|
32
|
+
files = !@options.specify.empty? ? Dir.glob(@options.specify) : Dir.glob(prefix + "app/models/**/*.rb")
|
33
33
|
files += Dir.glob("vendor/plugins/**/app/models/*.rb") if @options.plugins_models
|
34
|
+
files -= Dir.glob(prefix + "app/models/concerns/**/*.rb") unless @options.include_concerns
|
35
|
+
files += get_engine_files if @options.engine_models
|
34
36
|
files -= Dir.glob(@options.exclude)
|
35
37
|
files
|
36
38
|
end
|
37
39
|
|
40
|
+
def get_engine_files
|
41
|
+
engines.collect { |engine| Dir.glob("#{engine.root.to_s}/app/models/**/*.rb")}.flatten
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def extract_class_name(filename)
|
46
|
+
filename.split('/').last.camelize.chomp(".rb")
|
47
|
+
end
|
48
|
+
|
49
|
+
|
38
50
|
# Process a model class
|
39
51
|
def process_class(current_class)
|
40
52
|
STDERR.puts "Processing #{current_class}" if @options.verbose
|
@@ -27,6 +27,9 @@ class OptionsStruct < OpenStruct
|
|
27
27
|
:hide_protected => false,
|
28
28
|
:hide_private => false,
|
29
29
|
:plugins_models => false,
|
30
|
+
:engine_models => false,
|
31
|
+
:engine_controllers => false,
|
32
|
+
:include_concerns => false,
|
30
33
|
:root => '',
|
31
34
|
:show_belongs_to => false,
|
32
35
|
:hide_through => false,
|
@@ -109,6 +112,12 @@ class OptionsStruct < OpenStruct
|
|
109
112
|
opts.on("-p", "--plugins-models", "Include plugins models") do |p|
|
110
113
|
self.plugins_models = p
|
111
114
|
end
|
115
|
+
opts.on("-z", "--engine-models", "Include engine models") do |em|
|
116
|
+
self.engine_models = em
|
117
|
+
end
|
118
|
+
opts.on("--include-concerns", "Include models in concerns subdirectory") do |c|
|
119
|
+
self.include_concerns = c
|
120
|
+
end
|
112
121
|
opts.on("-t", "--transitive", "Include transitive associations",
|
113
122
|
"(through inheritance)") do |t|
|
114
123
|
self.transitive = t
|
@@ -124,6 +133,9 @@ class OptionsStruct < OpenStruct
|
|
124
133
|
opts.on("--hide-private", "Hide private methods") do |h|
|
125
134
|
self.hide_private = h
|
126
135
|
end
|
136
|
+
opts.on("--engine-controllers", "Include engine controllers") do |ec|
|
137
|
+
self.engine_controllers = ec
|
138
|
+
end
|
127
139
|
opts.separator ""
|
128
140
|
opts.separator "Other options:"
|
129
141
|
opts.on("-h", "--help", "Show this message") do
|
data/lib/railroady/version.rb
CHANGED
data/railroady.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "minitest"
|
24
|
-
spec.add_development_dependency "minitest-spec-context"
|
25
24
|
spec.add_development_dependency "activesupport"
|
26
25
|
|
27
26
|
end
|
data/tasks/railroady.rake
CHANGED
@@ -55,6 +55,9 @@ namespace :diagram do
|
|
55
55
|
|
56
56
|
namespace :models do
|
57
57
|
|
58
|
+
desc 'Generated brief and complete class diagrams for all models.'
|
59
|
+
task :all => ['diagram:models:complete', 'diagram:models:brief']
|
60
|
+
|
58
61
|
desc 'Generates an class diagram for all models.'
|
59
62
|
task :complete do
|
60
63
|
f = @MODELS_ALL
|
@@ -69,9 +72,27 @@ namespace :diagram do
|
|
69
72
|
sh "railroady -blamM | #{@SED} | dot -T#{RailRoady::RakeHelpers.format} > #{f}"
|
70
73
|
end
|
71
74
|
|
75
|
+
desc 'Generates an class diagram for all models including those in engines'
|
76
|
+
task :complete_with_engines do
|
77
|
+
f = @MODELS_ALL
|
78
|
+
puts "Generating #{f}"
|
79
|
+
sh "railroady -ilamzM | #{@SED} | dot -T#{RailRoady::RakeHelpers.format} > #{f}"
|
80
|
+
end
|
81
|
+
|
82
|
+
desc 'Generates an abbreviated class diagram for all models including those in engines'
|
83
|
+
task :brief_with_engines do
|
84
|
+
f = @MODELS_BRIEF
|
85
|
+
puts "Generating #{f}"
|
86
|
+
sh "railroady -bilamzM | #{@SED} | dot -T#{RailRoady::RakeHelpers.format} > #{f}"
|
87
|
+
end
|
88
|
+
|
89
|
+
|
72
90
|
end
|
73
91
|
|
74
92
|
namespace :controllers do
|
93
|
+
|
94
|
+
desc 'Generated brief and complete class diagrams for all controllers.'
|
95
|
+
task :all => ['diagram:controllers:complete', 'diagram:controllers:brief']
|
75
96
|
|
76
97
|
desc 'Generates an class diagram for all controllers.'
|
77
98
|
task :complete do
|
@@ -86,13 +107,40 @@ namespace :diagram do
|
|
86
107
|
puts "Generating #{f}"
|
87
108
|
sh "railroady -blC | #{@SED} | neato -T#{RailRoady::RakeHelpers.format} > #{f}"
|
88
109
|
end
|
110
|
+
|
111
|
+
desc 'Generates an class diagram for all controllers including those in engines'
|
112
|
+
task :complete_with_engines do
|
113
|
+
f = @CONTROLLERS_ALL
|
114
|
+
puts "Generating #{f}"
|
115
|
+
sh "railroady -ilC --engine-controllers | #{@SED} | neato -T#{RailRoady::RakeHelpers.format} > #{f}"
|
116
|
+
end
|
117
|
+
|
118
|
+
desc 'Generates an abbreviated class diagram for all controllers including those in engines.'
|
119
|
+
task :brief_with_engines do
|
120
|
+
f = @CONTROLLERS_BRIEF
|
121
|
+
puts "Generating #{f}"
|
122
|
+
sh "railroady -bilC --engine-controllers | #{@SED} | neato -T#{RailRoady::RakeHelpers.format} > #{f}"
|
123
|
+
end
|
89
124
|
|
125
|
+
|
90
126
|
end
|
91
127
|
|
92
128
|
desc 'Generates all class diagrams.'
|
93
|
-
task all: [
|
129
|
+
task all: [
|
130
|
+
'diagram:setup:create_new_doc_folder_if_needed',
|
94
131
|
'diagram:models:complete',
|
95
132
|
'diagram:models:brief',
|
96
133
|
'diagram:controllers:complete',
|
97
|
-
'diagram:controllers:brief'
|
134
|
+
'diagram:controllers:brief'
|
135
|
+
]
|
136
|
+
|
137
|
+
desc 'Generates all class diagrams including those in engines'
|
138
|
+
task all_with_engines: [
|
139
|
+
'diagram:setup:create_new_doc_folder_if_needed',
|
140
|
+
'diagram:models:complete_with_engines',
|
141
|
+
'diagram:models:brief_with_engines',
|
142
|
+
'diagram:controllers:complete_with_engines',
|
143
|
+
'diagram:controllers:brief_with_engines'
|
144
|
+
]
|
145
|
+
|
98
146
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -9,6 +9,13 @@ describe AasmDiagram do
|
|
9
9
|
files.size.must_equal 3
|
10
10
|
end
|
11
11
|
|
12
|
+
it 'should include concerns if specified' do
|
13
|
+
options = OptionsStruct.new(:include_concerns => true)
|
14
|
+
ad = AasmDiagram.new(options)
|
15
|
+
files = ad.get_files("test/file_fixture/")
|
16
|
+
files.size.must_equal 4
|
17
|
+
end
|
18
|
+
|
12
19
|
it 'should exclude a specific file' do
|
13
20
|
options = OptionsStruct.new(:exclude => ['test/file_fixture/app/models/dummy1.rb'])
|
14
21
|
ad = AasmDiagram.new(options)
|
@@ -45,5 +45,15 @@ describe ControllersDiagram do
|
|
45
45
|
files.size.must_equal 1
|
46
46
|
end
|
47
47
|
|
48
|
+
it "should include engine files" do
|
49
|
+
options = OptionsStruct.new(:engine_controllers => true)
|
50
|
+
md = ControllersDiagram.new(options)
|
51
|
+
engines = [OpenStruct.new(:root => "test/file_fixture/lib")]
|
52
|
+
md.stub(:engines, engines) do
|
53
|
+
md.get_files.must_include("test/file_fixture/lib/app/controllers/dummy/dummy_controller.rb")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
48
58
|
end
|
49
59
|
end
|
@@ -33,17 +33,17 @@ describe DiagramGraph do
|
|
33
33
|
@diagram_graph = DiagramGraph.new
|
34
34
|
end
|
35
35
|
|
36
|
-
describe ".dot_edge" do
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# describe ".dot_edge" do
|
37
|
+
# context "has_a/belongs_to" do
|
38
|
+
# it { @diagram_graph.send(:dot_edge, "one-one", "source", "target").must_include "arrowtail=odot, arrowhead=dot, dir=both" }
|
39
|
+
# end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
# context "has_many/belongs_to" do
|
42
|
+
# it { @diagram_graph.send(:dot_edge, "one-many", "source", "target").must_include "arrowtail=odot, arrowhead=crow, dir=both" }
|
43
|
+
# end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
45
|
+
# context "habtm" do
|
46
|
+
# it { @diagram_graph.send(:dot_edge, "many-many", "source", "target").must_include "arrowtail=crow, arrowhead=crow, dir=both" }
|
47
|
+
# end
|
48
|
+
# end
|
49
49
|
end
|
@@ -9,6 +9,13 @@ describe ModelsDiagram do
|
|
9
9
|
files.size.must_equal 3
|
10
10
|
end
|
11
11
|
|
12
|
+
it 'should include concerns if specified' do
|
13
|
+
options = OptionsStruct.new(:include_concerns => true)
|
14
|
+
ad = ModelsDiagram.new(options)
|
15
|
+
files = ad.get_files("test/file_fixture/")
|
16
|
+
files.size.must_equal 4
|
17
|
+
end
|
18
|
+
|
12
19
|
it 'should exclude a specific file' do
|
13
20
|
options = OptionsStruct.new(:exclude => ['test/file_fixture/app/models/dummy1.rb'])
|
14
21
|
md = ModelsDiagram.new(options)
|
@@ -45,5 +52,14 @@ describe ModelsDiagram do
|
|
45
52
|
files.size.must_equal 1
|
46
53
|
end
|
47
54
|
|
55
|
+
it "should include engine files" do
|
56
|
+
options = OptionsStruct.new(:engine_models => true)
|
57
|
+
md = ModelsDiagram.new(options)
|
58
|
+
engines = [OpenStruct.new(:root => "test/file_fixture/lib")]
|
59
|
+
md.stub(:engines, engines) do
|
60
|
+
md.get_files.must_include("test/file_fixture/lib/app/models/dummy1.rb")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
48
64
|
end
|
49
65
|
end
|
data/test/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Preston Lee
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -55,20 +55,6 @@ dependencies:
|
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: minitest-spec-context
|
60
|
-
requirement: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '0'
|
65
|
-
type: :development
|
66
|
-
prerelease: false
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '0'
|
72
58
|
- !ruby/object:Gem::Dependency
|
73
59
|
name: activesupport
|
74
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +88,7 @@ files:
|
|
102
88
|
- CHANGELOG.rdoc
|
103
89
|
- Gemfile
|
104
90
|
- Gemfile.lock
|
91
|
+
- Guardfile
|
105
92
|
- LICENSE.rdoc
|
106
93
|
- README.rdoc
|
107
94
|
- Rakefile
|
@@ -121,9 +108,12 @@ files:
|
|
121
108
|
- test/file_fixture/app/controllers/dummy1_controller.rb
|
122
109
|
- test/file_fixture/app/controllers/dummy2_controller.rb
|
123
110
|
- test/file_fixture/app/controllers/sub-dir/sub_dummy_controller.rb
|
111
|
+
- test/file_fixture/app/models/concerns/taggable.rb
|
124
112
|
- test/file_fixture/app/models/dummy1.rb
|
125
113
|
- test/file_fixture/app/models/dummy2.rb
|
126
114
|
- test/file_fixture/app/models/sub-dir/sub_dummy.rb
|
115
|
+
- test/file_fixture/lib/app/controllers/dummy/dummy_controller.rb
|
116
|
+
- test/file_fixture/lib/app/models/dummy1.rb
|
127
117
|
- test/lib/railroady/aasm_diagram_spec.rb
|
128
118
|
- test/lib/railroady/app_diagram_spec.rb
|
129
119
|
- test/lib/railroady/controllers_diagram_spec.rb
|
@@ -151,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
141
|
version: '0'
|
152
142
|
requirements: []
|
153
143
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.4.5
|
155
145
|
signing_key:
|
156
146
|
specification_version: 4
|
157
147
|
summary: Ruby on Rails 3/4 model and controller UML class diagram generator.
|
@@ -160,9 +150,12 @@ test_files:
|
|
160
150
|
- test/file_fixture/app/controllers/dummy1_controller.rb
|
161
151
|
- test/file_fixture/app/controllers/dummy2_controller.rb
|
162
152
|
- test/file_fixture/app/controllers/sub-dir/sub_dummy_controller.rb
|
153
|
+
- test/file_fixture/app/models/concerns/taggable.rb
|
163
154
|
- test/file_fixture/app/models/dummy1.rb
|
164
155
|
- test/file_fixture/app/models/dummy2.rb
|
165
156
|
- test/file_fixture/app/models/sub-dir/sub_dummy.rb
|
157
|
+
- test/file_fixture/lib/app/controllers/dummy/dummy_controller.rb
|
158
|
+
- test/file_fixture/lib/app/models/dummy1.rb
|
166
159
|
- test/lib/railroady/aasm_diagram_spec.rb
|
167
160
|
- test/lib/railroady/app_diagram_spec.rb
|
168
161
|
- test/lib/railroady/controllers_diagram_spec.rb
|