somatics3-generators 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/generators/somatics/attributes/attributes_generator.rb +197 -0
- data/lib/generators/somatics/attributes/templates/migration.rb +11 -0
- data/lib/generators/somatics/authenticated/authenticated_generator.rb +0 -1
- data/lib/generators/somatics/relationship/relationship_generator.rb +198 -0
- data/lib/generators/somatics/relationship/templates/migration.rb +11 -0
- data/lib/somatics3-generators.rb +4 -3
- data/somatics3-generators.gemspec +6 -2
- data/templates/somatics.rb +4 -1
- metadata +9 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
@@ -0,0 +1,197 @@
|
|
1
|
+
require 'generators/somatics'
|
2
|
+
require 'rails/generators/named_base'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
module Somatics
|
6
|
+
module Generators
|
7
|
+
class AttributesGenerator < Rails::Generators::NamedBase
|
8
|
+
extend TemplatePath
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
# include Rails::Generators::ResourceHelpers
|
11
|
+
|
12
|
+
def dump_generator_attribute_names
|
13
|
+
generator_attribute_names = [
|
14
|
+
:name,
|
15
|
+
:singular_name,
|
16
|
+
:human_name,
|
17
|
+
:plural_name,
|
18
|
+
:relationship,
|
19
|
+
:model_name,
|
20
|
+
:class_name,
|
21
|
+
:reference_model_name,
|
22
|
+
:reference_class_name,
|
23
|
+
:reference_value,
|
24
|
+
:migration_model_name,
|
25
|
+
:migration_table_name,
|
26
|
+
:migration_attribute ,
|
27
|
+
:table_name
|
28
|
+
|
29
|
+
]
|
30
|
+
|
31
|
+
generator_attribute_names.each do |attr|
|
32
|
+
puts "%-40s %s" % ["#{attr}:", self.send(attr.to_s)] # instance_variable_get("@#{attr.to_s}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_relationship_to_model
|
38
|
+
relation = "has_many :#{reference_value}"
|
39
|
+
sentinel = "class #{class_name} < ActiveRecord::Base\n"
|
40
|
+
gsub_file File.join('app/models', "#{model_name}.rb"), /(#{Regexp.escape(sentinel)})/mi do |match|
|
41
|
+
"#{match} #{relation}\n"
|
42
|
+
end
|
43
|
+
# logger.insert relation
|
44
|
+
relation = "belongs_to :#{model_name}"
|
45
|
+
sentinel = "class #{reference_class_name} < ActiveRecord::Base\n"
|
46
|
+
gsub_file File.join('app/models', "#{reference_model_name}.rb"), /(#{Regexp.escape(sentinel)})/mi do |match|
|
47
|
+
"#{match} #{relation}\n"
|
48
|
+
end
|
49
|
+
# logger.insert relation
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_show_view_to_model_show
|
53
|
+
sentinel = "<!-- More List View -->\n"
|
54
|
+
reference_list = <<-CODE
|
55
|
+
<% if @#{reference_model_name}.#{model_name} %>
|
56
|
+
<h3><%=link_to "\#{#{class_name}.human_name} #\#{@#{reference_model_name}.#{model_name}.id}", [:admin, @#{reference_model_name}.#{model_name}] %></h3>
|
57
|
+
<div class="issue detail">
|
58
|
+
<%= render :partial => 'admin/#{model_name.pluralize}/show' , :locals => {:#{model_name} => @#{reference_model_name}.#{model_name}} %>
|
59
|
+
</div>
|
60
|
+
<% end %>
|
61
|
+
CODE
|
62
|
+
gsub_file File.join('app/views/admin', reference_model_name.pluralize, 'show.html.erb'), /(#{Regexp.escape(sentinel)})/mi do |match|
|
63
|
+
"#{match}#{reference_list}"
|
64
|
+
end
|
65
|
+
# logger.update File.join('app/views/admin', model_name.pluralize, 'show.html.erb')
|
66
|
+
gsub_file File.join('app/views/admin', reference_model_name.pluralize, 'edit.html.erb'), /(#{Regexp.escape(sentinel)})/mi do |match|
|
67
|
+
"#{match}#{reference_list}"
|
68
|
+
end
|
69
|
+
# logger.update File.join('app/views/admin', reference_model_name.pluralize, 'edit.html.erb')
|
70
|
+
end
|
71
|
+
|
72
|
+
def add_list_view_to_model_show
|
73
|
+
sentinel = "<!-- More List View -->\n"
|
74
|
+
reference_list = <<-CODE
|
75
|
+
<div class="contextual">
|
76
|
+
<%= link_to "\#{t 'Add'} \#{#{reference_class_name}.human_name}", '#', :class => "icon icon-add", :onclick => "showAndScrollTo('add_#{reference_model_name}','focus_#{reference_model_name}'); return false;"%>
|
77
|
+
</div>
|
78
|
+
<h3><%=#{reference_class_name}.human_name%></h3>
|
79
|
+
<% @#{reference_value} = @#{model_name}.#{reference_value}.paginate(:page => params[:#{reference_model_name}_page], :order => (params[:#{reference_model_name}_sort].gsub('_reverse', ' DESC') unless params[:#{reference_model_name}_sort].blank?))%>
|
80
|
+
<div class="autoscroll">
|
81
|
+
<%= render :partial => 'admin/#{reference_value}/list', :locals => {:#{reference_value} => @#{reference_value}} %>
|
82
|
+
</div>
|
83
|
+
<%= will_paginate @#{reference_value}, :renderer => SomaticLinkRenderer %>
|
84
|
+
<div id="add_#{reference_model_name}" style="display:none">
|
85
|
+
<h3><%= "\#{t('New')} \#{#{reference_class_name}.human_name}" %></h3>
|
86
|
+
<div id="focus_#{reference_model_name}"></div>
|
87
|
+
<% form_for([:admin, @#{model_name}.#{reference_value}.build]) do |f| %>
|
88
|
+
<%= f.error_messages %>
|
89
|
+
<div class="issue">
|
90
|
+
<%= render :partial => 'admin/#{reference_value}/form' , :locals => {:f => f} %>
|
91
|
+
</div>
|
92
|
+
<%= hidden_field_tag :return_to, url_for%>
|
93
|
+
<%= f.submit t('Create') %>
|
94
|
+
<% end %>
|
95
|
+
<%= link_to_function t('Cancel'), "$('add_#{reference_model_name}').hide()"%>
|
96
|
+
</div>
|
97
|
+
CODE
|
98
|
+
gsub_file File.join('app/views/admin', model_name.pluralize, 'show.html.erb'), /(#{Regexp.escape(sentinel)})/mi do |match|
|
99
|
+
"#{match}#{reference_list}"
|
100
|
+
end
|
101
|
+
# logger.update File.join('app/views/admin', model_name.pluralize, 'show.html.erb')
|
102
|
+
gsub_file File.join('app/views/admin', model_name.pluralize, 'edit.html.erb'), /(#{Regexp.escape(sentinel)})/mi do |match|
|
103
|
+
"#{match}#{reference_list}"
|
104
|
+
end
|
105
|
+
# logger.update File.join('app/views/admin', model_name.pluralize, 'edit.html.erb')
|
106
|
+
end
|
107
|
+
|
108
|
+
def migrations
|
109
|
+
if relationship == 'has_many'
|
110
|
+
|
111
|
+
#TODO : dependency 'admin_attributes', [migration_model_name, "#{migration_attribute}:integer"], :skip_migration => true unless options[:skip_views]
|
112
|
+
# raise 'migration_exists' if m.migration_exists?("add_#{migration_attribute}_to_#{migration_table_name}")
|
113
|
+
unless options[:skip_migration]
|
114
|
+
migration_template 'migration.rb', "db/migrate/add_#{migration_attribute}_to_#{migration_table_name}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
protected
|
121
|
+
|
122
|
+
def match_data
|
123
|
+
@match_data ||= name.match(/(.*)_(has_many|belongs_to)_(.*)/)
|
124
|
+
end
|
125
|
+
|
126
|
+
def relationship
|
127
|
+
match_data[2]
|
128
|
+
end
|
129
|
+
|
130
|
+
def model_name
|
131
|
+
match_data[1].singularize
|
132
|
+
end
|
133
|
+
|
134
|
+
def class_name
|
135
|
+
model_name.classify
|
136
|
+
end
|
137
|
+
|
138
|
+
def reference_model_name
|
139
|
+
match_data[3].singularize
|
140
|
+
end
|
141
|
+
|
142
|
+
def reference_class_name
|
143
|
+
reference_model_name.classify
|
144
|
+
end
|
145
|
+
|
146
|
+
def reference_value
|
147
|
+
reference_model_name.pluralize
|
148
|
+
end
|
149
|
+
|
150
|
+
def migration_table_name
|
151
|
+
reference_value
|
152
|
+
end
|
153
|
+
|
154
|
+
def migration_model_name
|
155
|
+
reference_model_name
|
156
|
+
end
|
157
|
+
|
158
|
+
def migration_attribute
|
159
|
+
"#{model_name}_id"
|
160
|
+
end
|
161
|
+
|
162
|
+
#
|
163
|
+
# Implement the required interface for Rails::Generators::Migration.
|
164
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
165
|
+
#
|
166
|
+
def self.next_migration_number(dirname) #:nodoc:
|
167
|
+
if ActiveRecord::Base.timestamped_migrations
|
168
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
169
|
+
else
|
170
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def legacy_functions
|
175
|
+
raise banner unless match_data = @command.match(/(.*)_(has_many|belongs_to)_(.*)/)
|
176
|
+
@relationship = match_data[2]
|
177
|
+
@model_name = match_data[1].singularize
|
178
|
+
@class_name = @model_name.camelize
|
179
|
+
@reference_model_name = match_data[3].singularize
|
180
|
+
@reference_class_name = @reference_model_name.camelize
|
181
|
+
case @relationship
|
182
|
+
when 'has_many'
|
183
|
+
@reference_value = @reference_model_name.pluralize
|
184
|
+
@migration_model_name = @reference_model_name
|
185
|
+
@migration_table_name = @reference_value
|
186
|
+
@migration_attribute = "#{@model_name}_id"
|
187
|
+
when 'belongs_to'
|
188
|
+
# @reference_value = @reference_model_name
|
189
|
+
# @migration_model_name = @model_name
|
190
|
+
# @migration_table_name = @model_name.pluralize
|
191
|
+
# @migration_attribute = "#{@reference_model_name}_id"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class <%= "add_#{migration_attribute}_to_#{migration_table_name}".camelize %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :<%= migration_table_name %>, :<%= migration_attribute %>, :integer
|
4
|
+
add_index :<%= migration_table_name %>, :<%= migration_attribute %>
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_index :<%= migration_table_name %>, :<%= migration_attribute %>
|
9
|
+
remove_column :<%= migration_table_name %>, :<%= migration_attribute %>
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
require 'generators/somatics'
|
2
|
+
require 'rails/generators/named_base'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
module Somatics
|
6
|
+
module Generators
|
7
|
+
class RelationshipGenerator < Rails::Generators::NamedBase
|
8
|
+
extend TemplatePath
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
# include Rails::Generators::ResourceHelpers
|
11
|
+
class_option :skip_migration, :type => :boolean, :desc => "Don't generate a migration file for this model."
|
12
|
+
class_option :namespace, :banner => "NAME", :type => :string, :default => 'admin'
|
13
|
+
|
14
|
+
def dump_generator_attribute_names
|
15
|
+
generator_attribute_names = [
|
16
|
+
:name,
|
17
|
+
:singular_name,
|
18
|
+
:human_name,
|
19
|
+
:plural_name,
|
20
|
+
:relationship,
|
21
|
+
:model_name,
|
22
|
+
:class_name,
|
23
|
+
:reference_model_name,
|
24
|
+
:reference_class_name,
|
25
|
+
:reference_value,
|
26
|
+
:migration_model_name,
|
27
|
+
:migration_table_name,
|
28
|
+
:migration_attribute ,
|
29
|
+
:table_name
|
30
|
+
|
31
|
+
]
|
32
|
+
|
33
|
+
generator_attribute_names.each do |attr|
|
34
|
+
puts "%-40s %s" % ["#{attr}:", self.send(attr.to_s)] # instance_variable_get("@#{attr.to_s}"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_relationship_to_model
|
40
|
+
relation = " has_many :#{reference_value}"
|
41
|
+
# sentinel = "class #{class_name} < ActiveRecord::Base\n"
|
42
|
+
inject_into_class "app/models/#{model_name}.rb", class_name, relation
|
43
|
+
|
44
|
+
relation = " belongs_to :#{model_name}"
|
45
|
+
# sentinel = "class #{reference_class_name} < ActiveRecord::Base\n"
|
46
|
+
inject_into_class "app/models/#{reference_model_name}.rb",reference_class_name, relation
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_show_view_to_model_show
|
51
|
+
sentinel = "<!-- More List View -->\n"
|
52
|
+
reference_list = <<-CODE
|
53
|
+
<% if @#{reference_model_name}.#{model_name} %>
|
54
|
+
<h3><%=link_to "\#{#{class_name}.human_name} #\#{@#{reference_model_name}.#{model_name}.id}", [:admin, @#{reference_model_name}.#{model_name}] %></h3>
|
55
|
+
<div class="issue detail">
|
56
|
+
<%= render :partial => 'admin/#{model_name.pluralize}/show' , :locals => {:#{model_name} => @#{reference_model_name}.#{model_name}} %>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
59
|
+
CODE
|
60
|
+
inject_into_file File.join('app/views',options[:namespace], reference_model_name.pluralize, 'show.html.erb'), :after => sentinel do
|
61
|
+
"#{reference_list}"
|
62
|
+
end
|
63
|
+
|
64
|
+
inject_into_file File.join('app/views',options[:namespace], reference_model_name.pluralize, 'edit.html.erb'), :after => sentinel do
|
65
|
+
"#{reference_list}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def add_list_view_to_model_show
|
70
|
+
sentinel = "<!-- More List View -->\n"
|
71
|
+
reference_list = <<-CODE
|
72
|
+
<div class="contextual">
|
73
|
+
<%= link_to "\#{t 'Add'} \#{#{reference_class_name}.human_name}", '#', :class => "icon icon-add", :onclick => "showAndScrollTo('add_#{reference_model_name}','focus_#{reference_model_name}'); return false;"%>
|
74
|
+
</div>
|
75
|
+
<h3><%=#{reference_class_name}.human_name%></h3>
|
76
|
+
<% @#{reference_value} = @#{model_name}.#{reference_value}.paginate(:page => params[:#{reference_model_name}_page], :order => (params[:#{reference_model_name}_sort].gsub('_reverse', ' DESC') unless params[:#{reference_model_name}_sort].blank?))%>
|
77
|
+
<div class="autoscroll">
|
78
|
+
<%= render :partial => 'admin/#{reference_value}/list', :locals => {:#{reference_value} => @#{reference_value}} %>
|
79
|
+
</div>
|
80
|
+
<%= will_paginate @#{reference_value}, :renderer => SomaticLinkRenderer %>
|
81
|
+
<div id="add_#{reference_model_name}" style="display:none">
|
82
|
+
<h3><%= "\#{t('New')} \#{#{reference_class_name}.human_name}" %></h3>
|
83
|
+
<div id="focus_#{reference_model_name}"></div>
|
84
|
+
<% form_for([:admin, @#{model_name}.#{reference_value}.build]) do |f| %>
|
85
|
+
<%= f.error_messages %>
|
86
|
+
<div class="issue">
|
87
|
+
<%= render :partial => 'admin/#{reference_value}/form' , :locals => {:f => f} %>
|
88
|
+
</div>
|
89
|
+
<%= hidden_field_tag :return_to, url_for%>
|
90
|
+
<%= f.submit t('Create') %>
|
91
|
+
<% end %>
|
92
|
+
<%= link_to_function t('Cancel'), "$('add_#{reference_model_name}').hide()"%>
|
93
|
+
</div>
|
94
|
+
CODE
|
95
|
+
inject_into_file File.join('app/views',options[:namespace], model_name.pluralize, 'show.html.erb'), :after => sentinel do
|
96
|
+
"#{reference_list}"
|
97
|
+
end
|
98
|
+
|
99
|
+
inject_into_file File.join('app/views',options[:namespace], model_name.pluralize, 'edit.html.erb'), :after => sentinel do
|
100
|
+
"#{reference_list}"
|
101
|
+
end
|
102
|
+
# logger.update File.join('app/views/admin', model_name.pluralize, 'edit.html.erb')
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_hidden_field_to_edit_view
|
106
|
+
prepend_file File.join('app/views',options[:namespace], reference_model_name.pluralize, '_form.html.erb'), "<%= f.hidden_field :#{migration_attribute} %>"
|
107
|
+
end
|
108
|
+
|
109
|
+
def migrations
|
110
|
+
if relationship == 'has_many'
|
111
|
+
|
112
|
+
#TODO : dependency 'admin_attributes', [migration_model_name, "#{migration_attribute}:integer"], :skip_migration => true unless options[:skip_views]
|
113
|
+
# raise 'migration_exists' if m.migration_exists?("add_#{migration_attribute}_to_#{migration_table_name}")
|
114
|
+
unless options[:skip_migration]
|
115
|
+
migration_template 'migration.rb', "db/migrate/add_#{migration_attribute}_to_#{migration_table_name}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
protected
|
122
|
+
|
123
|
+
def match_data
|
124
|
+
@match_data ||= name.match(/(.*)_(has_many|belongs_to)_(.*)/)
|
125
|
+
end
|
126
|
+
|
127
|
+
def relationship
|
128
|
+
match_data[2]
|
129
|
+
end
|
130
|
+
|
131
|
+
def model_name
|
132
|
+
match_data[1].singularize
|
133
|
+
end
|
134
|
+
|
135
|
+
def class_name
|
136
|
+
model_name.classify
|
137
|
+
end
|
138
|
+
|
139
|
+
def reference_model_name
|
140
|
+
match_data[3].singularize
|
141
|
+
end
|
142
|
+
|
143
|
+
def reference_class_name
|
144
|
+
reference_model_name.classify
|
145
|
+
end
|
146
|
+
|
147
|
+
def reference_value
|
148
|
+
reference_model_name.pluralize
|
149
|
+
end
|
150
|
+
|
151
|
+
def migration_table_name
|
152
|
+
reference_value
|
153
|
+
end
|
154
|
+
|
155
|
+
def migration_model_name
|
156
|
+
reference_model_name
|
157
|
+
end
|
158
|
+
|
159
|
+
def migration_attribute
|
160
|
+
"#{model_name}_id"
|
161
|
+
end
|
162
|
+
|
163
|
+
#
|
164
|
+
# Implement the required interface for Rails::Generators::Migration.
|
165
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
166
|
+
#
|
167
|
+
def self.next_migration_number(dirname) #:nodoc:
|
168
|
+
if ActiveRecord::Base.timestamped_migrations
|
169
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
170
|
+
else
|
171
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def legacy_functions
|
176
|
+
raise banner unless match_data = @command.match(/(.*)_(has_many|belongs_to)_(.*)/)
|
177
|
+
@relationship = match_data[2]
|
178
|
+
@model_name = match_data[1].singularize
|
179
|
+
@class_name = @model_name.camelize
|
180
|
+
@reference_model_name = match_data[3].singularize
|
181
|
+
@reference_class_name = @reference_model_name.camelize
|
182
|
+
case @relationship
|
183
|
+
when 'has_many'
|
184
|
+
@reference_value = @reference_model_name.pluralize
|
185
|
+
@migration_model_name = @reference_model_name
|
186
|
+
@migration_table_name = @reference_value
|
187
|
+
@migration_attribute = "#{@model_name}_id"
|
188
|
+
when 'belongs_to'
|
189
|
+
# @reference_value = @reference_model_name
|
190
|
+
# @migration_model_name = @model_name
|
191
|
+
# @migration_table_name = @model_name.pluralize
|
192
|
+
# @migration_attribute = "#{@reference_model_name}_id"
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class <%= "add_#{migration_attribute}_to_#{migration_table_name}".camelize %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :<%= migration_table_name %>, :<%= migration_attribute %>, :integer
|
4
|
+
add_index :<%= migration_table_name %>, :<%= migration_attribute %>
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_index :<%= migration_table_name %>, :<%= migration_attribute %>
|
9
|
+
remove_column :<%= migration_table_name %>, :<%= migration_attribute %>
|
10
|
+
end
|
11
|
+
end
|
data/lib/somatics3-generators.rb
CHANGED
@@ -10,9 +10,10 @@ Rails::Generators.hidden_namespaces << "rails"
|
|
10
10
|
[
|
11
11
|
# "#{template}:controller",
|
12
12
|
# "#{template}:scaffold",
|
13
|
-
|
14
|
-
"#{template}:
|
15
|
-
"#{template}:
|
13
|
+
"#{template}:scaffold_controller",
|
14
|
+
"#{template}:helper",
|
15
|
+
"#{template}:authenticated",
|
16
|
+
"#{template}:authenticated_controller",
|
16
17
|
]
|
17
18
|
end
|
18
19
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{somatics3-generators}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Benjamin Wong"]
|
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
"bin/somatics",
|
28
28
|
"bin/somatify",
|
29
29
|
"lib/generators/somatics.rb",
|
30
|
+
"lib/generators/somatics/attributes/attributes_generator.rb",
|
31
|
+
"lib/generators/somatics/attributes/templates/migration.rb",
|
30
32
|
"lib/generators/somatics/authenticated/authenticated_generator.rb",
|
31
33
|
"lib/generators/somatics/authenticated/templates/mailer.rb",
|
32
34
|
"lib/generators/somatics/authenticated/templates/migration.rb",
|
@@ -169,6 +171,8 @@ Gem::Specification.new do |s|
|
|
169
171
|
"lib/generators/somatics/install/templates/public/stylesheets/somatics/csshover.htc",
|
170
172
|
"lib/generators/somatics/install/templates/public/stylesheets/somatics/jstoolbar.css",
|
171
173
|
"lib/generators/somatics/install/templates/view_index.html.erb",
|
174
|
+
"lib/generators/somatics/relationship/relationship_generator.rb",
|
175
|
+
"lib/generators/somatics/relationship/templates/migration.rb",
|
172
176
|
"lib/generators/somatics/scaffold/scaffold_generator.rb",
|
173
177
|
"lib/generators/somatics/scaffold/templates/_form.html.erb",
|
174
178
|
"lib/generators/somatics/scaffold/templates/edit.html.erb",
|
@@ -200,7 +204,7 @@ Gem::Specification.new do |s|
|
|
200
204
|
"test/test_somatics3-generators.rb"
|
201
205
|
]
|
202
206
|
s.homepage = %q{http://github.com/inspiresynergy/somatics3-generators}
|
203
|
-
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/generators/somatics/authenticated/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/model.rb", "--exclude=lib/generators/somatics/authenticated/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated/templates/test", "--exclude=lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/activation.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/config", "--exclude=lib/generators/somatics/authenticated_controller/templates/controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/login.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/model.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/session_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup_notification.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/test", "--exclude=lib/generators/somatics/install/templates/config", "--exclude=lib/generators/somatics/install/templates/controller_admin.rb", "--exclude=lib/generators/somatics/install/templates/controller_home.rb", "--exclude=lib/generators/somatics/install/templates/helper_admin.rb", "--exclude=lib/generators/somatics/install/templates/layout_admin.html.erb", "--exclude=lib/generators/somatics/install/templates/lib", "--exclude=lib/generators/somatics/install/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/install/templates/public", "--exclude=lib/generators/somatics/install/templates/view_index.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/_form.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/edit.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/index.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/new.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/show.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder", "--exclude=lib/generators/somatics/scaffold_controller/templates/controller.rb", "--exclude=lib/generators/somatics/scaffold_controller/templates/locales_en.yml", "--exclude=lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_bulk.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_edit.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_form.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_list.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_show.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_edit.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_index.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_new.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_show.html.erb"]
|
207
|
+
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/generators/somatics/attributes/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/model.rb", "--exclude=lib/generators/somatics/authenticated/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated/templates/test", "--exclude=lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/activation.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/config", "--exclude=lib/generators/somatics/authenticated_controller/templates/controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/login.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/model.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/session_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup_notification.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/test", "--exclude=lib/generators/somatics/install/templates/config", "--exclude=lib/generators/somatics/install/templates/controller_admin.rb", "--exclude=lib/generators/somatics/install/templates/controller_home.rb", "--exclude=lib/generators/somatics/install/templates/helper_admin.rb", "--exclude=lib/generators/somatics/install/templates/layout_admin.html.erb", "--exclude=lib/generators/somatics/install/templates/lib", "--exclude=lib/generators/somatics/install/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/install/templates/public", "--exclude=lib/generators/somatics/install/templates/view_index.html.erb", "--exclude=lib/generators/somatics/relationship/templates/migration.rb", "--exclude=lib/generators/somatics/scaffold/templates/_form.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/edit.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/index.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/new.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/show.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder", "--exclude=lib/generators/somatics/scaffold_controller/templates/controller.rb", "--exclude=lib/generators/somatics/scaffold_controller/templates/locales_en.yml", "--exclude=lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_bulk.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_edit.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_form.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_list.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_show.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_edit.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_index.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_new.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_show.html.erb"]
|
204
208
|
s.require_paths = ["lib"]
|
205
209
|
s.rubyforge_project = %q{somatics3}
|
206
210
|
s.rubygems_version = %q{1.3.7}
|
data/templates/somatics.rb
CHANGED
@@ -9,6 +9,8 @@ gem 'prawn', :version => '0.6.3'
|
|
9
9
|
gem 'somatics3-generators'
|
10
10
|
gem 'json'
|
11
11
|
|
12
|
+
rake "gems:install", :sudo => true
|
13
|
+
|
12
14
|
plugin 'action_mailer_optional_tls',
|
13
15
|
:git => 'git://github.com/collectiveidea/action_mailer_optional_tls.git'
|
14
16
|
plugin 'faster_csv',
|
@@ -89,12 +91,13 @@ rakefile "setup_svn.rake" do
|
|
89
91
|
TASK
|
90
92
|
end
|
91
93
|
|
92
|
-
# rake "gems:install", :sudo => true
|
93
94
|
generate "somatics:install"
|
94
95
|
environment 'config.autoload_paths += %W(#{config.root}/lib)'
|
95
96
|
generate "somatics:authenticated user"
|
96
97
|
generate "somatics:authenticated_controller admin/user --model=User"
|
97
98
|
|
99
|
+
run %(rails runner "User.create(:name => 'Admin', :login => 'admin', :password => 'somatics', :password_confirmation => 'somatics', :email => 'admin@admin.com')")
|
100
|
+
|
98
101
|
#
|
99
102
|
# generate "tinymce_installation"
|
100
103
|
# generate "admin_controllers"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: somatics3-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Wong
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- bin/somatics
|
40
40
|
- bin/somatify
|
41
41
|
- lib/generators/somatics.rb
|
42
|
+
- lib/generators/somatics/attributes/attributes_generator.rb
|
43
|
+
- lib/generators/somatics/attributes/templates/migration.rb
|
42
44
|
- lib/generators/somatics/authenticated/authenticated_generator.rb
|
43
45
|
- lib/generators/somatics/authenticated/templates/mailer.rb
|
44
46
|
- lib/generators/somatics/authenticated/templates/migration.rb
|
@@ -181,6 +183,8 @@ files:
|
|
181
183
|
- lib/generators/somatics/install/templates/public/stylesheets/somatics/csshover.htc
|
182
184
|
- lib/generators/somatics/install/templates/public/stylesheets/somatics/jstoolbar.css
|
183
185
|
- lib/generators/somatics/install/templates/view_index.html.erb
|
186
|
+
- lib/generators/somatics/relationship/relationship_generator.rb
|
187
|
+
- lib/generators/somatics/relationship/templates/migration.rb
|
184
188
|
- lib/generators/somatics/scaffold/scaffold_generator.rb
|
185
189
|
- lib/generators/somatics/scaffold/templates/_form.html.erb
|
186
190
|
- lib/generators/somatics/scaffold/templates/edit.html.erb
|
@@ -217,6 +221,7 @@ licenses: []
|
|
217
221
|
post_install_message:
|
218
222
|
rdoc_options:
|
219
223
|
- --charset=UTF-8
|
224
|
+
- --exclude=lib/generators/somatics/attributes/templates/migration.rb
|
220
225
|
- --exclude=lib/generators/somatics/authenticated/templates/mailer.rb
|
221
226
|
- --exclude=lib/generators/somatics/authenticated/templates/migration.rb
|
222
227
|
- --exclude=lib/generators/somatics/authenticated/templates/model.rb
|
@@ -248,6 +253,7 @@ rdoc_options:
|
|
248
253
|
- --exclude=lib/generators/somatics/install/templates/partial_menu.html.erb
|
249
254
|
- --exclude=lib/generators/somatics/install/templates/public
|
250
255
|
- --exclude=lib/generators/somatics/install/templates/view_index.html.erb
|
256
|
+
- --exclude=lib/generators/somatics/relationship/templates/migration.rb
|
251
257
|
- --exclude=lib/generators/somatics/scaffold/templates/_form.html.erb
|
252
258
|
- --exclude=lib/generators/somatics/scaffold/templates/edit.html.erb
|
253
259
|
- --exclude=lib/generators/somatics/scaffold/templates/index.html.erb
|