flexi_generators 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/README.textile +83 -70
  2. data/Rakefile +0 -22
  3. data/VERSION +1 -1
  4. data/flexi_generators.gemspec +75 -136
  5. data/init.rb +0 -1
  6. data/lib/flexi_generators.rb +2 -4
  7. data/lib/generators/flexi_auth/USAGE +5 -0
  8. data/lib/generators/flexi_auth/flexi_auth_generator.rb +117 -0
  9. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/authentication.rb +2 -9
  10. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/authlogic_session.rb +0 -0
  11. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/fixtures.yml +0 -0
  12. data/lib/generators/flexi_auth/templates/migration.rb +16 -0
  13. data/lib/generators/flexi_auth/templates/sessions_controller.rb +25 -0
  14. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/sessions_helper.rb +0 -0
  15. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/tests/testunit/sessions_controller.rb +1 -17
  16. data/lib/generators/flexi_auth/templates/tests/testunit/user.rb +4 -0
  17. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/tests/testunit/users_controller.rb +1 -1
  18. data/lib/generators/flexi_auth/templates/user.rb +3 -0
  19. data/lib/generators/flexi_auth/templates/users_controller.rb +42 -0
  20. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/users_helper.rb +0 -0
  21. data/lib/generators/flexi_auth/templates/views/erb/_error_messages.html.erb +11 -0
  22. data/lib/generators/flexi_auth/templates/views/erb/edit.html.erb +24 -0
  23. data/lib/generators/flexi_auth/templates/views/erb/index.html.erb +27 -0
  24. data/lib/generators/flexi_auth/templates/views/erb/login.html.erb +22 -0
  25. data/lib/generators/flexi_auth/templates/views/erb/new.html.erb +24 -0
  26. data/lib/generators/flexi_auth/templates/views/erb/show.html.erb +16 -0
  27. data/lib/generators/flexi_prepare/USAGE +6 -0
  28. data/lib/generators/flexi_prepare/flexi_prepare_generator.rb +56 -0
  29. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/add.png +0 -0
  30. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/admin_home_controller.rb +0 -0
  31. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/admin_home_index.html.erb +1 -1
  32. data/lib/generators/flexi_prepare/templates/application.css +278 -0
  33. data/lib/generators/flexi_prepare/templates/application.html.erb +57 -0
  34. data/lib/generators/flexi_prepare/templates/application_helper.rb +42 -0
  35. data/lib/generators/flexi_prepare/templates/back.png +0 -0
  36. data/lib/generators/flexi_prepare/templates/bg.png +0 -0
  37. data/lib/generators/flexi_prepare/templates/bg2.png +0 -0
  38. data/lib/generators/flexi_prepare/templates/boxheader.gif +0 -0
  39. data/lib/generators/flexi_prepare/templates/btn-bg-hover.png +0 -0
  40. data/lib/generators/flexi_prepare/templates/btn-bg.png +0 -0
  41. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/custom_field_error.rb +1 -1
  42. data/lib/generators/flexi_prepare/templates/delete.png +0 -0
  43. data/lib/generators/flexi_prepare/templates/edit.png +0 -0
  44. data/lib/generators/flexi_prepare/templates/inflector_portuguese.rb +59 -0
  45. data/lib/generators/flexi_prepare/templates/login.css +142 -0
  46. data/lib/generators/flexi_prepare/templates/login.html.erb +26 -0
  47. data/lib/generators/flexi_prepare/templates/logo.png +0 -0
  48. data/lib/generators/flexi_prepare/templates/menu.png +0 -0
  49. data/lib/generators/flexi_prepare/templates/messages/Thumbs.db +0 -0
  50. data/lib/generators/flexi_prepare/templates/messages/error.png +0 -0
  51. data/lib/generators/flexi_prepare/templates/messages/info.png +0 -0
  52. data/lib/generators/flexi_prepare/templates/messages/success.png +0 -0
  53. data/lib/generators/flexi_prepare/templates/messages/tip.png +0 -0
  54. data/lib/generators/flexi_prepare/templates/messages/warning.png +0 -0
  55. data/lib/generators/flexi_prepare/templates/pt-BR.yml +204 -0
  56. data/lib/generators/flexi_prepare/templates/show.png +0 -0
  57. data/{generators/flexi_layout/templates/stylesheet_site.css → lib/generators/flexi_prepare/templates/site.css} +32 -23
  58. data/lib/generators/flexi_prepare/templates/site.html.erb +20 -0
  59. data/{generators/flexi_layout/templates/home_controller.rb → lib/generators/flexi_prepare/templates/site_controller.rb} +1 -1
  60. data/lib/generators/flexi_prepare/templates/site_helper.rb +2 -0
  61. data/lib/generators/flexi_prepare/templates/site_index.html.erb +27 -0
  62. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/users.png +0 -0
  63. data/lib/generators/flexi_scaffold/USAGE +8 -0
  64. data/lib/generators/flexi_scaffold/flexi_scaffold_generator.rb +98 -0
  65. data/lib/generators/flexi_scaffold/templates/controller.rb +42 -0
  66. data/{generators → lib/generators}/flexi_scaffold/templates/fixtures.yml +3 -3
  67. data/{generators → lib/generators}/flexi_scaffold/templates/helper.rb +1 -1
  68. data/{generators → lib/generators}/flexi_scaffold/templates/migration.rb +3 -5
  69. data/lib/generators/flexi_scaffold/templates/model.rb +3 -0
  70. data/lib/generators/flexi_scaffold/templates/tests/controller.rb +50 -0
  71. data/lib/generators/flexi_scaffold/templates/tests/helper.rb +4 -0
  72. data/{test/flexi_generators_test.rb → lib/generators/flexi_scaffold/templates/tests/model.rb} +2 -2
  73. data/lib/generators/flexi_scaffold/templates/views/erb/_error_messages.html.erb +11 -0
  74. data/lib/generators/flexi_scaffold/templates/views/erb/_form.html.erb +13 -0
  75. data/lib/generators/flexi_scaffold/templates/views/erb/edit.html.erb +3 -0
  76. data/lib/generators/flexi_scaffold/templates/views/erb/index.html.erb +29 -0
  77. data/lib/generators/flexi_scaffold/templates/views/erb/new.html.erb +3 -0
  78. data/lib/generators/flexi_scaffold/templates/views/erb/show.html.erb +15 -0
  79. data/template.rb +6 -0
  80. metadata +79 -137
  81. data/flexi_template.rb +0 -28
  82. data/generators/flexi_authentication/USAGE +0 -50
  83. data/generators/flexi_authentication/flexi_authentication_generator.rb +0 -127
  84. data/generators/flexi_authentication/lib/insert_commands.rb +0 -74
  85. data/generators/flexi_authentication/templates/admin_users_controller.rb +0 -60
  86. data/generators/flexi_authentication/templates/migration.rb +0 -30
  87. data/generators/flexi_authentication/templates/sessions_controller.rb +0 -52
  88. data/generators/flexi_authentication/templates/tests/rspec/sessions_controller.rb +0 -39
  89. data/generators/flexi_authentication/templates/tests/rspec/user.rb +0 -83
  90. data/generators/flexi_authentication/templates/tests/rspec/users_controller.rb +0 -26
  91. data/generators/flexi_authentication/templates/tests/shoulda/sessions_controller.rb +0 -40
  92. data/generators/flexi_authentication/templates/tests/shoulda/user.rb +0 -85
  93. data/generators/flexi_authentication/templates/tests/shoulda/users_controller.rb +0 -27
  94. data/generators/flexi_authentication/templates/tests/testunit/user.rb +0 -88
  95. data/generators/flexi_authentication/templates/user.rb +0 -43
  96. data/generators/flexi_authentication/templates/views/erb/admin_user_edit.html.erb +0 -23
  97. data/generators/flexi_authentication/templates/views/erb/admin_user_index.html.erb +0 -33
  98. data/generators/flexi_authentication/templates/views/erb/admin_user_new.html.erb +0 -23
  99. data/generators/flexi_authentication/templates/views/erb/login.html.erb +0 -38
  100. data/generators/flexi_layout/USAGE +0 -18
  101. data/generators/flexi_layout/flexi_layout_generator.rb +0 -51
  102. data/generators/flexi_layout/lib/insert_commands.rb +0 -28
  103. data/generators/flexi_layout/templates/bg.png +0 -0
  104. data/generators/flexi_layout/templates/helper.rb +0 -19
  105. data/generators/flexi_layout/templates/home_helper.rb +0 -2
  106. data/generators/flexi_layout/templates/home_index.html.erb +0 -17
  107. data/generators/flexi_layout/templates/inflector_portuguese.rb +0 -62
  108. data/generators/flexi_layout/templates/layout.html.erb +0 -47
  109. data/generators/flexi_layout/templates/layout_login.html.erb +0 -27
  110. data/generators/flexi_layout/templates/layout_site.html.erb +0 -22
  111. data/generators/flexi_layout/templates/logo.png +0 -0
  112. data/generators/flexi_layout/templates/pt-BR.yml +0 -143
  113. data/generators/flexi_layout/templates/stylesheet.css +0 -132
  114. data/generators/flexi_layout/templates/stylesheet_login.css +0 -73
  115. data/generators/flexi_resource_scaffold/USAGE +0 -29
  116. data/generators/flexi_resource_scaffold/flexi_resource_scaffold_generator.rb +0 -179
  117. data/generators/flexi_resource_scaffold/templates/controller.rb +0 -29
  118. data/generators/flexi_resource_scaffold/templates/fixtures.yml +0 -10
  119. data/generators/flexi_resource_scaffold/templates/functional_test.rb +0 -57
  120. data/generators/flexi_resource_scaffold/templates/helper.rb +0 -2
  121. data/generators/flexi_resource_scaffold/templates/migration.rb +0 -15
  122. data/generators/flexi_resource_scaffold/templates/model.rb +0 -2
  123. data/generators/flexi_resource_scaffold/templates/old_migration.rb +0 -13
  124. data/generators/flexi_resource_scaffold/templates/rspec/functional_spec.rb +0 -255
  125. data/generators/flexi_resource_scaffold/templates/rspec/helper_spec.rb +0 -11
  126. data/generators/flexi_resource_scaffold/templates/rspec/routing_spec.rb +0 -61
  127. data/generators/flexi_resource_scaffold/templates/rspec/unit_spec.rb +0 -11
  128. data/generators/flexi_resource_scaffold/templates/rspec/views/edit_spec.rb +0 -28
  129. data/generators/flexi_resource_scaffold/templates/rspec/views/index_spec.rb +0 -26
  130. data/generators/flexi_resource_scaffold/templates/rspec/views/new_spec.rb +0 -30
  131. data/generators/flexi_resource_scaffold/templates/rspec/views/show_spec.rb +0 -25
  132. data/generators/flexi_resource_scaffold/templates/shoulda_functional_test.rb +0 -19
  133. data/generators/flexi_resource_scaffold/templates/unit_test.rb +0 -7
  134. data/generators/flexi_resource_scaffold/templates/view__form.erb +0 -6
  135. data/generators/flexi_resource_scaffold/templates/view__form.haml +0 -5
  136. data/generators/flexi_resource_scaffold/templates/view_edit.erb +0 -8
  137. data/generators/flexi_resource_scaffold/templates/view_edit.haml +0 -11
  138. data/generators/flexi_resource_scaffold/templates/view_index.erb +0 -27
  139. data/generators/flexi_resource_scaffold/templates/view_index.haml +0 -19
  140. data/generators/flexi_resource_scaffold/templates/view_new.erb +0 -9
  141. data/generators/flexi_resource_scaffold/templates/view_new.haml +0 -9
  142. data/generators/flexi_resource_scaffold/templates/view_show.erb +0 -10
  143. data/generators/flexi_resource_scaffold/templates/view_show.haml +0 -9
  144. data/generators/flexi_scaffold/USAGE +0 -51
  145. data/generators/flexi_scaffold/flexi_scaffold_generator.rb +0 -232
  146. data/generators/flexi_scaffold/templates/actions/create.rb +0 -9
  147. data/generators/flexi_scaffold/templates/actions/destroy.rb +0 -6
  148. data/generators/flexi_scaffold/templates/actions/edit.rb +0 -3
  149. data/generators/flexi_scaffold/templates/actions/index.rb +0 -4
  150. data/generators/flexi_scaffold/templates/actions/new.rb +0 -3
  151. data/generators/flexi_scaffold/templates/actions/show.rb +0 -3
  152. data/generators/flexi_scaffold/templates/actions/update.rb +0 -9
  153. data/generators/flexi_scaffold/templates/controller.rb +0 -5
  154. data/generators/flexi_scaffold/templates/model.rb +0 -3
  155. data/generators/flexi_scaffold/templates/tests/rspec/actions/create.rb +0 -11
  156. data/generators/flexi_scaffold/templates/tests/rspec/actions/destroy.rb +0 -6
  157. data/generators/flexi_scaffold/templates/tests/rspec/actions/edit.rb +0 -4
  158. data/generators/flexi_scaffold/templates/tests/rspec/actions/index.rb +0 -4
  159. data/generators/flexi_scaffold/templates/tests/rspec/actions/new.rb +0 -4
  160. data/generators/flexi_scaffold/templates/tests/rspec/actions/show.rb +0 -4
  161. data/generators/flexi_scaffold/templates/tests/rspec/actions/update.rb +0 -11
  162. data/generators/flexi_scaffold/templates/tests/rspec/controller.rb +0 -8
  163. data/generators/flexi_scaffold/templates/tests/rspec/model.rb +0 -7
  164. data/generators/flexi_scaffold/templates/tests/shoulda/actions/create.rb +0 -13
  165. data/generators/flexi_scaffold/templates/tests/shoulda/actions/destroy.rb +0 -8
  166. data/generators/flexi_scaffold/templates/tests/shoulda/actions/edit.rb +0 -6
  167. data/generators/flexi_scaffold/templates/tests/shoulda/actions/index.rb +0 -6
  168. data/generators/flexi_scaffold/templates/tests/shoulda/actions/new.rb +0 -6
  169. data/generators/flexi_scaffold/templates/tests/shoulda/actions/show.rb +0 -6
  170. data/generators/flexi_scaffold/templates/tests/shoulda/actions/update.rb +0 -13
  171. data/generators/flexi_scaffold/templates/tests/shoulda/controller.rb +0 -5
  172. data/generators/flexi_scaffold/templates/tests/shoulda/model.rb +0 -7
  173. data/generators/flexi_scaffold/templates/tests/testunit/actions/create.rb +0 -11
  174. data/generators/flexi_scaffold/templates/tests/testunit/actions/destroy.rb +0 -6
  175. data/generators/flexi_scaffold/templates/tests/testunit/actions/edit.rb +0 -4
  176. data/generators/flexi_scaffold/templates/tests/testunit/actions/index.rb +0 -4
  177. data/generators/flexi_scaffold/templates/tests/testunit/actions/new.rb +0 -4
  178. data/generators/flexi_scaffold/templates/tests/testunit/actions/show.rb +0 -4
  179. data/generators/flexi_scaffold/templates/tests/testunit/actions/update.rb +0 -11
  180. data/generators/flexi_scaffold/templates/tests/testunit/controller.rb +0 -5
  181. data/generators/flexi_scaffold/templates/tests/testunit/model.rb +0 -7
  182. data/generators/flexi_scaffold/templates/views/erb/_form.html.erb +0 -6
  183. data/generators/flexi_scaffold/templates/views/erb/edit.html.erb +0 -8
  184. data/generators/flexi_scaffold/templates/views/erb/index.html.erb +0 -41
  185. data/generators/flexi_scaffold/templates/views/erb/new.html.erb +0 -10
  186. data/generators/flexi_scaffold/templates/views/erb/show.html.erb +0 -19
  187. data/generators/flexi_scaffold/templates/views/haml/_form.html.haml +0 -10
  188. data/generators/flexi_scaffold/templates/views/haml/edit.html.haml +0 -14
  189. data/generators/flexi_scaffold/templates/views/haml/index.html.haml +0 -25
  190. data/generators/flexi_scaffold/templates/views/haml/new.html.haml +0 -7
  191. data/generators/flexi_scaffold/templates/views/haml/show.html.haml +0 -20
  192. data/test/test_helper.rb +0 -3
