leonardo 1.8.2 → 1.8.3

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.
data/CHANGELOG CHANGED
@@ -1,16 +1,21 @@
1
- 1.8.2 (October 10th, 2011) Marco Mastrodonato
2
- * List: Added id as first column
3
- * Replaced String.any? with String.size>0 for ruby 1.9.2 support
1
+ 1.8.3 (November 8th, 2011) Marco Mastrodonato
2
+ * Controller/sort_column => Fixed an issue with multiple tables
3
+ * Dev users are now added by rake db:seed, no more by migration
4
4
 
5
5
  TODO:
6
6
  * Lists: Multiple selection and multiple operation
7
- * Lists: Add id as first column
8
7
  * Model: Create name attribute for every one that does not have
9
8
  * Handle eager loading including child resources
10
9
  * Add user management
11
10
 
12
11
 
13
12
 
13
+ 1.8.2 (October 10th, 2011) Marco Mastrodonato
14
+ * List: Added id as first column
15
+ * Replaced String.any? with String.size>0 for ruby 1.9.2 support
16
+
17
+
18
+
14
19
  1.8.1 (October 10th, 2011) Marco Mastrodonato
15
20
  * Updated rspec to pass index view test with two new controller helpers
16
21
  * Date managed with datepicker are now in year-month-day format and now works with sqlite3
@@ -163,35 +163,51 @@ class LeolayGenerator < Rails::Generators::Base
163
163
  end
164
164
 
165
165
 
166
- def create_admin_migration
167
- file = "db/migrate/*_create_admin.rb"
168
- return unless options.authentication? and Dir[file].empty?
169
- file = file.sub('*', Time.now.strftime("%Y%m%d%H%M99"))
170
- create_file file do
166
+ #def create_admin_migration
167
+ # file = "db/migrate/*_create_admin.rb"
168
+ # return unless options.authentication? and Dir[file].empty?
169
+ # file = file.sub('*', Time.now.strftime("%Y%m%d%H%M99"))
170
+ # create_file file do
171
+ # <<-FILE.gsub(/^ /, '')
172
+ # class CreateAdmin < ActiveRecord::Migration
173
+ # def self.up
174
+ # add_column :users, :roles_mask, :integer
175
+ # user=User.new :email => 'admin@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
176
+ # user.roles=['admin']
177
+ # user.save
178
+ # user=User.new :email => 'manager@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
179
+ # user.roles=['manager']
180
+ # user.save
181
+ # user=User.new :email => 'user@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
182
+ # user.roles=['user']
183
+ # user.save
184
+ # end
185
+ # def self.down
186
+ # User.delete User.find_all_by_email(['admin@#{app_name.downcase}.com',
187
+ # 'manager@#{app_name.downcase}.com',
188
+ # 'user@#{app_name.downcase}.com']).map(&:id)
189
+ # remove_column :users, :roles_mask
190
+ # end
191
+ # end
192
+ # FILE
193
+ # end
194
+ #end
195
+ def create_users_for_development
196
+ return unless options.authentication?
197
+ file = "db/seeds.rb"
198
+ append_file file do
171
199
  <<-FILE.gsub(/^ /, '')
172
- class CreateAdmin < ActiveRecord::Migration
173
- def self.up
174
- add_column :users, :roles_mask, :integer
175
- user=User.new :email => 'admin@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
176
- user.roles=['admin']
177
- user.save
178
- user=User.new :email => 'manager@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
179
- user.roles=['manager']
180
- user.save
181
- user=User.new :email => 'user@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
182
- user.roles=['user']
183
- user.save
184
- end
185
- def self.down
186
- User.delete User.find_all_by_email(['admin@#{app_name.downcase}.com',
187
- 'manager@#{app_name.downcase}.com',
188
- 'user@#{app_name.downcase}.com']).map(&:id)
189
- remove_column :users, :roles_mask
190
- end
191
- end
200
+ user=User.new :email => 'admin@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
201
+ #{"user.roles=['admin']" if options.authorization?}
202
+ user.save
203
+ user=User.new :email => 'manager@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
204
+ #{"user.roles=['manager']" if options.authorization?}
205
+ user.save
206
+ user=User.new :email => 'user@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
207
+ #{"user.roles=['user']" if options.authorization?}
208
+ user.save
192
209
  FILE
193
- end
194
-
210
+ end if File.exists?(file)
195
211
  end
196
212
 
197
213
  def setup_formtastic
@@ -163,7 +163,7 @@ end
163
163
  %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
164
164
  end
165
165
  def sort_column
166
- <%= class_name %>.column_names.include?(params[:sort]) ? params[:sort] : "id"
166
+ <%= class_name %>.column_names.include?(params[:sort]) ? params[:sort] : "#{<%= class_name %>.table_name}.id"
167
167
  end
168
168
  end
169
169
  <% end -%>
data/template.rb CHANGED
@@ -6,7 +6,9 @@
6
6
  # USAGE: rails new yourappname -m template.rb
7
7
  #
8
8
  # -------------------------------------------------------
9
+ # 08-11-2011: Add roles_mask migration for cancan gem
9
10
  # 27-10-2011: Replaced String.any? with String.size>0 for ruby 1.9.2 support
11
+ # 21-10-2011: Davide L. - Added folder creation 'vendor/assets/javascripts/include/' for linux compatibility
10
12
  # 05-10-2011: Added ajax option
11
13
  # 25-08-2011: Added rspec generation
12
14
  #########################################################
@@ -94,7 +96,10 @@ if devise
94
96
  #generate("devise:views") #not use since leolay copies custom views
95
97
  end
96
98
 
97
- generate "cancan:ability" if cancan
99
+ if cancan
100
+ generate "cancan:ability"
101
+ generate "migration", "AddRolesMaskToUsers", "roles_mask:integer"
102
+ end
98
103
 
99
104
  generate "autocomplete:install" if ajax
100
105
 
@@ -141,6 +146,7 @@ File.unlink "public/index.html"
141
146
 
142
147
  rake "db:create:all"
143
148
  rake "db:migrate"
149
+ rake "db:seed"
144
150
 
145
151
  #rake "gems:unpack" if yes?("Unpack to vendor/gems ?")
146
152
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leonardo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 2
10
- version: 1.8.2
9
+ - 3
10
+ version: 1.8.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marco Mastrodonato
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-27 00:00:00 Z
18
+ date: 2011-11-08 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: A generator for creating Rails 3.1 applications ready to go. It generates the layout, the style, the internationalization and manage external gems for authentication, authorization and other. It also provides a customized scaffold to generates cool sites ajax ready in few minutes. If you find a bug please report to m.mastrodonato@gmail.com