dm-visualizer 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ ### 0.2.1 / 2011-02-12
2
+
3
+ * Added {DataMapper::Visualizer::Project#each_relationship_for}.
4
+ * Fixed a bug in {DataMapper::Visualizer::Project#each_relationship},
5
+ effecting dm-core 1.0.x projects.
6
+
1
7
  ### 0.2.0 / 2011-02-09
2
8
 
3
9
  * Require dm-core >= 1.0.0.
data/Gemfile CHANGED
@@ -1,12 +1,11 @@
1
- require 'ore/specification'
2
-
3
1
  source :rubygems
4
2
 
5
3
  gemspec
6
4
 
7
5
  group(:development) do
8
- gem 'kramdown', '~> 0.12.0'
9
6
  gem 'rake', '~> 0.8.7'
10
- gem 'ore-tasks', '~> 0.3.0'
7
+ gem 'kramdown', '~> 0.12.0'
8
+
9
+ gem 'ore-tasks', '~> 0.4.0'
11
10
  gem 'rspec', '~> 2.4.0'
12
11
  end
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # dm-visualizer
2
2
 
3
- * [github.com/postmodern/dm-visualizer](http://github.com/postmodern/dm-visualizer/)
4
- * [github.com/postmodern/dm-visualizer/issues](http://github.com/postmodern/dm-visualizer/issues)
3
+ * [Source](http://github.com/postmodern/dm-visualizer/)
4
+ * [Issues](http://github.com/postmodern/dm-visualizer/issues)
5
+ * [Documentation](http://rubydoc.info/gems/dm-visualizer/frames)
5
6
  * [Email](postmodern.mod3 at gmail.com)
6
7
 
7
8
  ## Description
@@ -1,5 +1,5 @@
1
1
  name: dm-visualizer
2
- version: 0.2.0
2
+ version: 0.2.1
3
3
  summary:
4
4
  Visualizes the Models, Properties and Relationships defined in a
5
5
  DataMapper based Ruby project.
@@ -232,11 +232,7 @@ module DataMapper
232
232
  # XXX: in dm-core 1.1.0, `Model#relationships` returns a
233
233
  # `DataMapper::RelationshipSet`, instead of a `Mash`, which does
234
234
  # not provide the `each_value` method.
235
- model.relationships.each do |*args|
236
- relationship = args.last
237
-
238
- next if relationship.respond_to?(:through)
239
-
235
+ each_relationship_for(model) do |relationship|
240
236
  case relationship
241
237
  when Associations::ManyToOne::Relationship,
242
238
  Associations::OneToOne::Relationship
@@ -296,15 +292,8 @@ module DataMapper
296
292
  return enum_for(:each_relationship) unless block_given?
297
293
 
298
294
  each_model do |model|
299
- # XXX: in dm-core 1.1.0, `Model#relationships` returns a
300
- # `DataMapper::RelationshipSet`, instead of a `Mash`, which does
301
- # not provide the `each_value` method.
302
- model.relationships.each do |*args|
303
- relationship = args.last
304
-
305
- unless relationship.respond_to?(:through)
306
- yield relationship, model
307
- end
295
+ each_relationship_for(model) do |relationship|
296
+ yield relationship, model
308
297
  end
309
298
  end
310
299
  end
@@ -321,6 +310,35 @@ module DataMapper
321
310
  STDERR.puts "dm-visualizer: #{message}"
322
311
  end
323
312
 
313
+ #
314
+ # Enumerates over each DataMapper relationship in a model.
315
+ #
316
+ # @yield [relationship]
317
+ # The given block will be passed each relationship in the model.
318
+ #
319
+ # @yieldparam [DataMapper::Relationship] relationship
320
+ # A relationship.
321
+ #
322
+ # @since 0.2.1
323
+ #
324
+ def each_relationship_for(model)
325
+ # XXX: in dm-core 1.1.0, `Model#relationships` returns a
326
+ # `DataMapper::RelationshipSet`, instead of a `Mash`, which does
327
+ # not provide the `each_value` method.
328
+ model.relationships.each do |args|
329
+ relationship = case args
330
+ when Array
331
+ args.last
332
+ else
333
+ args
334
+ end
335
+
336
+ unless relationship.respond_to?(:through)
337
+ yield relationship
338
+ end
339
+ end
340
+ end
341
+
324
342
  end
325
343
  end
326
344
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-visualizer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
4
+ hash: 21
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Postmodern
@@ -15,28 +15,14 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-09 00:00:00 -08:00
18
+ date: 2011-02-12 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: dm-core
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 23
29
- segments:
30
- - 1
31
- - 0
32
- - 0
33
- version: 1.0.0
34
22
  prerelease: false
35
- type: :runtime
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
23
  name: ruby-graphviz
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
24
+ type: :runtime
25
+ requirement: &id001 !ruby/object:Gem::Requirement
40
26
  none: false
41
27
  requirements:
42
28
  - - ">="
@@ -47,28 +33,28 @@ dependencies:
47
33
  - 9
48
34
  - 10
49
35
  version: 0.9.10
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
50
38
  prerelease: false
39
+ name: dm-core
51
40
  type: :runtime
52
- requirement: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: yard
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
41
+ requirement: &id002 !ruby/object:Gem::Requirement
56
42
  none: false
57
43
  requirements:
58
- - - ~>
44
+ - - ">="
59
45
  - !ruby/object:Gem::Version
60
- hash: 7
46
+ hash: 23
61
47
  segments:
48
+ - 1
62
49
  - 0
63
- - 6
64
50
  - 0
65
- version: 0.6.0
66
- prerelease: false
67
- type: :development
68
- requirement: *id003
51
+ version: 1.0.0
52
+ version_requirements: *id002
69
53
  - !ruby/object:Gem::Dependency
54
+ prerelease: false
70
55
  name: bundler
71
- version_requirements: &id004 !ruby/object:Gem::Requirement
56
+ type: :development
57
+ requirement: &id003 !ruby/object:Gem::Requirement
72
58
  none: false
73
59
  requirements:
74
60
  - - ~>
@@ -79,11 +65,26 @@ dependencies:
79
65
  - 0
80
66
  - 0
81
67
  version: 1.0.0
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
82
70
  prerelease: false
71
+ name: yard
83
72
  type: :development
84
- requirement: *id004
73
+ requirement: &id004 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ hash: 7
79
+ segments:
80
+ - 0
81
+ - 6
82
+ - 0
83
+ version: 0.6.0
84
+ version_requirements: *id004
85
85
  description: DataMapper Visualizer is both a library and a command-line utility for visualizing the Models, Properties and Relationships defined in a DataMapper based Ruby project.
86
- email: postmodern.mod3@gmail.com
86
+ email:
87
+ - postmodern.mod3@gmail.com
87
88
  executables: []
88
89
 
89
90
  extensions: []
@@ -91,37 +92,37 @@ extensions: []
91
92
  extra_rdoc_files:
92
93
  - README.md
93
94
  files:
95
+ - lib/dm-visualizer/rake/graphviz_task.rb
96
+ - spec/dm_visualizer_spec.rb
97
+ - spec/helpers/projects/library/lib/blog/user.rb
98
+ - ChangeLog.md
99
+ - spec/visualization_spec.rb
100
+ - spec/helpers/projects/library/lib/blog.rb
101
+ - lib/dm-visualizer/project.rb
102
+ - spec/helpers/projects/library/lib/blog/post.rb
94
103
  - spec/spec_helper.rb
95
- - spec/project_examples.rb
96
- - gemspec.yml
97
- - .rspec
98
- - spec/helpers/projects/rails/app/models/user.rb
99
- - lib/dm-visualizer/rake/task.rb
100
104
  - .yardopts
101
- - spec/visualization_spec.rb
102
- - spec/project_spec.rb
103
105
  - spec/helpers/projects/rails/app/models/post.rb
104
- - spec/helpers/project.rb
105
- - lib/dm-visualizer/graphviz.rb
106
+ - lib/dm-visualizer/rake/rails/tasks.rb
107
+ - lib/dm-visualizer/rake/rails/graphviz_task.rb
108
+ - dm-visualizer.gemspec
106
109
  - lib/dm-visualizer/visualization.rb
107
- - lib/dm-visualizer/rake/graphviz_task.rb
108
- - Gemfile
109
- - spec/helpers/projects/library/lib/blog/comment.rb
110
- - Rakefile
111
110
  - README.md
112
- - LICENSE.txt
113
- - spec/dm_visualizer_spec.rb
114
- - lib/dm-visualizer/rake/rails/tasks.rb
115
- - spec/helpers/projects/rails/app/models/comment.rb
116
- - spec/helpers/projects/library/lib/blog/post.rb
111
+ - Rakefile
117
112
  - lib/dm-visualizer.rb
118
- - dm-visualizer.gemspec
119
- - spec/helpers/projects/library/lib/blog/user.rb
120
- - spec/helpers/projects/library/lib/blog.rb
121
- - lib/dm-visualizer/rake/rails/graphviz_task.rb
122
- - lib/dm-visualizer/project.rb
123
- - ChangeLog.md
124
- has_rdoc: true
113
+ - Gemfile
114
+ - spec/helpers/projects/rails/app/models/comment.rb
115
+ - lib/dm-visualizer/graphviz.rb
116
+ - LICENSE.txt
117
+ - spec/helpers/projects/rails/app/models/user.rb
118
+ - spec/helpers/project.rb
119
+ - spec/project_spec.rb
120
+ - spec/helpers/projects/library/lib/blog/comment.rb
121
+ - .rspec
122
+ - gemspec.yml
123
+ - lib/dm-visualizer/rake/task.rb
124
+ - spec/project_examples.rb
125
+ has_rdoc: yard
125
126
  homepage: http://github.com/postmodern/dm-visualizer
126
127
  licenses:
127
128
  - MIT
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  requirements: []
154
155
 
155
156
  rubyforge_project: dm-visualizer
156
- rubygems_version: 1.5.0
157
+ rubygems_version: 1.3.7
157
158
  signing_key:
158
159
  specification_version: 3
159
160
  summary: Visualizes the Models, Properties and Relationships defined in a DataMapper based Ruby project.