rails_apps_composer 1.5.5 → 2.0.1

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.
Files changed (69) hide show
  1. data/README.textile +185 -254
  2. data/lib/rails_wizard/command.rb +54 -13
  3. data/lib/rails_wizard/config.rb +1 -1
  4. data/lib/rails_wizard/diagnostics.rb +22 -0
  5. data/lib/rails_wizard/template.rb +36 -2
  6. data/lib/rails_wizard.rb +1 -0
  7. data/recipes/auth.rb +84 -0
  8. data/recipes/controllers.rb +58 -0
  9. data/recipes/{seed_database.rb → database.rb} +35 -22
  10. data/recipes/{action_mailer.rb → email.rb} +29 -50
  11. data/recipes/example.rb +70 -0
  12. data/recipes/extras.rb +91 -30
  13. data/recipes/frontend.rb +59 -0
  14. data/recipes/gems.rb +128 -0
  15. data/recipes/models.rb +61 -0
  16. data/recipes/prelaunch.rb +45 -0
  17. data/recipes/readme.rb +83 -0
  18. data/recipes/routes.rb +36 -0
  19. data/recipes/setup.rb +148 -0
  20. data/recipes/testing.rb +187 -0
  21. data/recipes/views.rb +39 -0
  22. data/spec/rails_wizard/template_spec.rb +4 -2
  23. data/templates/helpers.erb +53 -2
  24. data/templates/layout.erb +81 -20
  25. data/version.rb +1 -1
  26. metadata +19 -49
  27. data/recipes/active_admin.rb +0 -36
  28. data/recipes/activerecord.rb +0 -37
  29. data/recipes/add_user.rb +0 -140
  30. data/recipes/airbrake.rb +0 -34
  31. data/recipes/backbone.rb +0 -23
  32. data/recipes/capybara.rb +0 -34
  33. data/recipes/cleanup.rb +0 -40
  34. data/recipes/cloudfiles.rb +0 -36
  35. data/recipes/compass.rb +0 -46
  36. data/recipes/compass_960.rb +0 -48
  37. data/recipes/cucumber.rb +0 -75
  38. data/recipes/datamapper.rb +0 -111
  39. data/recipes/devise.rb +0 -114
  40. data/recipes/git.rb +0 -40
  41. data/recipes/guard.rb +0 -89
  42. data/recipes/haml.rb +0 -23
  43. data/recipes/heroku.rb +0 -61
  44. data/recipes/home_page.rb +0 -58
  45. data/recipes/home_page_users.rb +0 -47
  46. data/recipes/html5.rb +0 -152
  47. data/recipes/inherited_resources.rb +0 -23
  48. data/recipes/less.rb +0 -12
  49. data/recipes/mongohq.rb +0 -59
  50. data/recipes/mongoid.rb +0 -38
  51. data/recipes/mongolab.rb +0 -59
  52. data/recipes/omniauth.rb +0 -194
  53. data/recipes/omniauth_email.rb +0 -82
  54. data/recipes/paperclip.rb +0 -79
  55. data/recipes/prelaunch_signup.rb +0 -586
  56. data/recipes/rails_admin.rb +0 -29
  57. data/recipes/redis.rb +0 -23
  58. data/recipes/responders.rb +0 -10
  59. data/recipes/resque.rb +0 -25
  60. data/recipes/rspec.rb +0 -131
  61. data/recipes/sass.rb +0 -25
  62. data/recipes/settingslogic.rb +0 -43
  63. data/recipes/simple_form.rb +0 -54
  64. data/recipes/slim.rb +0 -46
  65. data/recipes/static_page.rb +0 -43
  66. data/recipes/subdomains.rb +0 -121
  67. data/recipes/turnip.rb +0 -18
  68. data/recipes/unicorn.rb +0 -29
  69. data/recipes/users_page.rb +0 -165
