rails_apps_composer 2.4.24 → 2.4.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/recipes/apps4.rb +67 -0
- data/recipes/controllers.rb +13 -9
- data/recipes/email.rb +2 -2
- data/recipes/frontend.rb +0 -7
- data/recipes/gems.rb +5 -0
- data/recipes/models.rb +8 -11
- data/recipes/railsapps.rb +15 -1
- data/recipes/routes.rb +5 -2
- data/recipes/setup.rb +8 -2
- data/recipes/views.rb +1 -1
- data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae94d7ef1ef1ed3e2c94151d58e9827e9a8b44f7
|
4
|
+
data.tar.gz: bbeb269bd02495aef1bde1695b617f2f6684a72f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d929c187621ef56fe8615ba4d97b22e5850528e7ea9d84a251d90774ab72520986793bf40f36160cb7503902be96211afa4da12aa75139981994e55a725abf
|
7
|
+
data.tar.gz: 03c2df4bff06248139ab11756138d929d44359cc880185aec85e34b4230e41981683bf8ab130d07f07452c5c76890aad047a9da4a2bdd3d4b8209df55e9ba4a9
|
data/recipes/apps4.rb
CHANGED
@@ -210,6 +210,73 @@ if prefer :apps4, 'rails-devise'
|
|
210
210
|
end # after_bundler
|
211
211
|
end # rails-devise
|
212
212
|
|
213
|
+
### RAILS-OMNIAUTH ####
|
214
|
+
|
215
|
+
if prefer :apps4, 'rails-omniauth'
|
216
|
+
|
217
|
+
# >-------------------------------[ after_bundler ]--------------------------------<
|
218
|
+
|
219
|
+
after_bundler do
|
220
|
+
say_wizard "recipe running after 'bundle install'"
|
221
|
+
repo = 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
222
|
+
|
223
|
+
# >-------------------------------[ Init ]--------------------------------<
|
224
|
+
|
225
|
+
copy_from_repo 'config/application.yml', :repo => repo
|
226
|
+
remove_file 'config/application.example.yml'
|
227
|
+
copy_file destination_root + '/config/application.yml', destination_root + '/config/application.example.yml'
|
228
|
+
|
229
|
+
# >-------------------------------[ Models ]--------------------------------<
|
230
|
+
|
231
|
+
copy_from_repo 'app/models/user.rb', :repo => repo
|
232
|
+
|
233
|
+
# >-------------------------------[ Controllers ]--------------------------------<
|
234
|
+
|
235
|
+
copy_from_repo 'app/controllers/home_controller.rb', :repo => repo
|
236
|
+
copy_from_repo 'app/controllers/sessions_controller.rb', :repo => repo
|
237
|
+
gsub_file 'app/controllers/sessions_controller.rb', /twitter/, prefs[:omniauth_provider]
|
238
|
+
copy_from_repo 'app/controllers/users_controller.rb', :repo => repo
|
239
|
+
|
240
|
+
# >-------------------------------[ Views ]--------------------------------<
|
241
|
+
|
242
|
+
copy_from_repo 'app/views/home/index.html.erb', :repo => repo
|
243
|
+
copy_from_repo 'app/views/users/edit.html.erb', :repo => repo
|
244
|
+
copy_from_repo 'app/views/users/index.html.erb', :repo => repo
|
245
|
+
copy_from_repo 'app/views/users/show.html.erb', :repo => repo
|
246
|
+
|
247
|
+
# >-------------------------------[ Routes ]--------------------------------<
|
248
|
+
|
249
|
+
copy_from_repo 'config/routes.rb', :repo => repo
|
250
|
+
### CORRECT APPLICATION NAME ###
|
251
|
+
gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
# >-------------------------------[ after_everything ]--------------------------------<
|
256
|
+
|
257
|
+
after_everything do
|
258
|
+
say_wizard "recipe running after 'bundle install'"
|
259
|
+
|
260
|
+
# >-------------------------------[ Clean up starter app ]--------------------------------<
|
261
|
+
|
262
|
+
# remove commented lines and multiple blank lines from Gemfile
|
263
|
+
# thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
|
264
|
+
gsub_file 'Gemfile', /#.*\n/, "\n"
|
265
|
+
gsub_file 'Gemfile', /\n^\s*\n/, "\n"
|
266
|
+
# remove commented lines and multiple blank lines from config/routes.rb
|
267
|
+
gsub_file 'config/routes.rb', / #.*\n/, "\n"
|
268
|
+
gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
|
269
|
+
# GIT
|
270
|
+
git :add => '-A' if prefer :git, true
|
271
|
+
git :commit => '-qm "rails_apps_composer: clean up starter app"' if prefer :git, true
|
272
|
+
|
273
|
+
### GIT ###
|
274
|
+
git :add => '-A' if prefer :git, true
|
275
|
+
git :commit => '-qm "rails_apps_composer: learn-rails app"' if prefer :git, true
|
276
|
+
|
277
|
+
end # after_bundler
|
278
|
+
end # rails-omniauth
|
279
|
+
|
213
280
|
__END__
|
214
281
|
|
215
282
|
name: apps4
|
data/recipes/controllers.rb
CHANGED
@@ -5,8 +5,7 @@ after_bundler do
|
|
5
5
|
say_wizard "recipe running after 'bundle install'"
|
6
6
|
### APPLICATION_CONTROLLER ###
|
7
7
|
if prefer :authentication, 'omniauth'
|
8
|
-
|
9
|
-
copy_from_repo 'app/controllers/application_controller-omniauth.rb', :prefs => 'omniauth'
|
8
|
+
copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
10
9
|
end
|
11
10
|
if prefer :authorization, 'cancan'
|
12
11
|
inject_into_file 'app/controllers/application_controller.rb', :before => "\nend" do <<-RUBY
|
@@ -19,10 +18,7 @@ RUBY
|
|
19
18
|
end
|
20
19
|
### HOME_CONTROLLER ###
|
21
20
|
if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]
|
22
|
-
generate(:controller, "home
|
23
|
-
end
|
24
|
-
if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]
|
25
|
-
gsub_file 'app/controllers/home_controller.rb', /def index/, "def index\n @users = User.all"
|
21
|
+
generate(:controller, "home")
|
26
22
|
end
|
27
23
|
### USERS_CONTROLLER ###
|
28
24
|
case prefs[:starter_app]
|
@@ -30,13 +26,21 @@ RUBY
|
|
30
26
|
if (prefer :authentication, 'devise') and (not prefer :apps4, 'rails-devise')
|
31
27
|
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
|
32
28
|
elsif prefer :authentication, 'omniauth'
|
33
|
-
|
29
|
+
if rails_4?
|
30
|
+
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
31
|
+
else
|
32
|
+
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
|
33
|
+
end
|
34
34
|
end
|
35
35
|
when 'admin_app'
|
36
36
|
if (prefer :authentication, 'devise') and (not prefer :apps4, 'rails-devise')
|
37
37
|
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
|
38
38
|
elsif prefer :authentication, 'omniauth'
|
39
|
-
|
39
|
+
if rails_4?
|
40
|
+
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
41
|
+
else
|
42
|
+
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
|
43
|
+
end
|
40
44
|
end
|
41
45
|
when 'subdomains_app'
|
42
46
|
copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/'
|
@@ -51,7 +55,7 @@ RUBY
|
|
51
55
|
### SESSIONS_CONTROLLER ###
|
52
56
|
if prefer :authentication, 'omniauth'
|
53
57
|
filename = 'app/controllers/sessions_controller.rb'
|
54
|
-
copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/
|
58
|
+
copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
55
59
|
gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
|
56
60
|
if prefer :authorization, 'cancan'
|
57
61
|
inject_into_file filename, " user.add_role :admin if User.count == 1 # make the first user an admin\n", :after => "session[:user_id] = user.id\n"
|
data/recipes/email.rb
CHANGED
@@ -82,7 +82,7 @@ TEXT
|
|
82
82
|
\n
|
83
83
|
config.action_mailer.smtp_settings = {
|
84
84
|
address: "smtp.sendgrid.net",
|
85
|
-
port:
|
85
|
+
port: 587,
|
86
86
|
domain: ENV["DOMAIN_NAME"],
|
87
87
|
authentication: "plain",
|
88
88
|
user_name: ENV["SENDGRID_USERNAME"],
|
@@ -98,7 +98,7 @@ TEXT
|
|
98
98
|
\n
|
99
99
|
config.action_mailer.smtp_settings = {
|
100
100
|
:address => "smtp.mandrillapp.com",
|
101
|
-
:port =>
|
101
|
+
:port => 587,
|
102
102
|
:user_name => ENV["MANDRILL_USERNAME"],
|
103
103
|
:password => ENV["MANDRILL_APIKEY"]
|
104
104
|
}
|
data/recipes/frontend.rb
CHANGED
@@ -36,13 +36,6 @@ after_everything do
|
|
36
36
|
# create navigation links using the rails_layout gem
|
37
37
|
generate 'layout:navigation -f'
|
38
38
|
# replace with specialized navigation partials
|
39
|
-
if prefer :authentication, 'omniauth'
|
40
|
-
if prefer :authorization, 'cancan'
|
41
|
-
copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'
|
42
|
-
else
|
43
|
-
copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'
|
44
|
-
end
|
45
|
-
end
|
46
39
|
copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'
|
47
40
|
|
48
41
|
### GIT ###
|
data/recipes/gems.rb
CHANGED
@@ -19,14 +19,17 @@ if (prefs[:dev_webserver] == prefs[:prod_webserver])
|
|
19
19
|
add_gem 'unicorn' if prefer :dev_webserver, 'unicorn'
|
20
20
|
add_gem 'unicorn-rails' if prefer :dev_webserver, 'unicorn'
|
21
21
|
add_gem 'puma' if prefer :dev_webserver, 'puma'
|
22
|
+
add_gem 'passenger' if prefer :dev_webserver, 'passenger_standalone'
|
22
23
|
else
|
23
24
|
add_gem 'thin', :group => [:development, :test] if prefer :dev_webserver, 'thin'
|
24
25
|
add_gem 'unicorn', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'
|
25
26
|
add_gem 'unicorn-rails', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'
|
26
27
|
add_gem 'puma', :group => [:development, :test] if prefer :dev_webserver, 'puma'
|
28
|
+
add_gem 'passenger', :group => [:development, :test] if prefer :dev_webserver, 'passenger_standalone'
|
27
29
|
add_gem 'thin', :group => :production if prefer :prod_webserver, 'thin'
|
28
30
|
add_gem 'unicorn', :group => :production if prefer :prod_webserver, 'unicorn'
|
29
31
|
add_gem 'puma', :group => :production if prefer :prod_webserver, 'puma'
|
32
|
+
add_gem 'passenger', :group => :production if prefer :prod_webserver, 'passenger_standalone'
|
30
33
|
end
|
31
34
|
|
32
35
|
## Rails 4.0 attr_accessible Compatibility
|
@@ -283,10 +286,12 @@ FILE
|
|
283
286
|
create_file 'Procfile', 'web: bundle exec rails server -p $PORT' if prefer :prod_webserver, 'thin'
|
284
287
|
create_file 'Procfile', 'web: bundle exec unicorn -p $PORT' if prefer :prod_webserver, 'unicorn'
|
285
288
|
create_file 'Procfile', 'web: bundle exec puma -p $PORT' if prefer :prod_webserver, 'puma'
|
289
|
+
create_file 'Procfile', 'web: bundle exec passenger start -p $PORT' if prefer :prod_webserver, 'passenger_standalone'
|
286
290
|
if (prefs[:dev_webserver] != prefs[:prod_webserver])
|
287
291
|
create_file 'Procfile.dev', 'web: bundle exec rails server -p $PORT' if prefer :dev_webserver, 'thin'
|
288
292
|
create_file 'Procfile.dev', 'web: bundle exec unicorn -p $PORT' if prefer :dev_webserver, 'unicorn'
|
289
293
|
create_file 'Procfile.dev', 'web: bundle exec puma -p $PORT' if prefer :dev_webserver, 'puma'
|
294
|
+
create_file 'Procfile.dev', 'web: bundle exec passenger start -p $PORT' if prefer :dev_webserver, 'passenger_standalone'
|
290
295
|
end
|
291
296
|
end
|
292
297
|
## Git
|
data/recipes/models.rb
CHANGED
@@ -54,19 +54,16 @@ RUBY
|
|
54
54
|
end
|
55
55
|
### OMNIAUTH ###
|
56
56
|
if prefer :authentication, 'omniauth'
|
57
|
-
repo = 'https://raw.github.com/RailsApps/
|
57
|
+
repo = 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
58
58
|
copy_from_repo 'config/initializers/omniauth.rb', :repo => repo
|
59
59
|
gsub_file 'config/initializers/omniauth.rb', /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
gsub_file 'app/models/user.rb', /^\s*field.*\n/, ''
|
68
|
-
gsub_file 'app/models/user.rb', /^\s*# run 'rake db:mongoid:create_indexes' to create indexes\n/, ''
|
69
|
-
gsub_file 'app/models/user.rb', /^\s*index\(\{ email: 1 \}, \{ unique: true, background: true \}\)\n/, ''
|
60
|
+
if prefer :orm, 'mongoid'
|
61
|
+
repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
|
62
|
+
copy_from_repo 'app/models/user.rb', :repo => repo
|
63
|
+
else
|
64
|
+
generate 'model User name:string email:string provider:string uid:string'
|
65
|
+
run 'bundle exec rake db:migrate'
|
66
|
+
copy_from_repo 'app/models/user.rb', :repo => repo
|
70
67
|
end
|
71
68
|
end
|
72
69
|
### SUBDOMAINS ###
|
data/recipes/railsapps.rb
CHANGED
@@ -31,7 +31,8 @@ when "4"
|
|
31
31
|
[["learn-rails", "learn-rails"],
|
32
32
|
["rails-bootstrap", "rails-bootstrap"],
|
33
33
|
["rails-foundation", "rails-foundation"],
|
34
|
-
["rails-devise", "rails-devise"]
|
34
|
+
["rails-devise", "rails-devise"],
|
35
|
+
["rails-omniauth", "rails-omniauth"]]
|
35
36
|
when 'contributed_app'
|
36
37
|
prefs[:apps4] = multiple_choice "No contributed applications are available.",
|
37
38
|
[["continue", "none"]]
|
@@ -119,6 +120,19 @@ case prefs[:apps4]
|
|
119
120
|
prefs[:quiet_assets] = true
|
120
121
|
prefs[:local_env_file] = 'figaro'
|
121
122
|
prefs[:better_errors] = true
|
123
|
+
when 'rails-omniauth'
|
124
|
+
prefs[:git] = true
|
125
|
+
prefs[:unit_test] = false
|
126
|
+
prefs[:integration] = false
|
127
|
+
prefs[:fixtures] = false
|
128
|
+
prefs[:email] = 'none'
|
129
|
+
prefs[:authentication] = 'omniauth'
|
130
|
+
prefs[:authorization] = 'none'
|
131
|
+
prefs[:starter_app] = false
|
132
|
+
prefs[:form_builder] = 'none'
|
133
|
+
prefs[:quiet_assets] = true
|
134
|
+
prefs[:local_env_file] = 'figaro'
|
135
|
+
prefs[:better_errors] = true
|
122
136
|
end
|
123
137
|
|
124
138
|
case prefs[:railsapps]
|
data/recipes/routes.rb
CHANGED
@@ -20,8 +20,11 @@ after_bundler do
|
|
20
20
|
end
|
21
21
|
## OMNIAUTH
|
22
22
|
if prefer :authentication, 'omniauth'
|
23
|
-
|
24
|
-
|
23
|
+
if rails_4?
|
24
|
+
copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
25
|
+
else
|
26
|
+
copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
|
27
|
+
end
|
25
28
|
end
|
26
29
|
end
|
27
30
|
### SUBDOMAINS ###
|
data/recipes/setup.rb
CHANGED
@@ -13,9 +13,11 @@ sqlite_detected = gemfile.include? 'sqlite3'
|
|
13
13
|
|
14
14
|
## Web Server
|
15
15
|
prefs[:dev_webserver] = multiple_choice "Web server for development?", [["WEBrick (default)", "webrick"],
|
16
|
-
["Thin", "thin"], ["Unicorn", "unicorn"], ["Puma", "puma"]
|
16
|
+
["Thin", "thin"], ["Unicorn", "unicorn"], ["Puma", "puma"], ["Phusion Passenger (Apache/Nginx)", "passenger"],
|
17
|
+
["Phusion Passenger (Standalone)", "passenger_standalone"]] unless prefs.has_key? :dev_webserver
|
17
18
|
prefs[:prod_webserver] = multiple_choice "Web server for production?", [["Same as development", "same"],
|
18
|
-
["Thin", "thin"], ["Unicorn", "unicorn"], ["Puma", "puma"]
|
19
|
+
["Thin", "thin"], ["Unicorn", "unicorn"], ["Puma", "puma"], ["Phusion Passenger (Apache/Nginx)", "passenger"],
|
20
|
+
["Phusion Passenger (Standalone)", "passenger_standalone"]] unless prefs.has_key? :prod_webserver
|
19
21
|
if prefs[:prod_webserver] == 'same'
|
20
22
|
case prefs[:dev_webserver]
|
21
23
|
when 'thin'
|
@@ -24,6 +26,10 @@ if prefs[:prod_webserver] == 'same'
|
|
24
26
|
prefs[:prod_webserver] = 'unicorn'
|
25
27
|
when 'puma'
|
26
28
|
prefs[:prod_webserver] = 'puma'
|
29
|
+
when 'passenger'
|
30
|
+
prefs[:prod_webserver] = 'passenger'
|
31
|
+
when 'passenger_standalone'
|
32
|
+
prefs[:prod_webserver] = 'passenger_standalone'
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
data/recipes/views.rb
CHANGED
@@ -37,7 +37,7 @@ after_bundler do
|
|
37
37
|
copy_from_repo 'app/views/users/show.html.erb'
|
38
38
|
copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'
|
39
39
|
## EDIT
|
40
|
-
copy_from_repo 'app/views/users/edit
|
40
|
+
copy_from_repo 'app/views/users/edit.html.erb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
|
41
41
|
end
|
42
42
|
### PROFILES ###
|
43
43
|
copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_apps_composer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kehoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|