modaldiagrams 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 07b972b3850d455e380e6175eebfddc828a0752a
4
+ data.tar.gz: d08b305b7bc0c6cba6e68eb062ebfc48e12e2f2f
5
+ SHA512:
6
+ metadata.gz: 339eedfe6d76945cb2bcbf121d801350be76a516f892beedd24fdd88388f04ea92511ecab64e77a8338b33984e7011c27e282bb47f8f087e1134cd57bb10d4cd
7
+ data.tar.gz: 1b4715176655f360dce0a9e47c80e9734788f22bc4b8502b7ce31d214bc5806a46fa708f79b7d500db414c0c88740ed55c2e8224997f5dc8744d62f2e2ee9be7
data/Rakefile CHANGED
@@ -1,42 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "modaldiagrams"
18
- gem.homepage = "http://github.com/jgoizueta/modaldiagrams"
19
- gem.license = "MIT"
20
- gem.summary = %Q{DB diagramming tool fo Rails ActiveRecord applications}
21
- gem.description = %Q{modaldiagrams provides Rake tasks for diagramming ActiveRecord databases. It generates Graphviz dot files.}
22
- gem.email = "jgoizueta@gmail.com"
23
- gem.authors = ["Javier Goizueta"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rake/testtask'
29
- Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/test_*.rb'
32
- test.verbose = true
33
- end
3
+ require 'bundler/gem_tasks'
34
4
 
35
5
  task :default => :test
36
6
 
37
7
  require 'rdoc/task'
38
8
  Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
9
+ version = ModalDiagrams::VERSION
40
10
 
41
11
  rdoc.rdoc_dir = 'rdoc'
42
12
  rdoc.title = "modaldiagrams #{version}"
@@ -35,10 +35,12 @@ module ModalDiagrams
35
35
  model_selection_options = {
36
36
  :all_models => cfg.include_all_models,
37
37
  :dynamic_models => cfg.include_dynamic_models,
38
- :include_files => false
38
+ :include_files => false,
39
+ :exclude_models => cfg.exclude_models
39
40
  }
40
41
 
41
- models = dbmodels(model_selection_options.merge(:exclude_sti_models => true))
42
+ models, excluded_models = dbmodels(model_selection_options.merge(:exclude_sti_models => true))
43
+ excluded_class_names = excluded_models.map(&:name)
42
44
 
43
45
  models.each do |cls|
44
46
  if cls.respond_to?(:reflect_on_all_associations) && ActiveRecord::Base.connection.table_exists?(cls.table_name)
@@ -72,6 +74,7 @@ module ModalDiagrams
72
74
  cluster_classes[cluster] ||= []
73
75
  cluster_classes[cluster] << cls.to_s
74
76
  cls.reflect_on_all_associations.each do |assoc|
77
+ next if assoc.class_name.in?(excluded_class_names)
75
78
  target,type = nil,nil
76
79
  case assoc.macro
77
80
  when :has_many
@@ -139,7 +142,7 @@ module ModalDiagrams
139
142
  end
140
143
 
141
144
  if cfg.show_sti
142
- sti_classes = dbmodels(model_selection_options.merge(:exclude_non_sti_models => true))
145
+ sti_classes, exc = dbmodels(model_selection_options.merge(:exclude_non_sti_models => true))
143
146
  sti_classes.each do |sti_class|
144
147
  cls = sti_class.base_class
145
148
  if cls.respond_to?(:cluster)
@@ -167,7 +170,7 @@ module ModalDiagrams
167
170
  end
168
171
 
169
172
  fn = Rails.root.join('db/diagrams/diagram.dot')
170
- mkdir_p fn.dirname
173
+ FileUtils.mkdir_p fn.dirname
171
174
  File.open(fn,'w') do |f|
172
175
  add_diagram_header f
173
176
  cluster_id = 0
@@ -205,6 +208,7 @@ module ModalDiagrams
205
208
  # :dynamic_models # Return dynamically defined models too (not defined in a model file)
206
209
  # :exclude_sti_models # Exclude derived (STI) models
207
210
  # :exclude_non_sti_models # Exclude top level models
211
+ # :exclude_models # Array of models to exclude from the diagrams
208
212
  # :include_files # Return also the model definition file pathnames (return pairs of [model, file])
209
213
  # :only_app_files # But return nil for files not in the app proper
210
214
  # :only_app_tree_files # But return nil for files not in the app directory tree (app, vendor...)
@@ -247,8 +251,17 @@ module ModalDiagrams
247
251
  non_sti_models, sti_models = models.partition{|model| model.base_class==model}
248
252
 
249
253
  models = []
250
- models += non_sti_models unless options[:exclude_non_sti_models]
251
- models += sti_models unless options[:exclude_sti_models]
254
+ excluded_models = []
255
+ if options[:exclude_non_sti_models]
256
+ excluded_models += non_sti_models
257
+ else
258
+ models += non_sti_models
259
+ end
260
+ if options[:exclude_sti_models]
261
+ excluded_models += sti_models
262
+ else
263
+ models += sti_models
264
+ end
252
265
  if options[:include_files]
253
266
  models = models.map{|model| [model, files[model.to_s]]}
254
267
  if options[:only_app_files] || options[:only_app_tree_files]
@@ -261,7 +274,12 @@ module ModalDiagrams
261
274
  models = models.map{|model, file| [model, file && (file.starts_with?(suffix) ? file : nil)]}
262
275
  end
263
276
  end
264
- models
277
+ excluded_models = []
278
+ if options[:exclude_models].present?
279
+ excluded_models = Array(options[:exclude_models]).map{|m| String===m ? m.constantize : m}
280
+ models -= excluded_models
281
+ end
282
+ [models, excluded_models]
265
283
  end
266
284
 
267
285
  def has_table?(cls)
@@ -0,0 +1,3 @@
1
+ module ModalDiagrams
2
+ VERSION = "1.1.6"
3
+ end
data/lib/modaldiagrams.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'modaldiagrams/version'
1
2
  require 'modaldiagrams/parameters'
2
3
  require 'modaldiagrams/modaldiagrams'
3
4
 
metadata CHANGED
@@ -1,182 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modaldiagrams
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
5
- prerelease:
4
+ version: 1.1.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Javier Goizueta
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-19 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: modalsettings
14
+ name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '3.2'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: '3.2'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: modalsupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.9.2
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.9.2
46
41
  - !ruby/object:Gem::Dependency
47
- name: shoulda
42
+ name: modalsettings
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
- type: :development
48
+ type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: rdoc
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '3.12'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '3.12'
78
- - !ruby/object:Gem::Dependency
79
- name: bundler
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ~>
84
- - !ruby/object:Gem::Version
85
- version: 1.1.0
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: 1.1.0
94
- - !ruby/object:Gem::Dependency
95
- name: jeweler
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ~>
100
- - !ruby/object:Gem::Version
101
- version: 1.8.4
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- version: 1.8.4
110
- - !ruby/object:Gem::Dependency
111
- name: modalfields
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: 1.2.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: 1.2.0
126
55
  description: modaldiagrams provides Rake tasks for diagramming ActiveRecord databases.
127
56
  It generates Graphviz dot files.
128
- email: jgoizueta@gmail.com
57
+ email:
58
+ - jgoizueta@gmail.com
129
59
  executables: []
130
60
  extensions: []
131
- extra_rdoc_files:
132
- - LICENSE.txt
133
- - README.rdoc
134
- - TODO
61
+ extra_rdoc_files: []
135
62
  files:
136
- - Gemfile
137
- - Gemfile.lock
138
- - LICENSE.txt
139
63
  - README.rdoc
140
64
  - Rakefile
141
- - TODO
142
- - VERSION
143
65
  - lib/modaldiagrams.rb
144
66
  - lib/modaldiagrams/modaldiagrams.rb
145
67
  - lib/modaldiagrams/parameters.rb
146
68
  - lib/modaldiagrams/tasks.rb
69
+ - lib/modaldiagrams/version.rb
147
70
  - lib/tasks.rb
148
71
  - lib/tasks/diagrams.rake
149
72
  - lib/tasks/diagrams_clean.rake
150
73
  - lib/tasks/diagrams_pdf.rake
151
74
  - lib/tasks/diagrams_png.rake
152
75
  - lib/tasks/diagrams_ps.rake
153
- - modaldiagrams.gemspec
154
- homepage: http://github.com/jgoizueta/modaldiagrams
76
+ homepage: https://github.com/jgoizueta/modaldiagrams
155
77
  licenses:
156
78
  - MIT
79
+ metadata: {}
157
80
  post_install_message:
158
81
  rdoc_options: []
159
82
  require_paths:
160
83
  - lib
161
84
  required_ruby_version: !ruby/object:Gem::Requirement
162
- none: false
163
85
  requirements:
164
- - - ! '>='
86
+ - - ">="
165
87
  - !ruby/object:Gem::Version
166
88
  version: '0'
167
- segments:
168
- - 0
169
- hash: -3964054576026403237
170
89
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
90
  requirements:
173
- - - ! '>='
91
+ - - ">="
174
92
  - !ruby/object:Gem::Version
175
93
  version: '0'
176
94
  requirements: []
177
95
  rubyforge_project:
178
- rubygems_version: 1.8.23
96
+ rubygems_version: 2.2.2
179
97
  signing_key:
180
- specification_version: 3
98
+ specification_version: 4
181
99
  summary: DB diagramming tool fo Rails ActiveRecord applications
182
100
  test_files: []
data/Gemfile DELETED
@@ -1,15 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem 'modalsettings'
4
- gem 'modalsupport', '>= 0.9.2'
5
-
6
-
7
- # Add dependencies to develop your gem here.
8
- # Include everything needed to run rake, tests, features, etc.
9
- group :development do
10
- gem "shoulda", ">= 0"
11
- gem "rdoc", "~> 3.12"
12
- gem "bundler", "~> 1.1.0"
13
- gem "jeweler", "~> 1.8.4"
14
- gem 'modalfields', '>= 1.2.0'
15
- end
data/Gemfile.lock DELETED
@@ -1,110 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- actionmailer (3.2.8)
5
- actionpack (= 3.2.8)
6
- mail (~> 2.4.4)
7
- actionpack (3.2.8)
8
- activemodel (= 3.2.8)
9
- activesupport (= 3.2.8)
10
- builder (~> 3.0.0)
11
- erubis (~> 2.7.0)
12
- journey (~> 1.0.4)
13
- rack (~> 1.4.0)
14
- rack-cache (~> 1.2)
15
- rack-test (~> 0.6.1)
16
- sprockets (~> 2.1.3)
17
- activemodel (3.2.8)
18
- activesupport (= 3.2.8)
19
- builder (~> 3.0.0)
20
- activerecord (3.2.8)
21
- activemodel (= 3.2.8)
22
- activesupport (= 3.2.8)
23
- arel (~> 3.0.2)
24
- tzinfo (~> 0.3.29)
25
- activeresource (3.2.8)
26
- activemodel (= 3.2.8)
27
- activesupport (= 3.2.8)
28
- activesupport (3.2.8)
29
- i18n (~> 0.6)
30
- multi_json (~> 1.0)
31
- arel (3.0.2)
32
- builder (3.0.0)
33
- erubis (2.7.0)
34
- git (1.2.5)
35
- hike (1.2.1)
36
- i18n (0.6.1)
37
- jeweler (1.8.4)
38
- bundler (~> 1.0)
39
- git (>= 1.2.5)
40
- rake
41
- rdoc
42
- journey (1.0.4)
43
- json (1.7.5)
44
- mail (2.4.4)
45
- i18n (>= 0.4.0)
46
- mime-types (~> 1.16)
47
- treetop (~> 1.4.8)
48
- mime-types (1.19)
49
- modalfields (1.2.0)
50
- activerecord (>= 2.3.5)
51
- activesupport (>= 2.3.5)
52
- rails (>= 2.3.0)
53
- modalsettings (1.0.0)
54
- modalsupport (>= 0.8.1)
55
- modalsupport (0.9.2)
56
- multi_json (1.3.6)
57
- polyglot (0.3.3)
58
- rack (1.4.1)
59
- rack-cache (1.2)
60
- rack (>= 0.4)
61
- rack-ssl (1.3.2)
62
- rack
63
- rack-test (0.6.1)
64
- rack (>= 1.0)
65
- rails (3.2.8)
66
- actionmailer (= 3.2.8)
67
- actionpack (= 3.2.8)
68
- activerecord (= 3.2.8)
69
- activeresource (= 3.2.8)
70
- activesupport (= 3.2.8)
71
- bundler (~> 1.0)
72
- railties (= 3.2.8)
73
- railties (3.2.8)
74
- actionpack (= 3.2.8)
75
- activesupport (= 3.2.8)
76
- rack-ssl (~> 1.3.2)
77
- rake (>= 0.8.7)
78
- rdoc (~> 3.4)
79
- thor (>= 0.14.6, < 2.0)
80
- rake (0.9.2.2)
81
- rdoc (3.12)
82
- json (~> 1.4)
83
- shoulda (3.1.1)
84
- shoulda-context (~> 1.0)
85
- shoulda-matchers (~> 1.2)
86
- shoulda-context (1.0.0)
87
- shoulda-matchers (1.3.0)
88
- activesupport (>= 3.0.0)
89
- sprockets (2.1.3)
90
- hike (~> 1.2)
91
- rack (~> 1.0)
92
- tilt (~> 1.1, != 1.3.0)
93
- thor (0.16.0)
94
- tilt (1.3.3)
95
- treetop (1.4.10)
96
- polyglot
97
- polyglot (>= 0.3.1)
98
- tzinfo (0.3.33)
99
-
100
- PLATFORMS
101
- ruby
102
-
103
- DEPENDENCIES
104
- bundler (~> 1.1.0)
105
- jeweler (~> 1.8.4)
106
- modalfields (>= 1.2.0)
107
- modalsettings
108
- modalsupport (>= 0.9.2)
109
- rdoc (~> 3.12)
110
- shoulda
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2012 Javier Goizueta
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/TODO DELETED
@@ -1,4 +0,0 @@
1
- TODO
2
- * Write tests (use simple demo data model whose diagrams will serve as a generic diagram legend as well)
3
- * If the use of requires_presence_of with has_many and has_one associations could be detected, specific
4
- arrowheads could be used for "one or more" (e.g. crowtee) and "one only" (e.g. teetee) associations.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.1.5
@@ -1,76 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "modaldiagrams"
8
- s.version = "1.1.5"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Javier Goizueta"]
12
- s.date = "2014-02-19"
13
- s.description = "modaldiagrams provides Rake tasks for diagramming ActiveRecord databases. It generates Graphviz dot files."
14
- s.email = "jgoizueta@gmail.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc",
18
- "TODO"
19
- ]
20
- s.files = [
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "TODO",
27
- "VERSION",
28
- "lib/modaldiagrams.rb",
29
- "lib/modaldiagrams/modaldiagrams.rb",
30
- "lib/modaldiagrams/parameters.rb",
31
- "lib/modaldiagrams/tasks.rb",
32
- "lib/tasks.rb",
33
- "lib/tasks/diagrams.rake",
34
- "lib/tasks/diagrams_clean.rake",
35
- "lib/tasks/diagrams_pdf.rake",
36
- "lib/tasks/diagrams_png.rake",
37
- "lib/tasks/diagrams_ps.rake",
38
- "modaldiagrams.gemspec"
39
- ]
40
- s.homepage = "http://github.com/jgoizueta/modaldiagrams"
41
- s.licenses = ["MIT"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = "1.8.23"
44
- s.summary = "DB diagramming tool fo Rails ActiveRecord applications"
45
-
46
- if s.respond_to? :specification_version then
47
- s.specification_version = 3
48
-
49
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_runtime_dependency(%q<modalsettings>, [">= 0"])
51
- s.add_runtime_dependency(%q<modalsupport>, [">= 0.9.2"])
52
- s.add_development_dependency(%q<shoulda>, [">= 0"])
53
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
54
- s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
55
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
56
- s.add_development_dependency(%q<modalfields>, [">= 1.2.0"])
57
- else
58
- s.add_dependency(%q<modalsettings>, [">= 0"])
59
- s.add_dependency(%q<modalsupport>, [">= 0.9.2"])
60
- s.add_dependency(%q<shoulda>, [">= 0"])
61
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
62
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
63
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
64
- s.add_dependency(%q<modalfields>, [">= 1.2.0"])
65
- end
66
- else
67
- s.add_dependency(%q<modalsettings>, [">= 0"])
68
- s.add_dependency(%q<modalsupport>, [">= 0.9.2"])
69
- s.add_dependency(%q<shoulda>, [">= 0"])
70
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
71
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
72
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
73
- s.add_dependency(%q<modalfields>, [">= 1.2.0"])
74
- end
75
- end
76
-