blueprint-generators-rails 0.0.7 → 0.0.8

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: 0c86ba6602385fe03f353191d6d391ff3d559679
4
- data.tar.gz: 28fb8147896a4f2749a5a3de34abfe28a9bc3390
3
+ metadata.gz: 575a658dff129cd604d23f2c5a75c9a8c0e1fdb8
4
+ data.tar.gz: 7dc6ad06758386e8081812f32af30a3f9cbb4c62
5
5
  SHA512:
6
- metadata.gz: d2bf6d58e1490e0eb58da00a775f9c8496edbc189aec9ac5e9d03828674c2ddd24fa4a4ff1c51f17ede2e8846b3b7ee802daa50cef6af3823538d0ce8fad280e
7
- data.tar.gz: d4c038077e4ce553c3f22c05828ef00b4f70a3954d0e708c7ed7b572148987436b1a4870a26a25bfac1f6f1980234f79aef311d48986c45aee72e20fd71cc440
6
+ metadata.gz: 72f5f62af8171a98708756a84e4216b787201fdcfdc1592b6b7d891f1441eab4d1a678b956871fc3c30c70e08c7de8fe0a997f6b25933cb450300d3fe08a67df
7
+ data.tar.gz: 88a256a12ab19301597490c657d8996d8e17fdcd28175a344f759ef24f0679ee05fcfffced7c55a9f393f0f4ea5799900e93c9dc74777acd0a7342ec3265c70d
@@ -1,7 +1,7 @@
1
1
  module Blueprint
2
2
  module Generators
3
3
  module Rails
4
- VERSION = "0.0.7"
4
+ VERSION = "0.0.8"
5
5
  end
6
6
  end
7
7
  end
@@ -1,17 +1,39 @@
1
1
  namespace :blueprint do
2
2
 
3
3
  desc 'Generate a Conceptual Model diagram for the current Rails project'
4
- task :cm => :environment do
4
+ task :cm, [:options] => :environment do |t, args|
5
5
  Rails.application.eager_load!
6
6
 
7
- pogo = "conceptual model for \"" + Rails.application.class.parent_name + "\""
7
+ # for debugging purposes
8
+ step_count = 1
9
+
10
+ app_name = Rails.application.class.parent_name
11
+ pogo = "conceptual model for \"" + app_name + "\""
12
+
13
+ if args[:options] == 'debug'
14
+ puts "#{step_count}. Generating conceptual model PogoScript for " + app_name
15
+ step_count += 1
16
+ end
8
17
 
9
18
  models = ActiveRecord::Base.descendants
10
19
  models.each { |m|
11
- pogo << "\n concept \"" + humanise(m.name) + "\"\n"
20
+
21
+ concept_name = humanise(m.name)
22
+ pogo << "\n concept \"" + concept_name + "\"\n"
23
+
24
+ if args[:options] == 'debug'
25
+ puts "#{step_count}. Adding concept " + concept_name
26
+ step_count += 1
27
+ end
12
28
 
13
29
  unless m.superclass.to_s == 'ActiveRecord::Base'
14
- pogo << " is a \"" + humanise(m.superclass.to_s.singularize.capitalize) + "\"\n"
30
+ is_a_name = humanise(m.superclass.to_s.singularize.capitalize)
31
+ pogo << " is a \"" + is_a_name + "\"\n"
32
+
33
+ if args[:options] == 'debug'
34
+ puts "#{step_count}. Concept " + concept_name + " is a " + is_a_name
35
+ step_count += 1
36
+ end
15
37
  end
16
38
 
17
39
  associations = m.reflect_on_all_associations
@@ -22,11 +44,33 @@ namespace :blueprint do
22
44
 
23
45
  case a.macro
24
46
  when :belongs_to, :has_one
25
- pogo << " has one \"" + humanise(a.name.to_s.singularize.capitalize) + "\"\n"
47
+ has_one_name = humanise(a.name.to_s.singularize.capitalize)
48
+ pogo << " has one \"" + has_one_name + "\"\n"
49
+
50
+ if args[:options] == 'debug'
51
+ puts "#{step_count}. Concept " + concept_name + " has one " + has_one_name
52
+ step_count += 1
53
+ end
54
+
26
55
  when :has_many
27
- pogo << " has many \"" + humanise(a.name.to_s.singularize.capitalize) + "\"\n"
56
+ has_many_name = humanise(a.name.to_s.singularize.capitalize)
57
+ pogo << " has many \"" + has_many_name + "\"\n"
58
+
59
+ if args[:options] == 'debug'
60
+ puts "#{step_count}. Concept " + concept_name + " has one " + has_many_name
61
+ step_count += 1
62
+ end
63
+
28
64
  else
29
- # TODO error condition
65
+ # TODO support other macro types and variants (i.e.: has_and_belongs_to_many, through, etc)
66
+
67
+ if args[:options] == 'debug'
68
+ puts "#{step_count}. Did not recognise macro type!"
69
+ step_count += 1
70
+ end
71
+
72
+ # TODO error condition
73
+
30
74
  end
31
75
  }
32
76
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blueprint-generators-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - benjii
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler