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 +4 -4
- data/lib/blueprint/generators/rails/version.rb +1 -1
- data/lib/tasks/blueprint.rake +51 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 575a658dff129cd604d23f2c5a75c9a8c0e1fdb8
|
4
|
+
data.tar.gz: 7dc6ad06758386e8081812f32af30a3f9cbb4c62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72f5f62af8171a98708756a84e4216b787201fdcfdc1592b6b7d891f1441eab4d1a678b956871fc3c30c70e08c7de8fe0a997f6b25933cb450300d3fe08a67df
|
7
|
+
data.tar.gz: 88a256a12ab19301597490c657d8996d8e17fdcd28175a344f759ef24f0679ee05fcfffced7c55a9f393f0f4ea5799900e93c9dc74777acd0a7342ec3265c70d
|
data/lib/tasks/blueprint.rake
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2015-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|