data/README.textile CHANGED
@@ -1,71 +1,84 @@
1
- h1. Flexi Generators
2
-
3
- My Rails generator scripts. Generates controllers, views, layouts and stylesheets with:
4
-
5
- * Login layout
6
- * App layout
7
- * Menus with Tab Helper plugin
8
- * Controllers and views generated with Resource Controller plugin
9
-
10
- h2. Included Generators
11
-
12
- * flexi_authentication: generates user model with sign up and log in.
13
- * flexi_layout: generates generic layout, stylesheet, and helper files.
14
- * flexi_scaffold: generates a controller and optional model/migration.
15
- * flexi_resource_scaffold: generates a controller and optional model/migration (resource_controller plugin).
16
-
17
- h2. Quickstart
18
-
19
- These 4 simple steps are the essentials to get you smoothly up and running…
20
-
21
- 1. Create your app and configure all dependencies
22
- @rails appname -m http://github.com/leandroo/flexi_generators/raw/master/flexi_template.rb@
23
- 2. Run @rake gems:install@ and @rake db:migrate@ to create your database and installs all required gems
24
- 3. Start your server with @ruby script/server@
25
- 4. Open up "http://localhost:3000":http://localhost:3000
26
-
27
- h2. Dependencies
28
-
29
- * Tabs Helper plugin: http://github.com/danielvlopes/tabs_helper
30
- * Resource Controller plugin: http://github.com/giraffesoft/resource_controller
31
- * Will Paginate plugin/gem: http://github.com/mislav/will_paginate
32
- * Rails Footnotes plugin: http://github.com/josevalim/rails-footnotes
33
- * JRails plugin: http://github.com/aaronchi/jrails
34
-
35
- h2. Usage
36
-
37
- <pre>
38
- ruby script/generate flexi_layout
39
- ...
40
- ruby script/generate flexi_authentication
41
- ...
42
- ruby script/generate flexi_scaffold Post title:string body:text
43
- or
44
- ruby script/generate flexi_resource_scaffold Post title:string body:text
45
- </pre>
46
-
47
- h2. Screenshots
48
-
49
- !http://img687.imageshack.us/img687/3579/homemk.png(Home layout)!
50
-
51
- !http://img441.imageshack.us/img441/5562/autenticacao.png(Login layout)!
52
-
53
- !http://img337.imageshack.us/img337/5549/adminkf.png(Admin layout)!
54
-
55
- !http://img155.imageshack.us/img155/6107/newb.png(Scaffold New)!
56
-
57
- !http://img219.imageshack.us/img219/2945/listc.png(Scaffold List)!
58
-
59
- h2. TODO
60
-
61
- * Support i18n
62
- * Tests, tests, tests
63
-
64
- h2. Autor
65
-
66
- *Leandro de Oliveira*
67
-
68
- Blog: "http://leandroo.com.br":http://leandroo.com.br
69
- Github: "http://github.com/leandroo":http://github.com/leandroo
70
-
1
+ h1. Flexi Generators
2
+
3
+ My Rails generator scripts. Generates controllers, views, layouts and stylesheets with:
4
+
5
+ * Login layout
6
+ * App layout
7
+ * Menus with Menu Builder plugin
8
+ * Pagination with Will Paginate plugin
9
+
10
+ h2. Instalation
11
+
12
+ Rail2
13
+
14
+ <pre>
15
+ gem.config "flexi_generators", :version => '0.1.0'
16
+ </pre>
17
+
18
+ h2. Quickstart Rails 2
19
+
20
+ These 4 simple steps are the essentials to get you smoothly up and running…
21
+
22
+ 1. Create your app and configure all dependencies
23
+ @rails appname -m http://github.com/leandroo/flexi_generators/raw/v0.1.0/flexi_template.rb@
24
+ 2. Run @rake gems:install@ and @rake db:migrate@ to create your database and installs all required gems
25
+ 3. Start your server with @ruby script/server@
26
+ 4. Open up "http://localhost:3000":http://localhost:3000
27
+
28
+ Rails3
29
+
30
+ <pre>
31
+ gem "flexi_generators", '>=0.2.0'
32
+ </pre>
33
+
34
+ h2. Included Generators
35
+
36
+ * flexi_prepare: generates initial files anda configurations.
37
+ * flexi_auth: generates user model with sign up and log in.
38
+ * flexi_scaffold: generates custom scaffold.
39
+
40
+ h2. Quickstart Rails 3
41
+
42
+ These 4 simple steps are the essentials to get you smoothly up and running…
43
+
44
+ 1. Create your app and configure all dependencies
45
+ @rails new appname -m http://github.com/leandroo/flexi_generators/raw/v0.2.0/flexi_template.rb@
46
+ 2. Run @bundle install@, @rake db:migrate@ and @rake db:seed@ to installs all required gems and create your database
47
+ 3. Start your server with @rails server@
48
+ 4. Open up "http://localhost:3000":http://localhost:3000
49
+
50
+ h2. Usage
51
+
52
+ <pre>
53
+ rails g flexi_prepare
54
+ ...
55
+ rails g flexi_auth
56
+ ...
57
+ rails g flexi_scaffold Post title:string body:text
58
+ </pre>
59
+
60
+ h2. Screenshots
61
+
62
+ !http://img687.imageshack.us/img687/3579/homemk.png(Home layout)!
63
+
64
+ !http://img441.imageshack.us/img441/5562/autenticacao.png(Login layout)!
65
+
66
+ !http://img337.imageshack.us/img337/5549/adminkf.png(Admin layout)!
67
+
68
+ !http://img155.imageshack.us/img155/6107/newb.png(Scaffold New)!
69
+
70
+ !http://img219.imageshack.us/img219/2945/listc.png(Scaffold List)!
71
+
72
+ h2. TODO
73
+
74
+ * Support i18n
75
+ * Tests, tests, tests
76
+
77
+ h2. Autor
78
+
79
+ *Leandro de Oliveira*
80
+
81
+ Blog: "http://leandroo.com.br":http://leandroo.com.br
82
+ Github: "http://github.com/leandroo":http://github.com/leandroo
83
+
71
84
  Copyright (c) 2009 Leandro de Oliveira, released under the MIT license
