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.
- data/README.textile +185 -254
- data/lib/rails_wizard/command.rb +54 -13
- data/lib/rails_wizard/config.rb +1 -1
- data/lib/rails_wizard/diagnostics.rb +22 -0
- data/lib/rails_wizard/template.rb +36 -2
- data/lib/rails_wizard.rb +1 -0
- data/recipes/auth.rb +84 -0
- data/recipes/controllers.rb +58 -0
- data/recipes/{seed_database.rb → database.rb} +35 -22
- data/recipes/{action_mailer.rb → email.rb} +29 -50
- data/recipes/example.rb +70 -0
- data/recipes/extras.rb +91 -30
- data/recipes/frontend.rb +59 -0
- data/recipes/gems.rb +128 -0
- data/recipes/models.rb +61 -0
- data/recipes/prelaunch.rb +45 -0
- data/recipes/readme.rb +83 -0
- data/recipes/routes.rb +36 -0
- data/recipes/setup.rb +148 -0
- data/recipes/testing.rb +187 -0
- data/recipes/views.rb +39 -0
- data/spec/rails_wizard/template_spec.rb +4 -2
- data/templates/helpers.erb +53 -2
- data/templates/layout.erb +81 -20
- data/version.rb +1 -1
- metadata +19 -49
- data/recipes/active_admin.rb +0 -36
- data/recipes/activerecord.rb +0 -37
- data/recipes/add_user.rb +0 -140
- data/recipes/airbrake.rb +0 -34
- data/recipes/backbone.rb +0 -23
- data/recipes/capybara.rb +0 -34
- data/recipes/cleanup.rb +0 -40
- data/recipes/cloudfiles.rb +0 -36
- data/recipes/compass.rb +0 -46
- data/recipes/compass_960.rb +0 -48
- data/recipes/cucumber.rb +0 -75
- data/recipes/datamapper.rb +0 -111
- data/recipes/devise.rb +0 -114
- data/recipes/git.rb +0 -40
- data/recipes/guard.rb +0 -89
- data/recipes/haml.rb +0 -23
- data/recipes/heroku.rb +0 -61
- data/recipes/home_page.rb +0 -58
- data/recipes/home_page_users.rb +0 -47
- data/recipes/html5.rb +0 -152
- data/recipes/inherited_resources.rb +0 -23
- data/recipes/less.rb +0 -12
- data/recipes/mongohq.rb +0 -59
- data/recipes/mongoid.rb +0 -38
- data/recipes/mongolab.rb +0 -59
- data/recipes/omniauth.rb +0 -194
- data/recipes/omniauth_email.rb +0 -82
- data/recipes/paperclip.rb +0 -79
- data/recipes/prelaunch_signup.rb +0 -586
- data/recipes/rails_admin.rb +0 -29
- data/recipes/redis.rb +0 -23
- data/recipes/responders.rb +0 -10
- data/recipes/resque.rb +0 -25
- data/recipes/rspec.rb +0 -131
- data/recipes/sass.rb +0 -25
- data/recipes/settingslogic.rb +0 -43
- data/recipes/simple_form.rb +0 -54
- data/recipes/slim.rb +0 -46
- data/recipes/static_page.rb +0 -43
- data/recipes/subdomains.rb +0 -121
- data/recipes/turnip.rb +0 -18
- data/recipes/unicorn.rb +0 -29
- data/recipes/users_page.rb +0 -165
data/recipes/users_page.rb
DELETED
@@ -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]
|