survey_generator 0.2.99 → 0.2.991
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDMwOWRkZjVjOThiNzM5NGU3NTczNDYzYjI2NzNjNmY1NGZmYWU1OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTA0YjE2YjVjNWM1YmZlNzMyOWNiNzFmMjBkZmI1ODkwYzI1NmVjMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2QwYTdkNmIwYTZjZDNkNGQ4ZmJhYzIyMGM3MjQxZDVkZWI4NThhNTMzYzcx
|
10
|
+
ZTI4NWFhOGI0ZWMzYWU1Y2MyOWEyNTQ2ZDI1ODBiMmNmNDk1MzQ2MGRkY2Q3
|
11
|
+
ZWJmMTJlYTQyMWFmYWEyYThjMWYyNWEwMzc2MWJlYTgxYzNhNTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGZiZjk5YWFhOTBiMDhmZTk3MmNkYzE2MzQwMmYyMjM3YTI1ZjJmM2M4NmYw
|
14
|
+
ODcxMWMwYjg2MjkzNDExZWM2N2NlNjE2ODQxNTA3MzA3YjVmNzU0OTQ4MjRk
|
15
|
+
NTA5Yjg5ODhmYzUwZDI3MTcyMTRlYzM0NmEyYzZmZmYxMDU4NTU=
|
@@ -3,6 +3,8 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
class SurveyGenerator < Rails::Generators::Base
|
4
4
|
argument :model_path, :type => :string, :default => "#{Rails.root.to_s}/gen/models/survey_model.rb"
|
5
5
|
class_option :init, :type => :boolean, :default => false, :desc => "Performs all actions."
|
6
|
+
class_option :dynamic, :type => :boolean, :default => true, :desc => "Generates dynamic part of model."
|
7
|
+
class_option :static, :type => :boolean, :default => true, :desc => "Generates static part of model."
|
6
8
|
class_option :gems, :type => :boolean, :default => false, :desc => "Initialize application."
|
7
9
|
class_option :migrate, :type => :boolean, :default => false, :desc => "Perform database migrations."
|
8
10
|
class_option :populate, :type => :boolean, :default => false, :desc => "Populate database with users."
|
@@ -59,12 +61,12 @@ class SurveyGenerator < Rails::Generators::Base
|
|
59
61
|
templateContainer = RGen::TemplateLanguage::DirectoryTemplateContainer.new(SurveyMetamodel, Rails.root.to_s)
|
60
62
|
templateContainer.load(File.dirname(__FILE__) + '/templates')
|
61
63
|
|
62
|
-
if static
|
64
|
+
if options.static? && static
|
63
65
|
out "Generating static parts of model"
|
64
66
|
templateContainer.expand('main::static', :for => MODEL)
|
65
67
|
end
|
66
68
|
|
67
|
-
if dynamic
|
69
|
+
if options.dynamic? && dynamic
|
68
70
|
out "Generating dynamic parts of model"
|
69
71
|
templateContainer.expand('main::dynamic', :for => MODEL.first)
|
70
72
|
end
|
@@ -1,49 +1,62 @@
|
|
1
|
-
<% define '
|
1
|
+
<% define 'static' do %>
|
2
2
|
<% file "app/views/layouts/_header.html.erb" do %>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
<% expand 'start' %><%iinc%><%iinc%><%iinc%><%iinc%><%iinc%>
|
4
|
+
<% expand 'end' %>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% define 'dynamic', :for => Survey do %>
|
9
|
+
<% file "app/views/layouts/_header.html.erb" do %>
|
10
|
+
<% expand 'start' %>
|
11
|
+
<%nl%><%iinc%><%iinc%><%iinc%><%iinc%><%iinc%>
|
12
|
+
<li id="fat-menu" class="dropdown"><%iinc%>
|
13
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%iinc%>
|
14
|
+
Surveys <b class="caret"></b>
|
15
|
+
<%idec%></a>
|
16
|
+
<ul class="dropdown-menu"><%iinc%>
|
17
|
+
<li><%%= link_to "<%= title.capitalize %>", <%= name.pluralize.downcase %>_path %></li>
|
18
|
+
<%idec%></ul>
|
19
|
+
<%idec%></li>
|
20
|
+
<% expand 'end' %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<% define 'start' do %>
|
25
|
+
<header class="navbar navbar-fixed-top navbar-inverse"><%iinc%>
|
26
|
+
<div class="navbar-inner"><%iinc%>
|
27
|
+
<div class="container"><%iinc%>
|
28
|
+
<%%= link_to "sample app", root_path, id: "logo" %>
|
29
|
+
<nav><%iinc%>
|
30
|
+
<ul class="nav pull-right"><%iinc%>
|
31
|
+
<li><%%= link_to "Home", root_path %></li>
|
32
|
+
<li><%%= link_to "Help", help_path %></li>
|
33
|
+
|
34
|
+
<%nl%>
|
35
|
+
<%% if signed_in? %><%iinc%>
|
36
|
+
<li><%%= link_to "Users", users_path %></li>
|
37
|
+
<%idec%><%% end %>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<% define 'end' do %>
|
41
|
+
<%nl%>
|
42
|
+
<%% if signed_in? %><%iinc%>
|
18
43
|
<li id="fat-menu" class="dropdown"><%iinc%>
|
19
44
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%iinc%>
|
20
|
-
|
45
|
+
Account <b class="caret"></b>
|
21
46
|
<%idec%></a>
|
22
47
|
<ul class="dropdown-menu"><%iinc%>
|
23
|
-
<li><%%= link_to "
|
48
|
+
<li><%%= link_to "Profile", current_user %></li>
|
49
|
+
<li><%%= link_to "Settings", edit_user_path(current_user) %></li>
|
50
|
+
<li class="divider"></li>
|
51
|
+
<li><%%= link_to "Sign out", signout_path, method: "delete" %></li>
|
24
52
|
<%idec%></ul>
|
25
53
|
<%idec%></li>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
Account <b class="caret"></b>
|
32
|
-
<%idec%></a>
|
33
|
-
<ul class="dropdown-menu"><%iinc%>
|
34
|
-
<li><%%= link_to "Profile", current_user %></li>
|
35
|
-
<li><%%= link_to "Settings", edit_user_path(current_user) %></li>
|
36
|
-
<li class="divider"></li>
|
37
|
-
<li><%%= link_to "Sign out", signout_path, method: "delete" %></li>
|
38
|
-
<%idec%></ul>
|
39
|
-
<%idec%></li>
|
40
|
-
<%idec%><%% else %><%iinc%>
|
41
|
-
<li><%%= link_to "Sign in", signin_path %></li>
|
42
|
-
<%idec%><%% end %>
|
43
|
-
<%idec%></ul>
|
44
|
-
<%idec%></nav>
|
45
|
-
<%idec%></div>
|
54
|
+
<%idec%><%% else %><%iinc%>
|
55
|
+
<li><%%= link_to "Sign in", signin_path %></li>
|
56
|
+
<%idec%><%% end %>
|
57
|
+
<%idec%></ul>
|
58
|
+
<%idec%></nav>
|
46
59
|
<%idec%></div>
|
47
|
-
<%idec%></
|
48
|
-
<%
|
60
|
+
<%idec%></div>
|
61
|
+
<%idec%></header>
|
49
62
|
<% end %>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<% define 'static' do %>
|
2
2
|
<% expand 'layouts/application::application' %>
|
3
3
|
<% expand 'layouts/footer::footer' %>
|
4
|
+
<% expand 'layouts/header::static' %>
|
4
5
|
<% expand 'layouts/shim::shim' %>
|
5
6
|
|
6
7
|
<% expand 'sessions/new::new' %>
|
@@ -21,7 +22,7 @@
|
|
21
22
|
<% end %>
|
22
23
|
|
23
24
|
<% define 'dynamic' do %>
|
24
|
-
<% expand 'layouts/header::
|
25
|
+
<% expand 'layouts/header::dynamic' %>
|
25
26
|
|
26
27
|
<% expand 'survey/index::index' %>
|
27
28
|
<% expand 'survey/test::test' %>
|
@@ -1,46 +1,40 @@
|
|
1
1
|
<% define 'static' do %>
|
2
2
|
<% file "config/routes.rb" do %>
|
3
|
-
<% expand 'start'
|
4
|
-
|
5
|
-
<%idec%><% expand 'end' %>
|
3
|
+
<% expand 'start' %>
|
4
|
+
<% expand 'end' %>
|
6
5
|
<% end %>
|
7
6
|
<% end %>
|
8
7
|
|
9
8
|
<% define 'dynamic', :for => Survey do %>
|
10
9
|
<% file "config/routes.rb" do %>
|
11
|
-
<% expand 'start'
|
12
|
-
<%
|
13
|
-
|
14
|
-
<%nl%>
|
10
|
+
<% expand 'start' %>
|
11
|
+
<%nl%><%iinc%>
|
15
12
|
resources :<%= plural_name %>
|
16
13
|
match '/<%= plural_name %>', to: '<%= plural_name %>#index'
|
17
|
-
<%
|
14
|
+
<% expand 'end' %>
|
18
15
|
<% end %>
|
19
16
|
<% end %>
|
20
17
|
|
21
18
|
<% define 'start' do %>
|
22
|
-
<%= Rails.application.class.parent_name %>::Application.routes.draw do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
match '/help', to: 'static_pages#help'
|
40
|
-
match '/about', to: 'static_pages#about'
|
41
|
-
match '/contact', to: 'static_pages#contact'
|
19
|
+
<%= Rails.application.class.parent_name %>::Application.routes.draw do<%iinc%>
|
20
|
+
resources :surveys
|
21
|
+
resources :users
|
22
|
+
resources :sessions, only: [:new, :create, :destroy]
|
23
|
+
|
24
|
+
<%nl%>
|
25
|
+
root to: 'static_pages#home'
|
26
|
+
|
27
|
+
<%nl%>
|
28
|
+
match '/signup', to: 'users#new'
|
29
|
+
match '/signin', to: 'sessions#new'
|
30
|
+
match '/signout', to: 'sessions#destroy', via: :delete
|
31
|
+
|
32
|
+
<%nl%>
|
33
|
+
match '/help', to: 'static_pages#help'
|
34
|
+
match '/about', to: 'static_pages#about'
|
35
|
+
match '/contact', to: 'static_pages#contact'
|
42
36
|
<% end %>
|
43
37
|
|
44
38
|
<% define 'end' do %>
|
45
|
-
end
|
39
|
+
<%idec%>end
|
46
40
|
<% end %>
|