flexi_generators 0.2.8 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/README.textile +1 -1
  2. data/VERSION +1 -1
  3. data/flexi_generators.gemspec +77 -78
  4. data/lib/generators/flexi/auth/USAGE +5 -0
  5. data/lib/generators/flexi/auth/auth_generator.rb +122 -0
  6. data/lib/generators/{flexi_auth → flexi/auth}/templates/authentication.rb +0 -0
  7. data/lib/generators/{flexi_auth → flexi/auth}/templates/authlogic_session.rb +0 -0
  8. data/lib/generators/{flexi_auth → flexi/auth}/templates/fixtures.yml +0 -0
  9. data/lib/generators/{flexi_auth → flexi/auth}/templates/migration.rb +0 -0
  10. data/lib/generators/{flexi_auth → flexi/auth}/templates/sessions_controller.rb +0 -0
  11. data/lib/generators/{flexi_auth → flexi/auth}/templates/sessions_helper.rb +0 -0
  12. data/lib/generators/{flexi_auth → flexi/auth}/templates/tests/testunit/sessions_controller.rb +0 -0
  13. data/lib/generators/{flexi_auth → flexi/auth}/templates/tests/testunit/user.rb +0 -0
  14. data/lib/generators/{flexi_auth → flexi/auth}/templates/tests/testunit/users_controller.rb +0 -0
  15. data/lib/generators/{flexi_auth → flexi/auth}/templates/user.rb +0 -0
  16. data/lib/generators/{flexi_auth → flexi/auth}/templates/users_controller.rb +0 -0
  17. data/lib/generators/{flexi_auth → flexi/auth}/templates/users_helper.rb +0 -0
  18. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/_error_messages.html.erb +0 -0
  19. data/lib/generators/flexi/auth/templates/views/erb/_menu.html.erb +16 -0
  20. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/application.html.erb +1 -19
  21. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/edit.html.erb +1 -1
  22. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/index.html.erb +0 -0
  23. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/login.html.erb +0 -0
  24. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/new.html.erb +1 -1
  25. data/lib/generators/{flexi_auth → flexi/auth}/templates/views/erb/show.html.erb +0 -0
  26. data/lib/generators/flexi/prepare/USAGE +6 -0
  27. data/lib/generators/flexi/prepare/prepare_generator.rb +68 -0
  28. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/add.png +0 -0
  29. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/admin_home_controller.rb +0 -0
  30. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/admin_home_index.html.erb +0 -0
  31. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/application.css +3 -1
  32. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/application_helper.rb +0 -0
  33. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/back.png +0 -0
  34. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/bg.png +0 -0
  35. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/bg2.png +0 -0
  36. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/boxheader.gif +0 -0
  37. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/btn-bg-hover.png +0 -0
  38. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/btn-bg.png +0 -0
  39. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/custom_field_error.rb +0 -0
  40. data/lib/generators/flexi/prepare/templates/delete.png +0 -0
  41. data/lib/generators/flexi/prepare/templates/edit.png +0 -0
  42. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/inflector_portuguese.rb +0 -0
  43. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/login.css +0 -0
  44. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/login.html.erb +0 -0
  45. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/logo.png +0 -0
  46. data/lib/generators/flexi/prepare/templates/menu.png +0 -0
  47. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/messages/Thumbs.db +0 -0
  48. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/messages/error.png +0 -0
  49. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/messages/info.png +0 -0
  50. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/messages/success.png +0 -0
  51. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/messages/tip.png +0 -0
  52. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/messages/warning.png +0 -0
  53. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/pt-BR.yml +1 -1
  54. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/routes.rb +0 -0
  55. data/lib/generators/flexi/prepare/templates/show.png +0 -0
  56. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/site.css +0 -0
  57. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/site.html.erb +0 -0
  58. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/site_controller.rb +0 -0
  59. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/site_helper.rb +0 -0
  60. data/lib/generators/{flexi_prepare → flexi/prepare}/templates/site_index.html.erb +0 -0
  61. data/lib/generators/flexi/prepare/templates/users.png +0 -0
  62. data/lib/generators/flexi/scaffold/USAGE +5 -0
  63. data/lib/generators/flexi/scaffold/scaffold_generator.rb +110 -0
  64. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/controller.rb +0 -0
  65. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/fixtures.yml +0 -0
  66. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/helper.rb +0 -0
  67. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/migration.rb +0 -0
  68. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/model.rb +0 -0
  69. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/tests/controller.rb +0 -0
  70. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/tests/helper.rb +0 -0
  71. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/tests/model.rb +0 -0
  72. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/views/erb/_error_messages.html.erb +0 -0
  73. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/views/erb/_form.html.erb +1 -1
  74. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/views/erb/edit.html.erb +0 -0
  75. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/views/erb/index.html.erb +0 -0
  76. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/views/erb/new.html.erb +0 -0
  77. data/lib/generators/{flexi_scaffold → flexi/scaffold}/templates/views/erb/show.html.erb +0 -0
  78. data/lib/generators/flexi.rb +16 -0
  79. data/template.rb +15 -5
  80. metadata +79 -80
  81. data/init.rb +0 -1
  82. data/lib/flexi_generators.rb +0 -2
  83. data/lib/generators/flexi_auth/USAGE +0 -5
  84. data/lib/generators/flexi_auth/flexi_auth_generator.rb +0 -118
  85. data/lib/generators/flexi_prepare/USAGE +0 -6
  86. data/lib/generators/flexi_prepare/flexi_prepare_generator.rb +0 -62
  87. data/lib/generators/flexi_prepare/templates/application.html.erb +0 -57
  88. data/lib/generators/flexi_prepare/templates/delete.png +0 -0
  89. data/lib/generators/flexi_prepare/templates/edit.png +0 -0
  90. data/lib/generators/flexi_prepare/templates/menu.png +0 -0
  91. data/lib/generators/flexi_prepare/templates/show.png +0 -0
  92. data/lib/generators/flexi_prepare/templates/users.png +0 -0
  93. data/lib/generators/flexi_scaffold/USAGE +0 -8
  94. data/lib/generators/flexi_scaffold/flexi_scaffold_generator.rb +0 -99
