railroady 1.3.1 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c445e74b5659404f61ab558a1bf02f496d7b34c
4
- data.tar.gz: f5a44d738815114e732b44c650129ff6870a710f
3
+ metadata.gz: 5a7fa0d96074617758610fbbb1d18b7bbe69c379
4
+ data.tar.gz: 4ad8fd7e21e1a2b9c277498862d8463a446e377d
5
5
  SHA512:
6
- metadata.gz: 7fe0e9ecb631a4482179083fd47cbe75316ea3cfa39c48e6df315a802108336d6dba8b9ff94670125be8cc2486a7846a00d8e50b75aa8b7a0aa24b2f83fe6751
7
- data.tar.gz: 4df37c87884a01dca2859f2ba244652c4c58099abddc9907d30d31dddfcd0ece044fd05c8a3de07497a8a9c8b93bb95f7e938b607599823196434d1f5a1c484b
6
+ metadata.gz: 9eeea0a386b4acecb19a053cf8fb2327dc2c5cd1e6f30afda00e5162648c6d464eb8af2e5befe984ce3f0579c2e942cd3c3cb3e911de86cdf341b025cfaf0dfc
7
+ data.tar.gz: 2222c3470ec2585ad2428ee14c6939064da0e7a2026acb15fa2bfa8f8c875232b2d9f7fce7ec26f17d6eed723808b864b72d99908df1b4967619a20e3dd21764
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .idea
1
2
  *.sw?
2
3
  .DS_Store
3
4
  coverage
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- railroady (1.3.0)
4
+ railroady (1.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activesupport (4.2.0)
9
+ activesupport (4.2.4)
10
10
  i18n (~> 0.7)
11
11
  json (~> 1.7, >= 1.7.7)
12
12
  minitest (~> 5.1)
13
13
  thread_safe (~> 0.3, >= 0.3.4)
14
14
  tzinfo (~> 1.1)
15
15
  i18n (0.7.0)
16
- json (1.8.1)
17
- minitest (5.5.0)
16
+ json (1.8.3)
17
+ minitest (5.8.1)
18
18
  rake (10.4.2)
19
- thread_safe (0.3.4)
19
+ thread_safe (0.3.5)
20
20
  tzinfo (1.2.2)
21
21
  thread_safe (~> 0.1)
22
22
 
@@ -29,3 +29,6 @@ DEPENDENCIES
29
29
  minitest
30
30
  railroady!
31
31
  rake
32
+
33
+ BUNDLED WITH
34
+ 1.10.6
@@ -53,7 +53,7 @@ class AasmDiagram < AppDiagram
53
53
 
54
54
  # Only interested in acts_as_state_machine models.
55
55
  process_acts_as_state_machine_class(current_class) if current_class.respond_to?(:states)
56
- process_aasm_class(current_class) if current_class.respond_to?(:aasm_states)
56
+ process_aasm_class(current_class) if current_class.respond_to?(:aasm_states) || current_class.respond_to?(:aasm)
57
57
  end # process_class
58
58
 
59
59
  def process_acts_as_state_machine_class(current_class)
@@ -91,13 +91,13 @@ class AasmDiagram < AppDiagram
91
91
  end
92
92
  @graph.add_node [node_type, current_class.name, node_attribs]
93
93
 
94
- current_class.aasm.events.each do |event_name, event|
94
+ current_class.aasm.events.each do |event|
95
95
  event.transitions.each do |transition|
96
96
  @graph.add_edge [
97
97
  'event',
98
98
  current_class.name.downcase + '_' + transition.from.to_s,
99
99
  current_class.name.downcase + '_' + transition.to.to_s,
100
- event_name.to_s
100
+ event.name.to_s
101
101
  ]
102
102
  end
103
103
  end
@@ -97,8 +97,8 @@ class DiagramGraph
97
97
  # Return subgraph format
98
98
  return "subgraph cluster_#{name.downcase} {\n\tlabel = #{quote(name)}\n\t#{attributes.join("\n ")}}"
99
99
  end # case
100
- options = [options, custom_options].compact.join(', ')
101
- "\t#{quote(name)} [#{options}]\n"
100
+ options = [options, custom_options].compact.reject{|o| o.empty?}.join(', ')
101
+ return "\t#{quote(name)} [#{options}]\n"
102
102
  end # dot_node
103
103
 
104
104
  # Build a DOT graph edge
@@ -112,7 +112,10 @@ class DiagramGraph
112
112
  when 'one-many'
113
113
  options += 'arrowtail=odot, arrowhead=crow' + suffix
114
114
  when 'many-many'
115
- options += 'arrowtail=crow, arrowhead=crow' + suffix
115
+ options += "arrowtail=crow, arrowhead=crow" + suffix
116
+ when 'belongs-to'
117
+ # following http://guides.rubyonrails.org/association_basics.html#the-belongs-to-association
118
+ options += "arrowtail=none, arrowhead=normal" + suffix
116
119
  when 'is-a'
117
120
  options += 'arrowhead="none", arrowtail="onormal"'
118
121
  when 'event'
@@ -108,7 +108,7 @@ class ModelsDiagram < AppDiagram
108
108
 
109
109
  content_columns.each do |a|
110
110
  content_column = a.name
111
- content_column += ' :' + a.type.to_s unless @options.hide_types
111
+ content_column += ' :' + a.sql_type.to_s unless @options.hide_types
112
112
  node_attribs << content_column
113
113
  end
114
114
  end
@@ -284,6 +284,8 @@ class ModelsDiagram < AppDiagram
284
284
  elsif macro == 'has_many' && (!assoc.options[:through]) ||
285
285
  %w(references_many embeds_many).include?(macro)
286
286
  assoc_type = 'one-many'
287
+ elsif macro == 'belongs_to'
288
+ assoc_type = 'belongs-to'
287
289
  else # habtm or has_many, :through
288
290
  # Add FAKE associations too in order to understand mistakes
289
291
  return if @habtm.include? [assoc_class_name, class_name, assoc_name]
@@ -1,3 +1,3 @@
1
1
  module RailRoady
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.0'
3
3
  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.3.1
4
+ version: 1.4.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: 2015-07-20 00:00:00.000000000 Z
14
+ date: 2015-10-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.4.6
144
+ rubygems_version: 2.4.8
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Ruby on Rails 3/4 model and controller UML class diagram generator.
@@ -163,4 +163,3 @@ test_files:
163
163
  - test/lib/railroady/diagram_graph_spec.rb
164
164
  - test/lib/railroady/models_diagram_spec.rb
165
165
  - test/spec_helper.rb
166
- has_rdoc: