rails_apps_composer 2.1.7 → 2.1.8
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/recipes/controllers.rb +2 -2
- data/recipes/extras.rb +23 -3
- data/recipes/gems.rb +8 -0
- data/recipes/init.rb +1 -1
- data/recipes/models.rb +1 -1
- data/recipes/railsapps.rb +1 -1
- data/recipes/routes.rb +2 -2
- data/recipes/testing.rb +24 -1
- data/version.rb +1 -1
- metadata +4 -4
data/recipes/controllers.rb
CHANGED
@@ -33,7 +33,7 @@ RUBY
|
|
33
33
|
inject_into_file 'app/controllers/users_controller.rb', " authorize! :index, @user, :message => 'Not authorized as an administrator.'\n", :after => "def index\n"
|
34
34
|
end
|
35
35
|
end
|
36
|
-
gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, '
|
36
|
+
gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, 'subdomains_app'
|
37
37
|
### SESSIONS_CONTROLLER ###
|
38
38
|
if prefer :authentication, 'omniauth'
|
39
39
|
filename = 'app/controllers/sessions_controller.rb'
|
@@ -41,7 +41,7 @@ RUBY
|
|
41
41
|
gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
|
42
42
|
end
|
43
43
|
### PROFILES_CONTROLLER ###
|
44
|
-
copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, '
|
44
|
+
copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
|
45
45
|
### GIT ###
|
46
46
|
git :add => '.' if prefer :git, true
|
47
47
|
git :commit => "-aqm 'rails_apps_composer: controllers'" if prefer :git, true
|
data/recipes/extras.rb
CHANGED
@@ -25,7 +25,7 @@ if config['ban_spiders']
|
|
25
25
|
prefs[:ban_spiders] = true
|
26
26
|
end
|
27
27
|
if prefs[:ban_spiders]
|
28
|
-
say_wizard "
|
28
|
+
say_wizard "recipe banning spiders by modifying 'public/robots.txt'"
|
29
29
|
after_bundler do
|
30
30
|
gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'
|
31
31
|
gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'
|
@@ -37,7 +37,7 @@ if config['jsruntime']
|
|
37
37
|
prefs[:jsruntime] = true
|
38
38
|
end
|
39
39
|
if prefs[:jsruntime]
|
40
|
-
say_wizard "
|
40
|
+
say_wizard "recipe adding 'therubyracer' JavaScript runtime gem"
|
41
41
|
# maybe it was already added for bootstrap-less?
|
42
42
|
unless prefer :bootstrap, 'less'
|
43
43
|
gem 'therubyracer', :group => :assets, :platform => :ruby
|
@@ -49,6 +49,7 @@ if config['rvmrc']
|
|
49
49
|
prefs[:rvmrc] = true
|
50
50
|
end
|
51
51
|
if prefs[:rvmrc]
|
52
|
+
say_wizard "recipe creating project-specific rvm gemset and .rvmrc"
|
52
53
|
# using the rvm Ruby API, see:
|
53
54
|
# http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/
|
54
55
|
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
|
@@ -95,6 +96,22 @@ after_everything do
|
|
95
96
|
git :commit => "-aqm 'rails_apps_composer: extras'" if prefer :git, true
|
96
97
|
end
|
97
98
|
|
99
|
+
## GITHUB
|
100
|
+
if config['github']
|
101
|
+
gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]
|
102
|
+
after_everything do
|
103
|
+
say_wizard "recipe creating GitHub repository"
|
104
|
+
git_uri = `git config remote.origin.url`.strip
|
105
|
+
unless git_uri.size == 0
|
106
|
+
say_wizard "Repository already exists:"
|
107
|
+
say_wizard "#{git_uri}"
|
108
|
+
else
|
109
|
+
run "hub create #{app_name}"
|
110
|
+
run "hub push -u origin master"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
98
115
|
__END__
|
99
116
|
|
100
117
|
name: extras
|
@@ -118,4 +135,7 @@ config:
|
|
118
135
|
prompt: Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?
|
119
136
|
- rvmrc:
|
120
137
|
type: boolean
|
121
|
-
prompt: Create a project-specific rvm gemset and .rvmrc?
|
138
|
+
prompt: Create a project-specific rvm gemset and .rvmrc?
|
139
|
+
- github:
|
140
|
+
type: boolean
|
141
|
+
prompt: Create a GitHub repository?
|
data/recipes/gems.rb
CHANGED
@@ -124,10 +124,18 @@ after_bundler do
|
|
124
124
|
say_wizard "Creating a user named '#{app_name}' for PostgreSQL"
|
125
125
|
run "createuser #{app_name}" if prefer :database, 'postgresql'
|
126
126
|
gsub_file "config/database.yml", /username: .*/, "username: #{app_name}"
|
127
|
+
gsub_file "config/database.yml", /database: myapp_development/, "database: #{app_name}_development"
|
128
|
+
gsub_file "config/database.yml", /database: myapp_test/, "database: #{app_name}_test"
|
129
|
+
gsub_file "config/database.yml", /database: myapp_production/, "database: #{app_name}_production"
|
127
130
|
rescue StandardError
|
128
131
|
raise "unable to create a user for PostgreSQL"
|
129
132
|
end
|
130
133
|
end
|
134
|
+
if prefer :database, 'mysql'
|
135
|
+
gsub_file "config/database.yml", /database: myapp_development/, "database: #{app_name}_development"
|
136
|
+
gsub_file "config/database.yml", /database: myapp_test/, "database: #{app_name}_test"
|
137
|
+
gsub_file "config/database.yml", /database: myapp_production/, "database: #{app_name}_production"
|
138
|
+
end
|
131
139
|
unless prefer :database, 'sqlite'
|
132
140
|
affirm = multiple_choice "Drop any existing databases named #{app_name}?",
|
133
141
|
[["Yes (continue)",true], ["No (abort)",false]]
|
data/recipes/init.rb
CHANGED
data/recipes/models.rb
CHANGED
@@ -31,7 +31,7 @@ after_bundler do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
### SUBDOMAINS ###
|
34
|
-
copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, '
|
34
|
+
copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
|
35
35
|
### AUTHORIZATION (insert 'rolify' after User model is created) ###
|
36
36
|
if prefer :authorization, 'cancan'
|
37
37
|
unless prefer :orm, 'mongoid'
|
data/recipes/railsapps.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb
|
3
3
|
|
4
4
|
prefs[:railsapps] = multiple_choice "Install an example application?",
|
5
|
-
[["
|
5
|
+
[["I want to build my own application", "none"],
|
6
6
|
["rails3-bootstrap-devise-cancan", "rails3-bootstrap-devise-cancan"],
|
7
7
|
["rails3-devise-rspec-cucumber", "rails3-devise-rspec-cucumber"],
|
8
8
|
["rails3-mongoid-devise", "rails3-mongoid-devise"],
|
data/recipes/routes.rb
CHANGED
@@ -16,8 +16,8 @@ after_bundler do
|
|
16
16
|
copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'
|
17
17
|
end
|
18
18
|
### SUBDOMAINS ###
|
19
|
-
copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, '
|
20
|
-
copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, '
|
19
|
+
copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
|
20
|
+
copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'
|
21
21
|
### CORRECT APPLICATION NAME ###
|
22
22
|
gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
|
23
23
|
### GIT ###
|
data/recipes/testing.rb
CHANGED
@@ -153,13 +153,23 @@ after_everything do
|
|
153
153
|
copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
|
154
154
|
copy_from_repo 'spec/models/user_spec.rb', :repo => repo
|
155
155
|
end
|
156
|
+
## SUBDOMAINS
|
157
|
+
if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')
|
158
|
+
say_wizard "copying RSpec files from the rails3-subdomains examples"
|
159
|
+
repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'
|
160
|
+
copy_from_repo 'spec/spec_helper.rb', :repo => repo
|
161
|
+
copy_from_repo 'spec/factories/users.rb', :repo => repo
|
162
|
+
copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
|
163
|
+
copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
|
164
|
+
copy_from_repo 'spec/models/user_spec.rb', :repo => repo
|
165
|
+
end
|
156
166
|
## GIT
|
157
167
|
git :add => '.' if prefer :git, true
|
158
168
|
git :commit => "-aqm 'rails_apps_composer: rspec files'" if prefer :git, true
|
159
169
|
end
|
160
170
|
### CUCUMBER ###
|
161
171
|
if prefer :integration, 'cucumber'
|
162
|
-
## CUCUMBER AND DEVISE
|
172
|
+
## CUCUMBER AND DEVISE (USERS APP)
|
163
173
|
if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')
|
164
174
|
say_wizard "copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples"
|
165
175
|
repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
|
@@ -185,6 +195,7 @@ RUBY
|
|
185
195
|
end
|
186
196
|
end
|
187
197
|
end
|
198
|
+
## CUCUMBER AND DEVISE (ADMIN APP)
|
188
199
|
if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')
|
189
200
|
say_wizard "copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples"
|
190
201
|
repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
|
@@ -210,6 +221,18 @@ RUBY
|
|
210
221
|
end
|
211
222
|
end
|
212
223
|
end
|
224
|
+
## CUCUMBER AND DEVISE (SUBDOMAINS APP)
|
225
|
+
if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')
|
226
|
+
say_wizard "copying RSpec files from the rails3-subdomains examples"
|
227
|
+
repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'
|
228
|
+
copy_from_repo 'features/users/sign_in.feature', :repo => repo
|
229
|
+
copy_from_repo 'features/users/sign_out.feature', :repo => repo
|
230
|
+
copy_from_repo 'features/users/sign_up.feature', :repo => repo
|
231
|
+
copy_from_repo 'features/users/user_edit.feature', :repo => repo
|
232
|
+
copy_from_repo 'features/users/user_show.feature', :repo => repo
|
233
|
+
copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
|
234
|
+
copy_from_repo 'features/support/paths.rb', :repo => repo
|
235
|
+
end
|
213
236
|
## GIT
|
214
237
|
git :add => '.' if prefer :git, true
|
215
238
|
git :commit => "-aqm 'rails_apps_composer: cucumber files'" if prefer :git, true
|
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.1.
|
4
|
+
version: 2.1.8
|
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-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -202,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
202
|
version: '0'
|
203
203
|
segments:
|
204
204
|
- 0
|
205
|
-
hash:
|
205
|
+
hash: -1036926388114675949
|
206
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
207
|
none: false
|
208
208
|
requirements:
|
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
211
|
version: '0'
|
212
212
|
segments:
|
213
213
|
- 0
|
214
|
-
hash:
|
214
|
+
hash: -1036926388114675949
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project: rails_apps_composer
|
217
217
|
rubygems_version: 1.8.24
|