rails_apps_composer 2.1.10 → 2.2.0
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 +0 -3
- data/lib/rails_wizard/diagnostics.rb +5 -5
- data/recipes/controllers.rb +2 -2
- data/recipes/core.rb +1 -1
- data/recipes/extras.rb +7 -25
- data/recipes/gems.rb +14 -1
- data/recipes/models.rb +50 -11
- data/recipes/prelaunch.rb +82 -10
- data/recipes/railsapps.rb +23 -1
- data/recipes/routes.rb +2 -2
- data/recipes/setup.rb +4 -14
- data/recipes/views.rb +2 -2
- data/version.rb +1 -1
- metadata +4 -5
- data/recipes/auth.rb +0 -83
data/README.textile
CHANGED
@@ -99,7 +99,6 @@ You can list recipes with short descriptions:
|
|
99
99
|
<pre>
|
100
100
|
$ rails_apps_composer list
|
101
101
|
|
102
|
-
auth # Add authentication and authorization.
|
103
102
|
controllers # Add controllers needed for starter apps.
|
104
103
|
core # Select all core recipes.
|
105
104
|
email # Configure email accounts.
|
@@ -173,7 +172,6 @@ Would you like to skip Test::Unit? (yes for RSpec) (y/n)
|
|
173
172
|
Would you like to skip Active Record? (yes for MongoDB) (y/n)
|
174
173
|
|
175
174
|
Available Recipes:
|
176
|
-
auth: auth
|
177
175
|
collections: core
|
178
176
|
configuration: email, gems, git, railsapps, readme, setup
|
179
177
|
example: example
|
@@ -235,7 +233,6 @@ Specify a filename for the template:
|
|
235
233
|
$ rails_apps_composer template ~/Desktop/template.rb
|
236
234
|
|
237
235
|
Available Recipes:
|
238
|
-
auth: auth
|
239
236
|
collections: core
|
240
237
|
configuration: email, gems, git, railsapps, readme, setup
|
241
238
|
example: example
|
@@ -15,11 +15,11 @@ module RailsWizard
|
|
15
15
|
@@recipes << %w(gems git setup)
|
16
16
|
@@recipes << %w(gems git readme setup)
|
17
17
|
@@recipes << %w(extras gems git readme setup)
|
18
|
-
@@recipes << %w(
|
19
|
-
@@recipes << %w(all
|
20
|
-
@@recipes << %w(
|
21
|
-
@@recipes << %w(
|
22
|
-
@@recipes << %w(all
|
18
|
+
@@recipes << %w(controllers email extras frontend gems git init models railsapps readme routes setup testing views)
|
19
|
+
@@recipes << %w(all controllers email extras frontend gems git init models railsapps readme routes setup testing views)
|
20
|
+
@@recipes << %w(controllers email example extras frontend gems git init models railsapps readme routes setup testing views)
|
21
|
+
@@recipes << %w(controllers email example extras frontend gems git init models prelaunch railsapps readme routes setup testing views)
|
22
|
+
@@recipes << %w(all controllers email example extras frontend gems git init models prelaunch railsapps readme routes setup testing views)
|
23
23
|
|
24
24
|
### collections of preferences that are known to work together
|
25
25
|
@@prefs = []
|
data/recipes/controllers.rb
CHANGED
@@ -53,6 +53,6 @@ name: controllers
|
|
53
53
|
description: "Add controllers needed for starter apps."
|
54
54
|
author: RailsApps
|
55
55
|
|
56
|
-
requires: [setup, gems,
|
57
|
-
run_after: [setup, gems,
|
56
|
+
requires: [setup, gems, models]
|
57
|
+
run_after: [setup, gems, models]
|
58
58
|
category: mvc
|
data/recipes/core.rb
CHANGED
@@ -10,5 +10,5 @@ name: core
|
|
10
10
|
description: "Select all core recipes."
|
11
11
|
author: RailsApps
|
12
12
|
|
13
|
-
requires: [git, railsapps, setup, readme, gems, testing,
|
13
|
+
requires: [git, railsapps, setup, readme, gems, testing, email, models, controllers, views, routes, frontend, init, prelaunch, extras]
|
14
14
|
category: collections
|
data/recipes/extras.rb
CHANGED
@@ -1,25 +1,6 @@
|
|
1
1
|
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
2
|
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb
|
3
3
|
|
4
|
-
## FORM BUILDER
|
5
|
-
case config['form_builder']
|
6
|
-
when 'simple_form'
|
7
|
-
prefs[:form_builder] = 'simple_form'
|
8
|
-
end
|
9
|
-
case prefs[:form_builder]
|
10
|
-
when 'simple_form'
|
11
|
-
gem 'simple_form'
|
12
|
-
after_bundler do
|
13
|
-
if prefer :frontend, 'bootstrap'
|
14
|
-
say_wizard "recipe installing simple_form for use with Twitter Bootstrap"
|
15
|
-
generate 'simple_form:install --bootstrap'
|
16
|
-
else
|
17
|
-
say_wizard "recipe installing simple_form"
|
18
|
-
generate 'simple_form:install'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
4
|
## BAN SPIDERS
|
24
5
|
if config['ban_spiders']
|
25
6
|
prefs[:ban_spiders] = true
|
@@ -107,7 +88,12 @@ if config['github']
|
|
107
88
|
say_wizard "#{git_uri}"
|
108
89
|
else
|
109
90
|
run "hub create #{app_name}"
|
110
|
-
|
91
|
+
unless prefer :railsapps, 'rails-prelaunch-signup'
|
92
|
+
run "hub push -u origin master"
|
93
|
+
else
|
94
|
+
run "hub push -u origin #{prefs[:prelaunch_branch]}"
|
95
|
+
run "hub push -u origin #{prefs[:main_branch]}" unless prefer :main_branch, 'none'
|
96
|
+
end
|
111
97
|
end
|
112
98
|
end
|
113
99
|
end
|
@@ -119,14 +105,10 @@ description: "Various extras."
|
|
119
105
|
author: RailsApps
|
120
106
|
|
121
107
|
requires: [gems]
|
122
|
-
run_after: [init,
|
108
|
+
run_after: [gems, init, prelaunch]
|
123
109
|
category: other
|
124
110
|
|
125
111
|
config:
|
126
|
-
- form_builder:
|
127
|
-
type: multiple_choice
|
128
|
-
prompt: Use a form builder gem?
|
129
|
-
choices: [["None", "none"], ["SimpleForm", "simple_form"]]
|
130
112
|
- ban_spiders:
|
131
113
|
type: boolean
|
132
114
|
prompt: Set a robots.txt file to ban spiders?
|
data/recipes/gems.rb
CHANGED
@@ -98,8 +98,11 @@ if prefer :authorization, 'cancan'
|
|
98
98
|
gem 'rolify', '>= 3.2.0'
|
99
99
|
end
|
100
100
|
|
101
|
+
## Form Builder
|
102
|
+
gem 'simple_form', '>= 2.0.2' if prefer :form_builder, 'simple_form'
|
103
|
+
|
101
104
|
## Signup App
|
102
|
-
if prefer :
|
105
|
+
if prefer :railsapps, 'rails-prelaunch-signup'
|
103
106
|
gem 'google_visualr', '>= 2.1.2'
|
104
107
|
gem 'jquery-datatables-rails', '>= 1.10.0'
|
105
108
|
end
|
@@ -156,6 +159,16 @@ end # after_bundler
|
|
156
159
|
after_bundler do
|
157
160
|
## Front-end Framework
|
158
161
|
generate 'foundation:install' if prefer :frontend, 'foundation'
|
162
|
+
## Form Builder
|
163
|
+
if prefer :form_builder, 'simple_form'
|
164
|
+
if prefer :frontend, 'bootstrap'
|
165
|
+
say_wizard "recipe installing simple_form for use with Twitter Bootstrap"
|
166
|
+
generate 'simple_form:install --bootstrap'
|
167
|
+
else
|
168
|
+
say_wizard "recipe installing simple_form"
|
169
|
+
generate 'simple_form:install'
|
170
|
+
end
|
171
|
+
end
|
159
172
|
## Git
|
160
173
|
git :add => '.' if prefer :git, true
|
161
174
|
git :commit => "-aqm 'rails_apps_composer: generators'" if prefer :git, true
|
data/recipes/models.rb
CHANGED
@@ -5,25 +5,60 @@ after_bundler do
|
|
5
5
|
say_wizard "recipe running after 'bundle install'"
|
6
6
|
### DEVISE ###
|
7
7
|
if prefer :authentication, 'devise'
|
8
|
+
# prevent logging of password_confirmation
|
9
|
+
gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'
|
10
|
+
generate 'devise:install'
|
11
|
+
generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'
|
12
|
+
generate 'devise user' # create the User model
|
8
13
|
if prefer :orm, 'mongoid'
|
9
|
-
|
14
|
+
## DEVISE AND MONGOID
|
15
|
+
copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'
|
16
|
+
if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
|
17
|
+
gsub_file 'app/models/user.rb', /:registerable,/, ":registerable, :confirmable,"
|
18
|
+
gsub_file 'app/models/user.rb', /# field :confirmation_token/, "field :confirmation_token"
|
19
|
+
gsub_file 'app/models/user.rb', /# field :confirmed_at/, "field :confirmed_at"
|
20
|
+
gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, "field :confirmation_sent_at"
|
21
|
+
gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, "field :unconfirmed_email"
|
22
|
+
end
|
23
|
+
if (prefer :devise_modules, 'invitable')
|
24
|
+
gsub_file 'app/models/user.rb', /\bend\s*\Z/ do
|
25
|
+
<<-RUBY
|
26
|
+
#invitable
|
27
|
+
field :invitation_token, :type => String
|
28
|
+
field :invitation_sent_at, :type => Time
|
29
|
+
field :invitation_accepted_at, :type => Time
|
30
|
+
field :invitation_limit, :type => Integer
|
31
|
+
field :invited_by_id, :type => String
|
32
|
+
field :invited_by_type, :type => String
|
33
|
+
end
|
34
|
+
RUBY
|
35
|
+
end
|
36
|
+
end
|
10
37
|
else
|
38
|
+
## DEVISE AND ACTIVE RECORD
|
11
39
|
generate 'migration AddNameToUsers name:string'
|
12
40
|
copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
|
13
41
|
if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
|
14
|
-
generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'
|
15
42
|
gsub_file 'app/models/user.rb', /:registerable,/, ":registerable, :confirmable,"
|
43
|
+
generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'
|
16
44
|
end
|
17
45
|
end
|
46
|
+
## DEVISE AND CUCUMBER
|
47
|
+
if prefer :integration, 'cucumber'
|
48
|
+
# Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path
|
49
|
+
# (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)
|
50
|
+
gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'
|
51
|
+
end
|
18
52
|
end
|
19
53
|
### OMNIAUTH ###
|
20
54
|
if prefer :authentication, 'omniauth'
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
55
|
+
repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
|
56
|
+
copy_from_repo 'config/initializers/omniauth.rb', :repo => repo
|
57
|
+
generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'
|
58
|
+
run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid'
|
59
|
+
copy_from_repo 'app/models/user.rb', :repo => repo # copy the User model (Mongoid version)
|
60
|
+
unless prefer :orm, 'mongoid'
|
61
|
+
## OMNIAUTH AND ACTIVE RECORD
|
27
62
|
gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'
|
28
63
|
gsub_file 'app/models/user.rb', /^\s*include Mongoid::Document\n/, ''
|
29
64
|
gsub_file 'app/models/user.rb', /^\s*field.*\n/, ''
|
@@ -33,8 +68,12 @@ after_bundler do
|
|
33
68
|
end
|
34
69
|
### SUBDOMAINS ###
|
35
70
|
copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
|
36
|
-
### AUTHORIZATION
|
71
|
+
### AUTHORIZATION ###
|
37
72
|
if prefer :authorization, 'cancan'
|
73
|
+
generate 'cancan:ability'
|
74
|
+
if prefer :starter_app, 'admin_app' # Limit access to the users#index page
|
75
|
+
copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
|
76
|
+
end
|
38
77
|
unless prefer :orm, 'mongoid'
|
39
78
|
generate 'rolify:role Role User'
|
40
79
|
else
|
@@ -59,6 +98,6 @@ name: models
|
|
59
98
|
description: "Add models needed for starter apps."
|
60
99
|
author: RailsApps
|
61
100
|
|
62
|
-
requires: [setup, gems
|
63
|
-
run_after: [setup, gems
|
101
|
+
requires: [setup, gems]
|
102
|
+
run_after: [setup, gems]
|
64
103
|
category: mvc
|
data/recipes/prelaunch.rb
CHANGED
@@ -1,13 +1,29 @@
|
|
1
1
|
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
2
|
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb
|
3
3
|
|
4
|
-
if prefer :
|
5
|
-
raise StandardError.new "Sorry. The prelaunch recipe is not implemented."
|
4
|
+
if prefer :railsapps, 'rails-prelaunch-signup'
|
6
5
|
|
7
|
-
|
6
|
+
after_everything do
|
8
7
|
say_wizard "recipe running after 'bundle install'"
|
9
8
|
repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'
|
10
9
|
|
10
|
+
# >-------------------------------[ Clean up starter app ]--------------------------------<
|
11
|
+
|
12
|
+
%w{
|
13
|
+
public/index.html
|
14
|
+
app/assets/images/rails.png
|
15
|
+
}.each { |file| remove_file file }
|
16
|
+
# remove commented lines and multiple blank lines from Gemfile
|
17
|
+
# thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
|
18
|
+
gsub_file 'Gemfile', /#.*\n/, "\n"
|
19
|
+
gsub_file 'Gemfile', /\n^\s*\n/, "\n"
|
20
|
+
# remove commented lines and multiple blank lines from config/routes.rb
|
21
|
+
gsub_file 'config/routes.rb', / #.*\n/, "\n"
|
22
|
+
gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
|
23
|
+
# GIT
|
24
|
+
git :add => '.' if prefer :git, true
|
25
|
+
git :commit => "-aqm 'rails_apps_composer: clean up starter app'" if prefer :git, true
|
26
|
+
|
11
27
|
# >-------------------------------[ Create a git branch ]--------------------------------<
|
12
28
|
if prefer :git, true
|
13
29
|
if prefer :prelaunch_branch, 'master'
|
@@ -24,22 +40,78 @@ if prefer :prelaunch_app, 'signup_app'
|
|
24
40
|
end
|
25
41
|
end
|
26
42
|
|
27
|
-
# >-------------------------------[
|
28
|
-
|
29
|
-
|
43
|
+
# >-------------------------------[ Cucumber ]--------------------------------<
|
44
|
+
say_wizard "copying Cucumber scenarios from the rails-prelaunch-signup examples"
|
45
|
+
copy_from_repo 'features/admin/send_invitations.feature', :repo => repo
|
46
|
+
copy_from_repo 'features/admin/view_progress.feature', :repo => repo
|
47
|
+
copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo
|
48
|
+
copy_from_repo 'features/users/sign_up.feature', :repo => repo
|
49
|
+
copy_from_repo 'features/users/user_show.feature', :repo => repo
|
50
|
+
copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo
|
51
|
+
copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
|
52
|
+
copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo
|
53
|
+
copy_from_repo 'config/locales/devise.en.yml', :repo => repo
|
54
|
+
|
55
|
+
# >-------------------------------[ Migrations ]--------------------------------<
|
56
|
+
|
57
|
+
generate 'migration AddOptinToUsers opt_in:boolean'
|
58
|
+
run 'bundle exec rake db:drop'
|
59
|
+
run 'bundle exec rake db:migrate'
|
60
|
+
run 'bundle exec rake db:test:prepare'
|
61
|
+
run 'bundle exec rake db:seed'
|
62
|
+
|
63
|
+
# >-------------------------------[ Models ]--------------------------------<
|
64
|
+
|
65
|
+
copy_from_repo 'app/models/user.rb', :repo => repo
|
66
|
+
|
67
|
+
# >-------------------------------[ Controllers ]--------------------------------<
|
68
|
+
|
69
|
+
copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo
|
70
|
+
copy_from_repo 'app/controllers/home_controller.rb', :repo => repo
|
71
|
+
copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo
|
72
|
+
copy_from_repo 'app/controllers/users_controller.rb', :repo => repo
|
73
|
+
|
74
|
+
# >-------------------------------[ Mailers ]--------------------------------<
|
75
|
+
|
76
|
+
generate 'mailer UserMailer'
|
77
|
+
copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo
|
78
|
+
copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo
|
79
|
+
|
80
|
+
# >-------------------------------[ Views ]--------------------------------<
|
81
|
+
|
82
|
+
copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo
|
83
|
+
copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo
|
84
|
+
copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo
|
85
|
+
copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo
|
86
|
+
copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo
|
87
|
+
copy_from_repo 'app/views/home/index.html.erb', :repo => repo
|
88
|
+
copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo
|
89
|
+
copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo
|
90
|
+
copy_from_repo 'app/views/users/index.html.erb', :repo => repo
|
91
|
+
copy_from_repo 'public/thankyou.html', :repo => repo
|
30
92
|
|
93
|
+
# >-------------------------------[ Routes ]--------------------------------<
|
94
|
+
|
95
|
+
copy_from_repo 'config/routes.rb', :repo => repo
|
96
|
+
|
97
|
+
# >-------------------------------[ Assets ]--------------------------------<
|
98
|
+
|
99
|
+
copy_from_repo 'app/assets/javascripts/application.js', :repo => repo
|
100
|
+
copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo
|
101
|
+
copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo
|
102
|
+
|
31
103
|
### GIT ###
|
32
104
|
git :add => '.' if prefer :git, true
|
33
105
|
git :commit => "-aqm 'rails_apps_composer: prelaunch app'" if prefer :git, true
|
34
106
|
end # after_bundler
|
35
|
-
end #
|
107
|
+
end # rails-prelaunch-signup
|
36
108
|
|
37
109
|
__END__
|
38
110
|
|
39
111
|
name: prelaunch
|
40
|
-
description: "
|
112
|
+
description: "Install a prelaunch-signup example application."
|
41
113
|
author: RailsApps
|
42
114
|
|
43
|
-
requires: [
|
44
|
-
run_after: [setup, gems,
|
115
|
+
requires: [core]
|
116
|
+
run_after: [setup, gems, models, controllers, views, frontend, init]
|
45
117
|
category: apps
|
data/recipes/railsapps.rb
CHANGED
@@ -10,6 +10,28 @@ prefs[:railsapps] = multiple_choice "Install an example application?",
|
|
10
10
|
["rails3-subdomains", "rails3-subdomains"]] unless prefs.has_key? :railsapps
|
11
11
|
|
12
12
|
case prefs[:railsapps]
|
13
|
+
when 'rails-prelaunch-signup'
|
14
|
+
prefs[:git] = true
|
15
|
+
prefs[:database] = 'sqlite'
|
16
|
+
prefs[:unit_test] = 'rspec'
|
17
|
+
prefs[:integration] = 'cucumber'
|
18
|
+
prefs[:fixtures] = 'factory_girl'
|
19
|
+
prefs[:frontend] = 'bootstrap'
|
20
|
+
prefs[:bootstrap] = 'sass'
|
21
|
+
prefs[:email] = 'mandrill'
|
22
|
+
prefs[:authentication] = 'devise'
|
23
|
+
prefs[:devise_modules] = 'confirmable'
|
24
|
+
prefs[:authorization] = 'cancan'
|
25
|
+
prefs[:starter_app] = 'admin_app'
|
26
|
+
prefs[:form_builder] = 'simple_form'
|
27
|
+
if prefer :git, true
|
28
|
+
prefs[:prelaunch_branch] = multiple_choice "Git branch for the prelaunch app?", [["wip (work-in-progress)", "wip"], ["master", "master"], ["prelaunch", "prelaunch"], ["staging", "staging"]]
|
29
|
+
if prefs[:prelaunch_branch] == 'master'
|
30
|
+
prefs[:main_branch] = multiple_choice "Git branch for the main app?", [["None", "none"], ["wip (work-in-progress)", "wip"], ["edge", "edge"]]
|
31
|
+
else
|
32
|
+
prefs[:main_branch] = 'master'
|
33
|
+
end
|
34
|
+
end
|
13
35
|
when 'rails3-bootstrap-devise-cancan'
|
14
36
|
prefs[:git] = true
|
15
37
|
prefs[:database] = 'sqlite'
|
@@ -87,6 +109,6 @@ name: railsapps
|
|
87
109
|
description: "Install RailsApps example applications."
|
88
110
|
author: RailsApps
|
89
111
|
|
90
|
-
requires: [
|
112
|
+
requires: [core]
|
91
113
|
run_after: [git]
|
92
114
|
category: configuration
|
data/recipes/routes.rb
CHANGED
@@ -31,6 +31,6 @@ name: routes
|
|
31
31
|
description: "Add routes needed for starter apps."
|
32
32
|
author: RailsApps
|
33
33
|
|
34
|
-
requires: [setup, gems,
|
35
|
-
run_after: [setup, gems,
|
34
|
+
requires: [setup, gems, models, controllers, views]
|
35
|
+
run_after: [setup, gems, models, controllers, views]
|
36
36
|
category: mvc
|
data/recipes/setup.rb
CHANGED
@@ -76,7 +76,7 @@ else
|
|
76
76
|
end
|
77
77
|
|
78
78
|
## Authentication and Authorization
|
79
|
-
if recipes.include? '
|
79
|
+
if recipes.include? 'models'
|
80
80
|
prefs[:authentication] = multiple_choice "Authentication?", [["None", "none"], ["Devise", "devise"], ["OmniAuth", "omniauth"]] unless prefs.has_key? :authentication
|
81
81
|
case prefs[:authentication]
|
82
82
|
when 'devise'
|
@@ -95,6 +95,9 @@ if recipes.include? 'auth'
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
+
## Form Builder
|
99
|
+
prefs[:form_builder] = multiple_choice "Use a form builder gem?", [["None", "none"], ["SimpleForm", "simple_form"]] unless prefs.has_key? :form_builder
|
100
|
+
|
98
101
|
## MVC
|
99
102
|
if (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')
|
100
103
|
if prefer :authorization, 'cancan'
|
@@ -114,19 +117,6 @@ if (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.i
|
|
114
117
|
else
|
115
118
|
prefs[:starter_app] = multiple_choice "Install a starter app?", [["None", "none"], ["Home Page", "home_app"]] unless prefs.has_key? :starter_app
|
116
119
|
end
|
117
|
-
if (recipes.include? 'prelaunch') && (prefer :authentication, 'devise') && (prefer :authorization, 'cancan')
|
118
|
-
prefs[:prelaunch_app] = multiple_choice "Install a prelaunch app?", [["None", "none"], ["Prelaunch Signup App", "signup_app"]]
|
119
|
-
if prefs[:prelaunch_app] == 'signup_app'
|
120
|
-
prefs[:devise_modules] = 'confirmable'
|
121
|
-
prefs[:bulkmail] = multiple_choice "Send news and announcements with a mail service?", [["None", "none"], ["MailChimp","mailchimp"]]
|
122
|
-
if prefer :git, true
|
123
|
-
prefs[:prelaunch_branch] = multiple_choice "Git branch for the prelaunch app?", [["wip (work-in-progress)", "wip"], ["master", "master"], ["prelaunch", "prelaunch"], ["staging", "staging"]]
|
124
|
-
if prefs[:prelaunch_branch] == 'master'
|
125
|
-
prefs[:main_branch] = multiple_choice "Git branch for the main app?", [["None (delete)", "none"], ["wip (work-in-progress)", "wip"], ["edge", "edge"]]
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
120
|
end
|
131
121
|
|
132
122
|
__END__
|
data/recipes/views.rb
CHANGED
@@ -34,6 +34,6 @@ name: views
|
|
34
34
|
description: "Add views needed for starter apps."
|
35
35
|
author: RailsApps
|
36
36
|
|
37
|
-
requires: [setup, gems,
|
38
|
-
run_after: [setup, gems,
|
37
|
+
requires: [setup, gems, models, controllers]
|
38
|
+
run_after: [setup, gems, models, controllers]
|
39
39
|
category: mvc
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_apps_composer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -155,7 +155,6 @@ files:
|
|
155
155
|
- lib/rails_wizard/recipes.rb
|
156
156
|
- lib/rails_wizard/template.rb
|
157
157
|
- lib/rails_wizard.rb
|
158
|
-
- recipes/auth.rb
|
159
158
|
- recipes/controllers.rb
|
160
159
|
- recipes/core.rb
|
161
160
|
- recipes/email.rb
|
@@ -202,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
201
|
version: '0'
|
203
202
|
segments:
|
204
203
|
- 0
|
205
|
-
hash: -
|
204
|
+
hash: -3896447774562980249
|
206
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
206
|
none: false
|
208
207
|
requirements:
|
@@ -211,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
210
|
version: '0'
|
212
211
|
segments:
|
213
212
|
- 0
|
214
|
-
hash: -
|
213
|
+
hash: -3896447774562980249
|
215
214
|
requirements: []
|
216
215
|
rubyforge_project: rails_apps_composer
|
217
216
|
rubygems_version: 1.8.24
|
data/recipes/auth.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/auth.rb
|
3
|
-
|
4
|
-
after_bundler do
|
5
|
-
say_wizard "recipe running after 'bundle install'"
|
6
|
-
### DEVISE ###
|
7
|
-
if prefer :authentication, 'devise'
|
8
|
-
# Prevent logging of password_confirmation
|
9
|
-
gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'
|
10
|
-
generate 'devise:install'
|
11
|
-
generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'
|
12
|
-
generate 'devise user'
|
13
|
-
## DEVISE AND CUCUMBER
|
14
|
-
if prefer :integration, 'cucumber'
|
15
|
-
# Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path
|
16
|
-
# (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)
|
17
|
-
gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'
|
18
|
-
end
|
19
|
-
## DEVISE MODULES
|
20
|
-
if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
|
21
|
-
gsub_file 'app/models/user.rb', /:registerable,/, ":registerable, :confirmable,"
|
22
|
-
if prefer :orm, 'mongoid'
|
23
|
-
gsub_file 'app/models/user.rb', /# field :confirmation_token/, "field :confirmation_token"
|
24
|
-
gsub_file 'app/models/user.rb', /# field :confirmed_at/, "field :confirmed_at"
|
25
|
-
gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, "field :confirmation_sent_at"
|
26
|
-
gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, "field :unconfirmed_email"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
if prefer :devise_modules, 'invitable'
|
30
|
-
if prefer :orm, 'mongoid'
|
31
|
-
gsub_file 'app/models/user.rb', /\bend\s*\Z/ do
|
32
|
-
<<-RUBY
|
33
|
-
#invitable
|
34
|
-
field :invitation_token, :type => String
|
35
|
-
field :invitation_sent_at, :type => Time
|
36
|
-
field :invitation_accepted_at, :type => Time
|
37
|
-
field :invitation_limit, :type => Integer
|
38
|
-
field :invited_by_id, :type => String
|
39
|
-
field :invited_by_type, :type => String
|
40
|
-
end
|
41
|
-
RUBY
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
### OMNIAUTH ###
|
47
|
-
if prefer :authentication, 'omniauth'
|
48
|
-
# Don't use single-quote-style-heredoc: we want interpolation.
|
49
|
-
create_file 'config/initializers/omniauth.rb' do <<-RUBY
|
50
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
51
|
-
provider :#{prefs[:omniauth_provider]}, ENV['OMNIAUTH_PROVIDER_KEY'], ENV['OMNIAUTH_PROVIDER_SECRET']
|
52
|
-
end
|
53
|
-
RUBY
|
54
|
-
end
|
55
|
-
end
|
56
|
-
### CANCAN ###
|
57
|
-
if prefer :authorization, 'cancan'
|
58
|
-
generate 'cancan:ability'
|
59
|
-
if prefer :starter_app, 'admin_app'
|
60
|
-
# Limit access to the users#index page
|
61
|
-
inject_into_file 'app/models/ability.rb', :after => "def initialize(user)\n" do <<-RUBY
|
62
|
-
user ||= User.new # guest user (not logged in)
|
63
|
-
if user.has_role? :admin
|
64
|
-
can :manage, :all
|
65
|
-
end
|
66
|
-
RUBY
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
### GIT ###
|
71
|
-
git :add => '.' if prefer :git, true
|
72
|
-
git :commit => "-aqm 'rails_apps_composer: authentication and authorization'" if prefer :git, true
|
73
|
-
end # after_bundler
|
74
|
-
|
75
|
-
__END__
|
76
|
-
|
77
|
-
name: auth
|
78
|
-
description: "Add authentication and authorization."
|
79
|
-
author: RailsApps
|
80
|
-
|
81
|
-
requires: [setup, gems]
|
82
|
-
run_after: [setup, gems]
|
83
|
-
category: auth
|