data/Rakefile CHANGED
@@ -1,26 +1,4 @@
1
1
  require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the flexi_generators plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/*_test.rb'
13
- t.verbose = true
14
- end
15
-
16
- desc 'Generate documentation for the flexi_generators plugin.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
18
- rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = 'Flexi-generators'
20
- rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
23
- end
24
2
 
25
3
  begin
26
4
  require 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flexi_generators}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Leandro de Oliveira"]
12
- s.date = %q{2010-09-09}
12
+ s.date = %q{2010-10-16}
13
13
  s.description = %q{Generates authentication and custom scaffold templates.}
14
14
  s.email = %q{ol.leandro@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -20,148 +20,87 @@ Gem::Specification.new do |s|
20
20
  "Rakefile",
21
21
  "VERSION",
22
22
  "flexi_generators.gemspec",
23
- "flexi_template.rb",
24
- "generators/flexi_authentication/USAGE",
25
- "generators/flexi_authentication/flexi_authentication_generator.rb",
26
- "generators/flexi_authentication/lib/insert_commands.rb",
27
- "generators/flexi_authentication/templates/admin_users_controller.rb",
28
- "generators/flexi_authentication/templates/authentication.rb",
29
- "generators/flexi_authentication/templates/authlogic_session.rb",
30
- "generators/flexi_authentication/templates/fixtures.yml",
31
- "generators/flexi_authentication/templates/migration.rb",
32
- "generators/flexi_authentication/templates/sessions_controller.rb",
33
- "generators/flexi_authentication/templates/sessions_helper.rb",
34
- "generators/flexi_authentication/templates/tests/rspec/sessions_controller.rb",
35
- "generators/flexi_authentication/templates/tests/rspec/user.rb",
36
- "generators/flexi_authentication/templates/tests/rspec/users_controller.rb",
37
- "generators/flexi_authentication/templates/tests/shoulda/sessions_controller.rb",
38
- "generators/flexi_authentication/templates/tests/shoulda/user.rb",
39
- "generators/flexi_authentication/templates/tests/shoulda/users_controller.rb",
40
- "generators/flexi_authentication/templates/tests/testunit/sessions_controller.rb",
41
- "generators/flexi_authentication/templates/tests/testunit/user.rb",
42
- "generators/flexi_authentication/templates/tests/testunit/users_controller.rb",
43
- "generators/flexi_authentication/templates/user.rb",
44
- "generators/flexi_authentication/templates/users_helper.rb",
45
- "generators/flexi_authentication/templates/views/erb/admin_user_edit.html.erb",
46
- "generators/flexi_authentication/templates/views/erb/admin_user_index.html.erb",
47
- "generators/flexi_authentication/templates/views/erb/admin_user_new.html.erb",
48
- "generators/flexi_authentication/templates/views/erb/login.html.erb",
49
- "generators/flexi_layout/USAGE",
50
- "generators/flexi_layout/flexi_layout_generator.rb",
51
- "generators/flexi_layout/lib/insert_commands.rb",
52
- "generators/flexi_layout/templates/add.png",
53
- "generators/flexi_layout/templates/admin_home_controller.rb",
54
- "generators/flexi_layout/templates/admin_home_index.html.erb",
55
- "generators/flexi_layout/templates/bg.png",
56
- "generators/flexi_layout/templates/custom_field_error.rb",
57
- "generators/flexi_layout/templates/helper.rb",
58
- "generators/flexi_layout/templates/home_controller.rb",
59
- "generators/flexi_layout/templates/home_helper.rb",
60
- "generators/flexi_layout/templates/home_index.html.erb",
61
- "generators/flexi_layout/templates/inflector_portuguese.rb",
62
- "generators/flexi_layout/templates/layout.html.erb",
63
- "generators/flexi_layout/templates/layout_login.html.erb",
64
- "generators/flexi_layout/templates/layout_site.html.erb",
65
- "generators/flexi_layout/templates/logo.png",
66
- "generators/flexi_layout/templates/pt-BR.yml",
67
- "generators/flexi_layout/templates/stylesheet.css",
68
- "generators/flexi_layout/templates/stylesheet_login.css",
69
- "generators/flexi_layout/templates/stylesheet_site.css",
70
- "generators/flexi_layout/templates/users.png",
71
- "generators/flexi_resource_scaffold/USAGE",
72
- "generators/flexi_resource_scaffold/flexi_resource_scaffold_generator.rb",
73
- "generators/flexi_resource_scaffold/templates/controller.rb",
74
- "generators/flexi_resource_scaffold/templates/fixtures.yml",
75
- "generators/flexi_resource_scaffold/templates/functional_test.rb",
76
- "generators/flexi_resource_scaffold/templates/helper.rb",
77
- "generators/flexi_resource_scaffold/templates/migration.rb",
78
- "generators/flexi_resource_scaffold/templates/model.rb",
79
- "generators/flexi_resource_scaffold/templates/old_migration.rb",
80
- "generators/flexi_resource_scaffold/templates/rspec/functional_spec.rb",
81
- "generators/flexi_resource_scaffold/templates/rspec/helper_spec.rb",
82
- "generators/flexi_resource_scaffold/templates/rspec/routing_spec.rb",
83
- "generators/flexi_resource_scaffold/templates/rspec/unit_spec.rb",
84
- "generators/flexi_resource_scaffold/templates/rspec/views/edit_spec.rb",
85
- "generators/flexi_resource_scaffold/templates/rspec/views/index_spec.rb",
86
- "generators/flexi_resource_scaffold/templates/rspec/views/new_spec.rb",
87
- "generators/flexi_resource_scaffold/templates/rspec/views/show_spec.rb",
88
- "generators/flexi_resource_scaffold/templates/shoulda_functional_test.rb",
89
- "generators/flexi_resource_scaffold/templates/unit_test.rb",
90
- "generators/flexi_resource_scaffold/templates/view__form.erb",
91
- "generators/flexi_resource_scaffold/templates/view__form.haml",
92
- "generators/flexi_resource_scaffold/templates/view_edit.erb",
93
- "generators/flexi_resource_scaffold/templates/view_edit.haml",
94
- "generators/flexi_resource_scaffold/templates/view_index.erb",
95
- "generators/flexi_resource_scaffold/templates/view_index.haml",
96
- "generators/flexi_resource_scaffold/templates/view_new.erb",
97
- "generators/flexi_resource_scaffold/templates/view_new.haml",
98
- "generators/flexi_resource_scaffold/templates/view_show.erb",
99
- "generators/flexi_resource_scaffold/templates/view_show.haml",
100
- "generators/flexi_scaffold/USAGE",
101
- "generators/flexi_scaffold/flexi_scaffold_generator.rb",
102
- "generators/flexi_scaffold/templates/actions/create.rb",
103
- "generators/flexi_scaffold/templates/actions/destroy.rb",
104
- "generators/flexi_scaffold/templates/actions/edit.rb",
105
- "generators/flexi_scaffold/templates/actions/index.rb",
106
- "generators/flexi_scaffold/templates/actions/new.rb",
107
- "generators/flexi_scaffold/templates/actions/show.rb",
108
- "generators/flexi_scaffold/templates/actions/update.rb",
109
- "generators/flexi_scaffold/templates/controller.rb",
110
- "generators/flexi_scaffold/templates/fixtures.yml",
111
- "generators/flexi_scaffold/templates/helper.rb",
112
- "generators/flexi_scaffold/templates/migration.rb",
113
- "generators/flexi_scaffold/templates/model.rb",
114
- "generators/flexi_scaffold/templates/tests/rspec/actions/create.rb",
115
- "generators/flexi_scaffold/templates/tests/rspec/actions/destroy.rb",
116
- "generators/flexi_scaffold/templates/tests/rspec/actions/edit.rb",
117
- "generators/flexi_scaffold/templates/tests/rspec/actions/index.rb",
118
- "generators/flexi_scaffold/templates/tests/rspec/actions/new.rb",
119
- "generators/flexi_scaffold/templates/tests/rspec/actions/show.rb",
120
- "generators/flexi_scaffold/templates/tests/rspec/actions/update.rb",
121
- "generators/flexi_scaffold/templates/tests/rspec/controller.rb",
122
- "generators/flexi_scaffold/templates/tests/rspec/model.rb",
123
- "generators/flexi_scaffold/templates/tests/shoulda/actions/create.rb",
124
- "generators/flexi_scaffold/templates/tests/shoulda/actions/destroy.rb",
125
- "generators/flexi_scaffold/templates/tests/shoulda/actions/edit.rb",
126
- "generators/flexi_scaffold/templates/tests/shoulda/actions/index.rb",
127
- "generators/flexi_scaffold/templates/tests/shoulda/actions/new.rb",
128
- "generators/flexi_scaffold/templates/tests/shoulda/actions/show.rb",
129
- "generators/flexi_scaffold/templates/tests/shoulda/actions/update.rb",
130
- "generators/flexi_scaffold/templates/tests/shoulda/controller.rb",
131
- "generators/flexi_scaffold/templates/tests/shoulda/model.rb",
132
- "generators/flexi_scaffold/templates/tests/testunit/actions/create.rb",
133
- "generators/flexi_scaffold/templates/tests/testunit/actions/destroy.rb",
134
- "generators/flexi_scaffold/templates/tests/testunit/actions/edit.rb",
135
- "generators/flexi_scaffold/templates/tests/testunit/actions/index.rb",
136
- "generators/flexi_scaffold/templates/tests/testunit/actions/new.rb",
137
- "generators/flexi_scaffold/templates/tests/testunit/actions/show.rb",
138
- "generators/flexi_scaffold/templates/tests/testunit/actions/update.rb",
139
- "generators/flexi_scaffold/templates/tests/testunit/controller.rb",
140
- "generators/flexi_scaffold/templates/tests/testunit/model.rb",
141
- "generators/flexi_scaffold/templates/views/erb/_form.html.erb",
142
- "generators/flexi_scaffold/templates/views/erb/edit.html.erb",
143
- "generators/flexi_scaffold/templates/views/erb/index.html.erb",
144
- "generators/flexi_scaffold/templates/views/erb/new.html.erb",
145
- "generators/flexi_scaffold/templates/views/erb/show.html.erb",
146
- "generators/flexi_scaffold/templates/views/haml/_form.html.haml",
147
- "generators/flexi_scaffold/templates/views/haml/edit.html.haml",
148
- "generators/flexi_scaffold/templates/views/haml/index.html.haml",
149
- "generators/flexi_scaffold/templates/views/haml/new.html.haml",
150
- "generators/flexi_scaffold/templates/views/haml/show.html.haml",
151
23
  "init.rb",
152
24
  "lib/flexi_generators.rb",
153
- "test/flexi_generators_test.rb",
154
- "test/test_helper.rb"
25
+ "lib/generators/flexi_auth/USAGE",
26
+ "lib/generators/flexi_auth/flexi_auth_generator.rb",
27
+ "lib/generators/flexi_auth/templates/authentication.rb",
28
+ "lib/generators/flexi_auth/templates/authlogic_session.rb",
29
+ "lib/generators/flexi_auth/templates/fixtures.yml",
30
+ "lib/generators/flexi_auth/templates/migration.rb",
31
+ "lib/generators/flexi_auth/templates/sessions_controller.rb",
32
+ "lib/generators/flexi_auth/templates/sessions_helper.rb",
33
+ "lib/generators/flexi_auth/templates/tests/testunit/sessions_controller.rb",
34
+ "lib/generators/flexi_auth/templates/tests/testunit/user.rb",
35
+ "lib/generators/flexi_auth/templates/tests/testunit/users_controller.rb",
36
+ "lib/generators/flexi_auth/templates/user.rb",
37
+ "lib/generators/flexi_auth/templates/users_controller.rb",
38
+ "lib/generators/flexi_auth/templates/users_helper.rb",
39
+ "lib/generators/flexi_auth/templates/views/erb/_error_messages.html.erb",
40
+ "lib/generators/flexi_auth/templates/views/erb/edit.html.erb",
41
+ "lib/generators/flexi_auth/templates/views/erb/index.html.erb",
42
+ "lib/generators/flexi_auth/templates/views/erb/login.html.erb",
43
+ "lib/generators/flexi_auth/templates/views/erb/new.html.erb",
44
+ "lib/generators/flexi_auth/templates/views/erb/show.html.erb",
45
+ "lib/generators/flexi_prepare/USAGE",
46
+ "lib/generators/flexi_prepare/flexi_prepare_generator.rb",
47
+ "lib/generators/flexi_prepare/templates/add.png",
48
+ "lib/generators/flexi_prepare/templates/admin_home_controller.rb",
49
+ "lib/generators/flexi_prepare/templates/admin_home_index.html.erb",
50
+ "lib/generators/flexi_prepare/templates/application.css",
51
+ "lib/generators/flexi_prepare/templates/application.html.erb",
52
+ "lib/generators/flexi_prepare/templates/application_helper.rb",
53
+ "lib/generators/flexi_prepare/templates/back.png",
54
+ "lib/generators/flexi_prepare/templates/bg.png",
55
+ "lib/generators/flexi_prepare/templates/bg2.png",
56
+ "lib/generators/flexi_prepare/templates/boxheader.gif",
57
+ "lib/generators/flexi_prepare/templates/btn-bg-hover.png",
58
+ "lib/generators/flexi_prepare/templates/btn-bg.png",
59
+ "lib/generators/flexi_prepare/templates/custom_field_error.rb",
60
+ "lib/generators/flexi_prepare/templates/delete.png",
61
+ "lib/generators/flexi_prepare/templates/edit.png",
62
+ "lib/generators/flexi_prepare/templates/inflector_portuguese.rb",
63
+ "lib/generators/flexi_prepare/templates/login.css",
64
+ "lib/generators/flexi_prepare/templates/login.html.erb",
65
+ "lib/generators/flexi_prepare/templates/logo.png",
66
+ "lib/generators/flexi_prepare/templates/menu.png",
67
+ "lib/generators/flexi_prepare/templates/messages/Thumbs.db",
68
+ "lib/generators/flexi_prepare/templates/messages/error.png",
69
+ "lib/generators/flexi_prepare/templates/messages/info.png",
70
+ "lib/generators/flexi_prepare/templates/messages/success.png",
71
+ "lib/generators/flexi_prepare/templates/messages/tip.png",
72
+ "lib/generators/flexi_prepare/templates/messages/warning.png",
73
+ "lib/generators/flexi_prepare/templates/pt-BR.yml",
74
+ "lib/generators/flexi_prepare/templates/show.png",
75
+ "lib/generators/flexi_prepare/templates/site.css",
76
+ "lib/generators/flexi_prepare/templates/site.html.erb",
77
+ "lib/generators/flexi_prepare/templates/site_controller.rb",
78
+ "lib/generators/flexi_prepare/templates/site_helper.rb",
79
+ "lib/generators/flexi_prepare/templates/site_index.html.erb",
80
+ "lib/generators/flexi_prepare/templates/users.png",
81
+ "lib/generators/flexi_scaffold/USAGE",
82
+ "lib/generators/flexi_scaffold/flexi_scaffold_generator.rb",
83
+ "lib/generators/flexi_scaffold/templates/controller.rb",
84
+ "lib/generators/flexi_scaffold/templates/fixtures.yml",
85
+ "lib/generators/flexi_scaffold/templates/helper.rb",
86
+ "lib/generators/flexi_scaffold/templates/migration.rb",
87
+ "lib/generators/flexi_scaffold/templates/model.rb",
88
+ "lib/generators/flexi_scaffold/templates/tests/controller.rb",
89
+ "lib/generators/flexi_scaffold/templates/tests/helper.rb",
90
+ "lib/generators/flexi_scaffold/templates/tests/model.rb",
91
+ "lib/generators/flexi_scaffold/templates/views/erb/_error_messages.html.erb",
92
+ "lib/generators/flexi_scaffold/templates/views/erb/_form.html.erb",
93
+ "lib/generators/flexi_scaffold/templates/views/erb/edit.html.erb",
94
+ "lib/generators/flexi_scaffold/templates/views/erb/index.html.erb",
95
+ "lib/generators/flexi_scaffold/templates/views/erb/new.html.erb",
96
+ "lib/generators/flexi_scaffold/templates/views/erb/show.html.erb",
97
+ "template.rb"
155
98
  ]
156
99
  s.homepage = %q{http://github.com/leandroo/flexi_generators}
157
100
  s.rdoc_options = ["--charset=UTF-8"]
158
101
  s.require_paths = ["lib"]
159
102
  s.rubygems_version = %q{1.3.7}
160
103
  s.summary = %q{My useful Rails generator scripts.}
161
- s.test_files = [
162
- "test/flexi_generators_test.rb",
163
- "test/test_helper.rb"
164
- ]
165
104
 
166
105
  if s.respond_to? :specification_version then
167
106
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
data/init.rb CHANGED
@@ -1,2 +1 @@
1
- # Include hook code here
2
1
  require 'flexi_generators'
@@ -1,4 +1,2 @@
1
- # Flexi-generators
2
- module FlexiGenerators
3
- # nothing to see here, the real action is under generators
4
- end
1
+ module FlexiGenerators
2
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+ The flexi_auth generator creates a custom authentication and users CRUD.
3
+
4
+ Example:
5
+ rails generate flexi_auth
@@ -0,0 +1,117 @@
1
+ require 'rails/generators/migration'
2
+
3
+ class FlexiAuthGenerator < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ argument :user_name, :type => :string, :default => 'user', :banner => 'user_name'
9
+ argument :session_name, :type => :string, :default => "user_session", :banner => 'sessions_controller_name'
10
+
11
+ def generate_flexi_auth
12
+ gem 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git'
13
+ end
14
+
15
+ def create_model_files
16
+ template 'user.rb', "app/models/#{user_singular_name}.rb"
17
+ template 'authlogic_session.rb', "app/models/#{user_singular_name}_session.rb"
18
+ end
19
+
20
+ def create_controller_files
21
+ template 'users_controller.rb', "app/controllers/admin/#{user_plural_name}_controller.rb"
22
+ template 'sessions_controller.rb', "app/controllers/#{session_plural_name}_controller.rb"
23
+ end
24
+
25
+ def create_helper_files
26
+ template 'users_helper.rb', "app/helpers/#{user_plural_name}_helper.rb"
27
+ template 'sessions_helper.rb', "app/helpers/#{session_plural_name}_helper.rb"
28
+ end
29
+
30
+ def create_view_files
31
+ template "views/erb/login.html.erb", "app/views/#{session_plural_name}/new.html.erb"
32
+ template "views/erb/index.html.erb", "app/views/admin/#{user_plural_name}/index.html.erb"
33
+ template "views/erb/show.html.erb", "app/views/admin/#{user_plural_name}/show.html.erb"
34
+ template "views/erb/new.html.erb", "app/views/admin/#{user_plural_name}/new.html.erb"
35
+ template "views/erb/_error_messages.html.erb", "app/views/shared/_error_messages.html.erb"
36
+ template "views/erb/edit.html.erb", "app/views/admin/#{user_plural_name}/edit.html.erb"
37
+ end
38
+
39
+ def create_lib_files
40
+ template 'authentication.rb', 'config/initializers/authentication.rb'
41
+ end
42
+
43
+ def create_routes
44
+ route "match 'admin' => 'user_sessions#new'"
45
+ route "resources #{session_plural_name.to_sym.inspect}"
46
+ route "match 'login' => '#{session_plural_name}#new', :as => :login"
47
+ route "match 'logout' => '#{session_plural_name}#destroy', :as => :logout"
48
+ inject_into_file "config/routes.rb", "\n\tresources #{user_plural_name.to_sym.inspect}", :after => 'match "home" => "home#index"'
49
+ end
50
+
51
+ def create_include_line
52
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " before_filter :login_required\n"
53
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " include Authentication\n"
54
+ end
55
+
56
+ def create_test_files
57
+ template 'fixtures.yml', "test/fixtures/#{user_plural_name}.yml"
58
+ template "tests/testunit/user.rb", "test/unit/#{user_singular_name}_test.rb"
59
+ template "tests/testunit/users_controller.rb", "test/functional/#{user_plural_name}_controller_test.rb"
60
+ template "tests/testunit/sessions_controller.rb", "test/functional/#{session_plural_name}_controller_test.rb"
61
+ end
62
+
63
+ def create_migration
64
+ migration_template 'migration.rb', "db/migrate/create_#{user_plural_name}.rb"
65
+ end
66
+
67
+ def create_seed
68
+ append_file "db/seeds.rb","#{user_class_name}.create(:username => 'admin', :password => 'admin123', :password_confirmation => 'admin123', :email => 'admin@example.com')"
69
+ end
70
+
71
+ private
72
+
73
+ def session_name
74
+ user_name + '_session'
75
+ end
76
+
77
+ def user_singular_name
78
+ user_name.underscore
79
+ end
80
+
81
+ def user_plural_name
82
+ user_singular_name.pluralize
83
+ end
84
+
85
+ def user_class_name
86
+ user_name.camelize
87
+ end
88
+
89
+ def user_plural_class_name
90
+ user_plural_name.camelize
91
+ end
92
+
93
+ def session_singular_name
94
+ session_name.underscore
95
+ end
96
+
97
+ def session_plural_name
98
+ session_singular_name.pluralize
99
+ end
100
+
101
+ def session_class_name
102
+ session_name.camelize
103
+ end
104
+
105
+ def session_plural_class_name
106
+ session_plural_name.camelize
107
+ end
108
+
109
+ def self.next_migration_number(dirname) #:nodoc:
110
+ if ActiveRecord::Base.timestamped_migrations
111
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
112
+ else
113
+ "%.3d" % (current_migration_number(dirname) + 1)
114
+ end
115
+ end
116
+
117
+ end
@@ -3,7 +3,7 @@
3
3
  # common example you might add to your application layout file.
4
4
  #
5
5
  # <%% if logged_in? %>
6
- # Welcome <%%=h current_<%= user_singular_name %>.username %>! Not you?
6
+ # Welcome <%%= current_<%= user_singular_name %>.username %>! Not you?
7
7
  # <%%= link_to "Log out", logout_path %>
8
8
  # <%% else %>
9
9
  # <%%= link_to "Sign up", signup_path %> or
@@ -17,10 +17,8 @@
17
17
  module Authentication
18
18
  def self.included(controller)
19
19
  controller.send :helper_method, :current_<%= user_singular_name %>, :logged_in?, :redirect_to_target_or_default
20
- controller.filter_parameter_logging :password
21
20
  end
22
21
 
23
- <%- if options[:authlogic] -%>
24
22
  def current_<%= session_singular_name %>
25
23
  return @current_<%= session_singular_name %> if defined?(@current_<%= session_singular_name %>)
26
24
  @current_<%= session_singular_name %> = <%= session_class_name %>.find
@@ -30,11 +28,6 @@ module Authentication
30
28
  return @current_<%= user_singular_name %> if defined?(@current_<%= user_singular_name %>)
31
29
  @current_<%= user_singular_name %> = current_<%= session_singular_name %> && current_<%= session_singular_name %>.record
32
30
  end
33
- <%- else -%>
34
- def current_<%= user_singular_name %>
35
- @current_<%= user_singular_name %> ||= <%= user_class_name %>.find(session[:<%= user_singular_name %>_id]) if session[:<%= user_singular_name %>_id]
36
- end
37
- <%- end -%>
38
31
 
39
32
  def logged_in?
40
33
  current_<%= user_singular_name %>
@@ -42,7 +35,7 @@ module Authentication
42
35
 
43
36
  def login_required
44
37
  unless logged_in?
45
- flash[:error] = "É necessária a autenticação para ter acesso a esta página."
38
+ flash[:error] = "Você precisa estar logado para poder acessar esta página."
46
39
  store_target_location
47
40
  redirect_to login_url
48
41
  end
@@ -0,0 +1,16 @@
1
+ class Create<%= user_plural_class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= user_plural_name %> do |t|
4
+ t.string :username
5
+ t.string :email
6
+ t.string :persistence_token
7
+ t.string :crypted_password
8
+ t.string :password_salt
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :<%= user_plural_name %>
15
+ end
16
+ end
@@ -0,0 +1,25 @@
1
+ class <%= session_plural_class_name %>Controller < ApplicationController
2
+ skip_before_filter :login_required
3
+
4
+ layout 'login'
5
+
6
+ def new
7
+ @<%= session_singular_name %> = <%= session_class_name %>.new
8
+ end
9
+
10
+ def create
11
+ @<%= session_singular_name %> = <%= session_class_name %>.new(params[:<%= session_singular_name %>])
12
+ if @<%= session_singular_name %>.save
13
+ flash[:notice] = "Bem-vindo!"
14
+ redirect_to admin_home_url
15
+ else
16
+ flash.now[:error] = "Usuário/E-mail ou senha inválidos."
17
+ render :action => 'new'
18
+ end
19
+ end
20
+
21
+ def destroy
22
+ current_<%= session_singular_name %>.destroy
23
+ redirect_to login_url
24
+ end
25
+ end