data/README.textile CHANGED
@@ -30,7 +30,7 @@ h2. Quickstart Rails 3
30
30
  These 4 simple steps are the essentials to get you smoothly up and running…
31
31
 
32
32
  1. Create your app and configure all dependencies
33
- @rails new appname -m http://github.com/leandroo/flexi_generators/raw/master/template.rb@
33
+ @rails new appname -m http://leandroo.com.br/flexi_generators/template.rb@
34
34
  2. Run @bundle install@, @rake db:migrate@ and @rake db:seed@ to installs all required gems and create your database
35
35
  3. Start your server with @rails server@
36
36
  4. Open up "http://localhost:3000":http://localhost:3000
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.10
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flexi_generators}
8
- s.version = "0.2.8"
8
+ s.version = "0.2.10"
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{2011-04-14}
12
+ s.date = %q{2011-04-21}
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,82 +20,81 @@ Gem::Specification.new do |s|
20
20
  "Rakefile",
21
21
  "VERSION",
22
22
  "flexi_generators.gemspec",
23
- "init.rb",
24
- "lib/flexi_generators.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/application.html.erb",
41
- "lib/generators/flexi_auth/templates/views/erb/edit.html.erb",
42
- "lib/generators/flexi_auth/templates/views/erb/index.html.erb",
43
- "lib/generators/flexi_auth/templates/views/erb/login.html.erb",
44
- "lib/generators/flexi_auth/templates/views/erb/new.html.erb",
45
- "lib/generators/flexi_auth/templates/views/erb/show.html.erb",
46
- "lib/generators/flexi_prepare/USAGE",
47
- "lib/generators/flexi_prepare/flexi_prepare_generator.rb",
48
- "lib/generators/flexi_prepare/templates/add.png",
49
- "lib/generators/flexi_prepare/templates/admin_home_controller.rb",
50
- "lib/generators/flexi_prepare/templates/admin_home_index.html.erb",
51
- "lib/generators/flexi_prepare/templates/application.css",
52
- "lib/generators/flexi_prepare/templates/application.html.erb",
53
- "lib/generators/flexi_prepare/templates/application_helper.rb",
54
- "lib/generators/flexi_prepare/templates/back.png",
55
- "lib/generators/flexi_prepare/templates/bg.png",
56
- "lib/generators/flexi_prepare/templates/bg2.png",
57
- "lib/generators/flexi_prepare/templates/boxheader.gif",
58
- "lib/generators/flexi_prepare/templates/btn-bg-hover.png",
59
- "lib/generators/flexi_prepare/templates/btn-bg.png",
60
- "lib/generators/flexi_prepare/templates/custom_field_error.rb",
61
- "lib/generators/flexi_prepare/templates/delete.png",
62
- "lib/generators/flexi_prepare/templates/edit.png",
63
- "lib/generators/flexi_prepare/templates/inflector_portuguese.rb",
64
- "lib/generators/flexi_prepare/templates/login.css",
65
- "lib/generators/flexi_prepare/templates/login.html.erb",
66
- "lib/generators/flexi_prepare/templates/logo.png",
67
- "lib/generators/flexi_prepare/templates/menu.png",
68
- "lib/generators/flexi_prepare/templates/messages/Thumbs.db",
69
- "lib/generators/flexi_prepare/templates/messages/error.png",
70
- "lib/generators/flexi_prepare/templates/messages/info.png",
71
- "lib/generators/flexi_prepare/templates/messages/success.png",
72
- "lib/generators/flexi_prepare/templates/messages/tip.png",
73
- "lib/generators/flexi_prepare/templates/messages/warning.png",
74
- "lib/generators/flexi_prepare/templates/pt-BR.yml",
75
- "lib/generators/flexi_prepare/templates/routes.rb",
76
- "lib/generators/flexi_prepare/templates/show.png",
77
- "lib/generators/flexi_prepare/templates/site.css",
78
- "lib/generators/flexi_prepare/templates/site.html.erb",
79
- "lib/generators/flexi_prepare/templates/site_controller.rb",
80
- "lib/generators/flexi_prepare/templates/site_helper.rb",
81
- "lib/generators/flexi_prepare/templates/site_index.html.erb",
82
- "lib/generators/flexi_prepare/templates/users.png",
83
- "lib/generators/flexi_scaffold/USAGE",
84
- "lib/generators/flexi_scaffold/flexi_scaffold_generator.rb",
85
- "lib/generators/flexi_scaffold/templates/controller.rb",
86
- "lib/generators/flexi_scaffold/templates/fixtures.yml",
87
- "lib/generators/flexi_scaffold/templates/helper.rb",
88
- "lib/generators/flexi_scaffold/templates/migration.rb",
89
- "lib/generators/flexi_scaffold/templates/model.rb",
90
- "lib/generators/flexi_scaffold/templates/tests/controller.rb",
91
- "lib/generators/flexi_scaffold/templates/tests/helper.rb",
92
- "lib/generators/flexi_scaffold/templates/tests/model.rb",
93
- "lib/generators/flexi_scaffold/templates/views/erb/_error_messages.html.erb",
94
- "lib/generators/flexi_scaffold/templates/views/erb/_form.html.erb",
95
- "lib/generators/flexi_scaffold/templates/views/erb/edit.html.erb",
96
- "lib/generators/flexi_scaffold/templates/views/erb/index.html.erb",
97
- "lib/generators/flexi_scaffold/templates/views/erb/new.html.erb",
98
- "lib/generators/flexi_scaffold/templates/views/erb/show.html.erb",
23
+ "lib/generators/flexi.rb",
24
+ "lib/generators/flexi/auth/USAGE",
25
+ "lib/generators/flexi/auth/auth_generator.rb",
26
+ "lib/generators/flexi/auth/templates/authentication.rb",
27
+ "lib/generators/flexi/auth/templates/authlogic_session.rb",
28
+ "lib/generators/flexi/auth/templates/fixtures.yml",
29
+ "lib/generators/flexi/auth/templates/migration.rb",
30
+ "lib/generators/flexi/auth/templates/sessions_controller.rb",
31
+ "lib/generators/flexi/auth/templates/sessions_helper.rb",
32
+ "lib/generators/flexi/auth/templates/tests/testunit/sessions_controller.rb",
33
+ "lib/generators/flexi/auth/templates/tests/testunit/user.rb",
34
+ "lib/generators/flexi/auth/templates/tests/testunit/users_controller.rb",
35
+ "lib/generators/flexi/auth/templates/user.rb",
36
+ "lib/generators/flexi/auth/templates/users_controller.rb",
37
+ "lib/generators/flexi/auth/templates/users_helper.rb",
38
+ "lib/generators/flexi/auth/templates/views/erb/_error_messages.html.erb",
39
+ "lib/generators/flexi/auth/templates/views/erb/_menu.html.erb",
40
+ "lib/generators/flexi/auth/templates/views/erb/application.html.erb",
41
+ "lib/generators/flexi/auth/templates/views/erb/edit.html.erb",
42
+ "lib/generators/flexi/auth/templates/views/erb/index.html.erb",
43
+ "lib/generators/flexi/auth/templates/views/erb/login.html.erb",
44
+ "lib/generators/flexi/auth/templates/views/erb/new.html.erb",
45
+ "lib/generators/flexi/auth/templates/views/erb/show.html.erb",
46
+ "lib/generators/flexi/prepare/USAGE",
47
+ "lib/generators/flexi/prepare/prepare_generator.rb",
48
+ "lib/generators/flexi/prepare/templates/add.png",
49
+ "lib/generators/flexi/prepare/templates/admin_home_controller.rb",
50
+ "lib/generators/flexi/prepare/templates/admin_home_index.html.erb",
51
+ "lib/generators/flexi/prepare/templates/application.css",
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/routes.rb",
75
+ "lib/generators/flexi/prepare/templates/show.png",
76
+ "lib/generators/flexi/prepare/templates/site.css",
77
+ "lib/generators/flexi/prepare/templates/site.html.erb",
78
+ "lib/generators/flexi/prepare/templates/site_controller.rb",
79
+ "lib/generators/flexi/prepare/templates/site_helper.rb",
80
+ "lib/generators/flexi/prepare/templates/site_index.html.erb",
81
+ "lib/generators/flexi/prepare/templates/users.png",
82
+ "lib/generators/flexi/scaffold/USAGE",
83
+ "lib/generators/flexi/scaffold/scaffold_generator.rb",
84
+ "lib/generators/flexi/scaffold/templates/controller.rb",
85
+ "lib/generators/flexi/scaffold/templates/fixtures.yml",
86
+ "lib/generators/flexi/scaffold/templates/helper.rb",
87
+ "lib/generators/flexi/scaffold/templates/migration.rb",
88
+ "lib/generators/flexi/scaffold/templates/model.rb",
89
+ "lib/generators/flexi/scaffold/templates/tests/controller.rb",
90
+ "lib/generators/flexi/scaffold/templates/tests/helper.rb",
91
+ "lib/generators/flexi/scaffold/templates/tests/model.rb",
92
+ "lib/generators/flexi/scaffold/templates/views/erb/_error_messages.html.erb",
93
+ "lib/generators/flexi/scaffold/templates/views/erb/_form.html.erb",
94
+ "lib/generators/flexi/scaffold/templates/views/erb/edit.html.erb",
95
+ "lib/generators/flexi/scaffold/templates/views/erb/index.html.erb",
96
+ "lib/generators/flexi/scaffold/templates/views/erb/new.html.erb",
97
+ "lib/generators/flexi/scaffold/templates/views/erb/show.html.erb",
99
98
  "template.rb"
