blueprint-generators-rails 0.1.5 → 0.1.6
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 +27 -8
- 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: 9f4dde552d765f037d4d27832a79cf49401806c2
|
4
|
+
data.tar.gz: 3e4c1d2f522495f630bbe1c4938fc6416e1294a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b14623410b34911657054fbc55719249e01cd5786c175591caafd2477a30336d30ab84b101df5f0684ad9ca7ade370d4f04e638d67e4d3b0470653562e701c6
|
7
|
+
data.tar.gz: 9d007c8492bdebef931e0dc40091c34dc76e0fb81355b337d1cf32a9681b3cc769c829473272b5de684a9a4b6683be6c83000b40b1abe51b6e4167bbe3c21e38
|
data/lib/tasks/blueprint.rake
CHANGED
@@ -4,11 +4,12 @@ namespace :blueprint do
|
|
4
4
|
|
5
5
|
desc 'Generate a Conceptual Model diagram for the current Rails project'
|
6
6
|
task :cm, [:options] do |t, args|
|
7
|
-
# Rails.application.eager_load!
|
8
7
|
|
9
8
|
# set the debug flag
|
10
9
|
@debug = args[:options] == 'debug'
|
11
10
|
|
11
|
+
# TODO perform a sanity check to make sure that this is a Rails project
|
12
|
+
|
12
13
|
# we store the detected model in a hash - which we later serialize to PogoScript
|
13
14
|
model = { }
|
14
15
|
|
@@ -16,17 +17,35 @@ namespace :blueprint do
|
|
16
17
|
step_count = 1
|
17
18
|
|
18
19
|
# get the configured app name
|
19
|
-
app_name =
|
20
|
-
|
20
|
+
app_name = nil
|
21
|
+
|
22
|
+
# if the config directory can't be found then stop
|
23
|
+
unless Dir.exist?(Dir.pwd + '/config')
|
24
|
+
print_debug step_count, 'Could not find config directory. Stopping analysis.'
|
25
|
+
next
|
26
|
+
end
|
21
27
|
|
22
|
-
|
23
|
-
|
28
|
+
# otherwise find the application name
|
29
|
+
Dir.chdir(Dir.pwd + '/config') do
|
30
|
+
File.open('application.rb') do |f|
|
31
|
+
f.each_line do |line|
|
32
|
+
m, app_name = line.match(/(module )(.*)/).try(:captures)
|
33
|
+
unless app_name.nil?
|
34
|
+
print_debug step_count, "Application name is " + app_name
|
35
|
+
step_count += 1
|
36
|
+
break
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
24
41
|
|
42
|
+
# if the models directory can't be found then stop
|
25
43
|
unless Dir.exist?(Dir.pwd + '/app/models')
|
26
44
|
print_debug step_count, 'Could not find models directory. Stopping analysis.'
|
27
|
-
|
45
|
+
next
|
28
46
|
end
|
29
47
|
|
48
|
+
# otherwise continue analysis
|
30
49
|
Dir.chdir(Dir.pwd + '/app/models') do
|
31
50
|
|
32
51
|
# list all files in the directory
|
@@ -37,11 +56,11 @@ namespace :blueprint do
|
|
37
56
|
# puts "Found: #{f}"
|
38
57
|
|
39
58
|
# process each file
|
40
|
-
File.open(f) do |
|
59
|
+
File.open(f) do |g|
|
41
60
|
concept_name = nil
|
42
61
|
|
43
62
|
# process each line of the file
|
44
|
-
|
63
|
+
g.each_line do |line|
|
45
64
|
|
46
65
|
# search for the class declaration line
|
47
66
|
clazz, super_clazz = line.match(/class ([^<]*) < (.*)/).try(:captures)
|
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benjii
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|