survey_generator 0.2.94 → 0.2.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/generators/survey/survey_generator.rb +30 -28
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmM5NTU1NzI1NWE5MjZiMzcwZTI1YzI0N2UzZjNlZDM5NTYzMzU4OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGE4ZWNlZWM4NDcyOTkzZTM5NjE4MjZiZTUwYmQ2NjQ3YzlkZjJiNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTA4MTk5YmIyNDcyOGE1YWMwMDUzNmJhOTVhNDdhNWQ2YjAwZjk4ODAyN2M4
|
10
|
+
NzUzYTFiNmRkNzQyZDgxNTI4MDQ3YzNhM2VjN2JmMzRkZjJjYzM2Njg2OTli
|
11
|
+
ZGY4OTg3ZTRiM2U3Njc4Y2RjMDYzY2ExMmI3ZTQwYzlkNGE5NWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmM0MWFlYjI1MWJkZDU2NGQwMjcyYzA5ZGUxNjZmYzFjZTNlYjM3NGQ1ZGY1
|
14
|
+
ZWY0YTlmZDE5Mjg4MmI3ZGU0MDY2N2ZjMTQwNzFjMjliY2JlMzU0NzZlNDIz
|
15
|
+
NjU2ODc2YTMzZWU3ZGZkN2RjMWI4NTc3M2EzMjc5OWI2YmZlZjM=
|
@@ -8,30 +8,32 @@ class SurveyGenerator < Rails::Generators::Base
|
|
8
8
|
class_option :populate, :type => :boolean, :default => false, :desc => "Populate database with users."
|
9
9
|
|
10
10
|
def generate_survey
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
if !(defined?(MODEL)).nil? && !MODEL.first.nil?
|
17
|
-
puts "Generating ruby on rails source code for the defined survey."
|
18
|
-
|
19
|
-
require 'metamodels/survey_metamodel'
|
11
|
+
if options.gems? or options.init?
|
12
|
+
init_gems
|
13
|
+
run 'rails g survey --migrate --populate' if options.init?
|
14
|
+
else
|
15
|
+
if File.exists? "#{model_path}.rb"
|
20
16
|
require 'rgen/template_language'
|
21
17
|
require 'rgen/array_extensions'
|
18
|
+
require 'metamodels/survey_metamodel'
|
19
|
+
require model_path
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
if !(defined?(MODEL)).nil? && !MODEL.first.nil?
|
22
|
+
puts "Generating ruby on rails source code for the defined survey."
|
23
|
+
|
24
|
+
tc = RGen::TemplateLanguage::DirectoryTemplateContainer.new(SurveyMetamodel, Rails.root.to_s)
|
25
|
+
tc.load(File.dirname(__FILE__) + '/templates')
|
26
|
+
tc.expand('main::root', for: MODEL.first)
|
27
|
+
|
28
|
+
migrate if options.migrate? or options.init?
|
29
|
+
populate if options.populate? or options.init?
|
30
|
+
else
|
31
|
+
puts "Model is empty. Please define a survey first."
|
32
|
+
end
|
29
33
|
else
|
30
|
-
puts "Model
|
34
|
+
puts "Model file does not exist."
|
35
|
+
create_model_file
|
31
36
|
end
|
32
|
-
else
|
33
|
-
puts "Model file does not exist."
|
34
|
-
create_model_file
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -40,22 +42,22 @@ class SurveyGenerator < Rails::Generators::Base
|
|
40
42
|
def init_gems
|
41
43
|
puts " initializing application"
|
42
44
|
|
43
|
-
|
45
|
+
init_gemfile
|
44
46
|
|
45
47
|
#For all environments
|
46
|
-
|
48
|
+
gem 'rails', '3.2.13'
|
47
49
|
gem 'bootstrap-sass', '2.1'
|
48
50
|
gem 'bcrypt-ruby', '3.0.1'
|
49
51
|
gem 'faker', '1.0.1'
|
50
52
|
gem 'will_paginate', '3.0.3'
|
51
53
|
gem 'bootstrap-will_paginate', '0.0.6'
|
52
|
-
|
54
|
+
gem 'jquery-rails'
|
53
55
|
gem 'rgen'
|
54
56
|
gem 'survey_generator'
|
55
57
|
|
56
58
|
#Group 'development' and 'test'
|
57
59
|
gem_group :development, :test do
|
58
|
-
|
60
|
+
gem 'sqlite3'
|
59
61
|
gem 'rspec-rails', '2.11.0'
|
60
62
|
end
|
61
63
|
|
@@ -72,11 +74,11 @@ class SurveyGenerator < Rails::Generators::Base
|
|
72
74
|
gem 'pg', '0.12.2'
|
73
75
|
end
|
74
76
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
gem_group :assets do
|
78
|
+
gem 'sass-rails','~> 3.2.3'
|
79
|
+
gem 'coffee-rails', '~> 3.2.1'
|
80
|
+
gem 'uglifier', '>= 1.0.3'
|
81
|
+
end
|
80
82
|
|
81
83
|
if File.exists? "#{Rails.root.to_s}/public/index.html"
|
82
84
|
run "rm public/index.html"
|