100
99
  ]
101
100
  s.homepage = %q{http://github.com/leandroo/flexi_generators}
@@ -0,0 +1,5 @@
1
+ Description:
2
+ The flexi:auth generator creates a custom authentication with Authlogic gem and users CRUD.
3
+
4
+ Example:
5
+ rails generate flexi:auth
@@ -0,0 +1,122 @@
1
+ require 'generators/flexi'
2
+ require 'rails/generators/migration'
3
+
4
+ module Flexi
5
+ module Generators
6
+ class AuthGenerator < Base
7
+ include Rails::Generators::Migration
8
+
9
+ argument :user_name, :type => :string, :default => 'user', :banner => 'user_name'
10
+ argument :session_name, :type => :string, :default => "user_session", :banner => 'sessions_controller_name'
11
+
12
+ def generate_auth
13
+ gem 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git'
14
+ end
15
+
16
+ def create_model_files
17
+ template 'user.rb', "app/models/#{user_singular_name}.rb"
18
+ template 'authlogic_session.rb', "app/models/#{user_singular_name}_session.rb"
19
+ end
20
+
21
+ def create_controller_files
22
+ template 'users_controller.rb', "app/controllers/admin/#{user_plural_name}_controller.rb"
23
+ template 'sessions_controller.rb', "app/controllers/#{session_plural_name}_controller.rb"
24
+ end
25
+
26
+ def create_helper_files
27
+ template 'users_helper.rb', "app/helpers/#{user_plural_name}_helper.rb"
28
+ template 'sessions_helper.rb', "app/helpers/#{session_plural_name}_helper.rb"
29
+ end
30
+
31
+ def create_view_files
32
+ template "views/erb/login.html.erb", "app/views/#{session_plural_name}/new.html.erb"
33
+ template "views/erb/index.html.erb", "app/views/admin/#{user_plural_name}/index.html.erb"
34
+ template "views/erb/show.html.erb", "app/views/admin/#{user_plural_name}/show.html.erb"
35
+ template "views/erb/new.html.erb", "app/views/admin/#{user_plural_name}/new.html.erb"
36
+ template "views/erb/_error_messages.html.erb", "app/views/shared/_error_messages.html.erb"
37
+ template "views/erb/edit.html.erb", "app/views/admin/#{user_plural_name}/edit.html.erb"
38
+ template "views/erb/application.html.erb", "app/views/layouts/application.html.erb"
39
+ template "views/erb/_menu.html.erb", "app/views/layouts/_menu.html.erb"
40
+ end
41
+
42
+ def create_lib_files
43
+ template 'authentication.rb', 'config/initializers/authentication.rb'
44
+ end
45
+
46
+ def create_routes
47
+ route "match 'admin' => '#{session_plural_name}#new'"
48
+ route "match 'login' => '#{session_plural_name}#new', :as => :login"
49
+ route "match 'logout' => '#{session_plural_name}#destroy', :as => :logout"
50
+ route "resources #{session_plural_name.to_sym.inspect}"
51
+ inject_into_file "config/routes.rb", "\n\tresources #{user_plural_name.to_sym.inspect}", :after => 'match "home" => "home#index"'
52
+ end
53
+
54
+ def create_include_line
55
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " before_filter :login_required\n"
56
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " include Authentication\n"
57
+ end
58
+
59
+ def create_test_files
60
+ template 'fixtures.yml', "test/fixtures/#{user_plural_name}.yml"
61
+ template "tests/testunit/user.rb", "test/unit/#{user_singular_name}_test.rb"
62
+ template "tests/testunit/users_controller.rb", "test/functional/#{user_plural_name}_controller_test.rb"
63
+ template "tests/testunit/sessions_controller.rb", "test/functional/#{session_plural_name}_controller_test.rb"
64
+ end
65
+
66
+ def create_migration
67
+ migration_template 'migration.rb', "db/migrate/create_#{user_plural_name}.rb"
68
+ end
69
+
70
+ def create_seed
71
+ append_file "db/seeds.rb","#{user_class_name}.create(:username => 'admin', :password => 'admin123', :password_confirmation => 'admin123', :email => 'admin@example.com')"
72
+ end
73
+
74
+ private
75
+
76
+ def session_name
77
+ user_name + '_session'
78
+ end
79
+
80
+ def user_singular_name
81
+ user_name.underscore
82
+ end
83
+
84
+ def user_plural_name
85
+ user_singular_name.pluralize
86
+ end
87
+
88
+ def user_class_name
89
+ user_name.camelize
90
+ end
91
+
92
+ def user_plural_class_name
93
+ user_plural_name.camelize
94
+ end
95
+
96
+ def session_singular_name
97
+ session_name.underscore
98
+ end
99
+
100
+ def session_plural_name
101
+ session_singular_name.pluralize
102
+ end
103
+
104
+ def session_class_name
105
+ session_name.camelize
106
+ end
107
+
108
+ def session_plural_class_name
109
+ session_plural_name.camelize
110
+ end
111
+
112
+ def self.next_migration_number(dirname) #:nodoc:
113
+ if ActiveRecord::Base.timestamped_migrations
114
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
115
+ else
116
+ "%.3d" % (current_migration_number(dirname) + 1)
117
+ end
118
+ end
119
+
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,16 @@
1
+ <div class="menu">
2
+ <%%= menu do |m| %>
3
+ <%%= m.<%= user_plural_name %> admin_<%= user_plural_name %>_path do %>
4
+ <%%= image_tag 'users.png' %> <%= user_plural_class_name %>
5
+ <%% end %>
6
+ <%%= m.menu1 "#menu" do %>
7
+ <%%= image_tag 'menu.png' %> Menu 1
8
+ <%% end %>
9
+ <%%= m.menu2 "#menu" do %>
10
+ <%%= image_tag 'menu.png' %> Menu 2
11
+ <%% end %>
12
+ <%%= m.menu3 "#menu" do %>
13
+ <%%= image_tag 'menu.png' %> Menu 3
14
+ <%% end %>
15
+ <%% end %>
16
+ </div>
@@ -21,25 +21,7 @@
21
21
  </div>
22
22
  <div id="container">
23
23
  <div id="sidenav">
24
- <div class="menu">
25
- <%%= menu do |m| %>
26
- <%%= m.<%= user_plural_name %> admin_<%= user_plural_name %>_path do %>
27
- <%%= image_tag 'users.png' %> <%= user_plural_class_name %>
28
- <%% end %>
29
- <%%= m.menu1 "#menu" do %>
30
- <%%= image_tag 'menu.png' %> Menu 1
31
- <%% end %>
32
- <%%= m.menu2 "#menu" do %>
33
- <%%= image_tag 'menu.png' %> Menu 2
34
- <%% end %>
35
- <%%= m.menu3 "#menu" do %>
36
- <%%= image_tag 'menu.png' %> Menu 3
37
- <%% end %>
38
- <%%= m.menu4 "#menu" do %>
39
- <%%= image_tag 'menu.png' %> Menu 4
40
- <%% end %>
41
- <%% end %>
42
- </div>
24
+ <%%= render "layouts/menu" %>
43
25
  </div>
44
26
  <div id="main">
45
27
  <div class="box-header">
@@ -19,6 +19,6 @@
19
19
  <%%= f.password_field :password_confirmation %>
20
20
  </div>
21
21
  <div id="control_box">
22
- <%%= f.submit "Salvar", :class => "button medium save blue" %> | <%%= link_to("Cancelar", admin_<%= user_plural_name %>_path, :class => "button medium red") %>
22
+ <%%= f.submit "Salvar", :class => "button medium blue" %> | <%%= link_to("Cancelar", admin_<%= user_plural_name %>_path, :class => "button medium red") %>
23
23
  </div>
24
24
  <%% end %>
@@ -19,6 +19,6 @@
19
19
  <%%= f.password_field :password_confirmation %>
20
20
  </div>
21
21
  <div id="control_box">
22
- <%%= f.submit "Salvar", :class => "button medium save blue" %> | <%%= link_to("Cancelar", admin_<%= user_plural_name %>_path, :class => "button medium red") %>
22
+ <%%= f.submit "Salvar", :class => "button medium blue" %> | <%%= link_to("Cancelar", admin_<%= user_plural_name %>_path, :class => "button medium red") %>
23
23
  </div>
24
24
  <%% end %>
@@ -0,0 +1,6 @@
1
+ Description:
2
+ The flexi:prepare generator creates a basic layout and config files and
3
+ helper which will give some structure to a starting Rails app.
4
+
5
+ Example:
6
+ rails generate flexi:prepare
@@ -0,0 +1,68 @@
1
+ require 'generators/flexi'
2
+
3
+ module Flexi
4
+ module Generators
5
+ class PrepareGenerator < Base
6
+
7
+ def generate_prepare
8
+ remove_file "app/views/layouts/application.html.erb"
9
+ remove_file "app/helpers/application_helper.rb"
10
+ remove_file "public/index.html"
11
+ remove_file "config/routes.rb"
12
+
13
+ copy_file "pt-BR.yml", "config/locales/pt-BR.yml"
14
+ copy_file "inflector_portuguese.rb", "config/initializers/inflector_portuguese.rb"
15
+ copy_file "custom_field_error.rb", "config/initializers/custom_field_error.rb"
16
+ copy_file "application.css", "public/stylesheets/application.css"
17
+ copy_file "login.css", "public/stylesheets/login.css"
18
+ copy_file "site.css", "public/stylesheets/site.css"
19
+ copy_file "logo.png", "public/images/logo.png"
20
+ copy_file "add.png", "public/images/add.png"
21
+ copy_file "bg.png", "public/images/bg.png"
22
+ copy_file "bg2.png", "public/images/bg2.png"
23
+ copy_file "users.png", "public/images/users.png"
24
+ copy_file "boxheader.gif", "public/images/boxheader.gif"
25
+ copy_file "menu.png", "public/images/menu.png"
26
+ copy_file "btn-bg.png", "public/images/btn-bg.png"
27
+ copy_file "btn-bg-hover.png", "public/images/btn-bg-hover.png"
28
+ copy_file "edit.png", "public/images/edit.png"
29
+ copy_file "show.png", "public/images/show.png"
30
+ copy_file "delete.png", "public/images/delete.png"
31
+ copy_file "back.png", "public/images/back.png"
32
+ copy_file "messages/error.png", "public/images/messages/error.png"
33
+ copy_file "messages/info.png", "public/images/messages/info.png"
34
+ copy_file "messages/success.png", "public/images/messages/success.png"
35
+ copy_file "messages/tip.png", "public/images/messages/tip.png"
36
+ copy_file "messages/warning.png", "public/images/messages/warning.png"
37
+ copy_file "admin_home_controller.rb", "app/controllers/admin/home_controller.rb"
38
+ copy_file "site_controller.rb", "app/controllers/site_controller.rb"
39
+ copy_file "site_helper.rb", "app/helpers/site_helper.rb"
40
+ copy_file "application_helper.rb", "app/helpers/application_helper.rb"
41
+
42
+ template "routes.rb", "config/routes.rb"
43
+ template "login.html.erb", "app/views/layouts/login.html.erb"
44
+ template "site.html.erb", "app/views/layouts/site.html.erb"
45
+ template "site_index.html.erb", "app/views/site/index.html.erb"
46
+ template "admin_home_index.html.erb", "app/views/admin/home/index.html.erb"
47
+
48
+ gem 'menu_builder', '=0.3.3'
49
+ gem 'will_paginate', '~> 3.0.pre2'
50
+
51
+ route 'root :to => "site#index"'
52
+ route 'namespace :admin do
53
+ match "home" => "home#index"
54
+ end'
55
+
56
+ inject_into_file "config/application.rb", "\tconfig.i18n.default_locale = 'pt-BR'\n", :after => "class Application < Rails::Application\n"
57
+ inject_into_file "config/application.rb", "\tconfig.time_zone = 'Brasilia'\n", :after => "class Application < Rails::Application\n"
58
+ end
59
+
60
+ private
61
+
62
+ def app_name
63
+ File.basename(Rails.root).camelize
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -274,4 +274,6 @@ div#header{ width: 900px; margin: 0 auto; }
274
274
  color:#9E0B0F;
275
275
  }
276
276
  /* Field Errors */
277
- input.field_with_errors { background-color:#FFEBEB; border-color: #E17984; }
277
+ input.field_with_errors { background-color:#FFEBEB; border-color: #E17984; }
278
+ textarea.field_with_errors { background-color:#FFEBEB; border-color: #E17984; }
279
+ select.field_with_errors { background-color:#FFEBEB; border-color: #E17984; }
@@ -189,7 +189,7 @@ pt-BR:
189
189
  messages:
190
190
  taken: "já está em uso"
191
191
  record_invalid: "A validação falhou: %{errors}"
192
-
192
+ attachment_size: "deve ter o tamanho entre %{min} e %{max} bytes"
193
193
  models:
194
194
  user: "Usuários"
195
195
 
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Generate a custom scaffold
3
+
4
+ Example:
5
+ rails generate flexi:scaffold Post title:string body:text