@@ -1,165 +0,0 @@
1
- # Application template recipe for the rails_apps_composer. Check for a newer version here:
2
- # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/users_page.rb
3
-
4
- after_bundler do
5
-
6
- say_wizard "UsersPage recipe running 'after bundler'"
7
-
8
- #----------------------------------------------------------------------------
9
- # Create a users controller
10
- #----------------------------------------------------------------------------
11
- generate(:controller, "users show index")
12
- remove_file 'app/controllers/users_controller.rb'
13
- create_file 'app/controllers/users_controller.rb' do <<-RUBY
14
- class UsersController < ApplicationController
15
- before_filter :authenticate_user!
16
-
17
- def index
18
- @users = User.all
19
- end
20
-
21
- def show
22
- @user = User.find(params[:id])
23
- end
24
-
25
- end
26
- RUBY
27
- end
28
- if recipes.include? 'authorization'
29
- inject_into_file 'app/controllers/users_controller.rb', " authorize! :index, @user, :message => 'Not authorized as an administrator.'\n", :after => "def index\n"
30
- end
31
- if recipes.include? 'paginate'
32
- gsub_file 'app/controllers/users_controller.rb', /@users = User.all/, '@users = User.paginate(:page => params[:page])'
33
- end
34
-
35
- #----------------------------------------------------------------------------
36
- # Limit access to the users#index page
37
- #----------------------------------------------------------------------------
38
- if recipes.include? 'authorization'
39
- inject_into_file 'app/models/ability.rb', :after => "def initialize(user)\n" do <<-RUBY
40
- user ||= User.new # guest user (not logged in)
41
- if user.has_role? :admin
42
- can :manage, :all
43
- end
44
- RUBY
45
- end
46
- end
47
-
48
- #----------------------------------------------------------------------------
49
- # Modify the routes
50
- #----------------------------------------------------------------------------
51
- # @devise_for :users@ route must be placed above @resources :users, :only => :show@.
52
- gsub_file 'config/routes.rb', /get \"users\/show\"/, ''
53
- gsub_file 'config/routes.rb', /get \"users\/index\"/, ''
54
- gsub_file 'config/routes.rb', /devise_for :users/ do
55
- <<-RUBY
56
- devise_for :users
57
- resources :users, :only => [:show, :index]
58
- RUBY
59
- end
60
-
61
- #----------------------------------------------------------------------------
62
- # Create a users index page
63
- #----------------------------------------------------------------------------
64
- if recipes.include? 'haml'
65
- remove_file 'app/views/users/index.html.haml'
66
- # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
67
- # We have to use single-quote-style-heredoc to avoid interpolation.
68
- create_file 'app/views/users/index.html.haml' do <<-'HAML'
69
- %h2 Users
70
- - @users.each do |user|
71
- %br/
72
- #{link_to user.email, user} signed up #{user.created_at.to_date}
73
- HAML
74
- end
75
- if recipes.include? 'paginate'
76
- append_file 'app/views/users/index.html.haml', "\n= will_paginate\n"
77
- end
78
- else
79
- append_file 'app/views/users/index.html.erb' do <<-ERB
80
- <ul class="users">
81
- <% @users.each do |user| %>
82
- <li>
83
- <%= link_to user.name, user %> signed up <%= user.created_at.to_date %>
84
- </li>
85
- <% end %>
86
- </ul>
87
- ERB
88
- end
89
- if recipes.include? 'paginate'
90
- append_file 'app/views/users/index.html.erb', "\n<%= will_paginate %>\n"
91
- end
92
- end
93
-
94
- #----------------------------------------------------------------------------
95
- # Create a users show page
96
- #----------------------------------------------------------------------------
97
- if recipes.include? 'haml'
98
- remove_file 'app/views/users/show.html.haml'
99
- # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
100
- # We have to use single-quote-style-heredoc to avoid interpolation.
101
- create_file 'app/views/users/show.html.haml' do <<-'HAML'
102
- %p
103
- User: #{@user.name}
104
- %p
105
- Email: #{@user.email if @user.email}
106
- HAML
107
- end
108
- else
109
- append_file 'app/views/users/show.html.erb' do <<-ERB
110
- <p>User: <%= @user.name %></p>
111
- <p>Email: <%= @user.email if @user.email %></p>
112
- ERB
113
- end
114
- end
115
-
116
- #----------------------------------------------------------------------------
117
- # Create a home page containing links to user show pages
118
- # (clobbers code from the home_page_users recipe)
119
- #----------------------------------------------------------------------------
120
- # set up the controller
121
- remove_file 'app/controllers/home_controller.rb'
122
- create_file 'app/controllers/home_controller.rb' do
123
- <<-RUBY
124
- class HomeController < ApplicationController
125
- def index
126
- @users = User.all
127
- end
128
- end
129
- RUBY
130
- end
131
-
132
- # modify the home page
133
- if recipes.include? 'haml'
134
- remove_file 'app/views/home/index.html.haml'
135
- # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
136
- # We have to use single-quote-style-heredoc to avoid interpolation.
137
- create_file 'app/views/home/index.html.haml' do
138
- <<-'HAML'
139
- %h3 Home
140
- - @users.each do |user|
141
- %p User: #{link_to user.name, user}
142
- HAML
143
- end
144
- else
145
- remove_file 'app/views/home/index.html.erb'
146
- create_file 'app/views/home/index.html.erb' do <<-ERB
147
- <h3>Home</h3>
148
- <% @users.each do |user| %>
149
- <p>User: <%=link_to user.name, user %></p>
150
- <% end %>
151
- ERB
152
- end
153
- end
154
-
155
- end
156
-
157
- __END__
158
-
159
- name: UsersPage
160
- description: "Add a users controller and user show page with links from the home page."
161
- author: RailsApps
162
-
163
- run_after: [add_user]
164
- category: other
165
- tags: [utilities, configuration]