capistrano-exts 1.8.1 → 1.8.2

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/ChangeLog ADDED
@@ -0,0 +1,688 @@
1
+ 2011-09-12 Wael Nasreddine <wael.nasreddine@gmail.com>
2
+
3
+ * lib/capistrano-exts/receipts/contao.rb: MISC: Typo in the function name
4
+
5
+ * lib/capistrano-exts/receipts/functions.rb: MISC: The options hash should
6
+ not be mandatory.
7
+
8
+ 2011-09-08 Wael Nasreddine <wael.nasreddine@gmail.com>
9
+
10
+ * lib/capistrano-exts/receipts/contao.rb: MISC: Do not overwrite the
11
+ generated localconfig.php.
12
+
13
+ * README.md: MISC: Add a require false which is required for rails.
14
+
15
+ * README.md, lib/capistrano-exts/version.rb: MISC: Bump to version 1.8.1.
16
+
17
+ * lib/capistrano-exts/receipts/servers.rb: MISC: Typo in the task name.
18
+
19
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.8.0
20
+
21
+ 2011-09-07 Wael Nasreddine <wael.nasreddine@gmail.com>
22
+
23
+ * lib/capistrano-exts/receipts/mysql.rb: MISC: Refactor the *_credentials and
24
+ *_root_credentials to one iteration.
25
+
26
+ * lib/capistrano-exts/receipts/functions.rb,
27
+ lib/capistrano-exts/receipts/git.rb, lib/capistrano-exts/receipts/mysql.rb,
28
+ lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Refactor the
29
+ capture(cat..) to read(..).
30
+
31
+ * lib/capistrano-exts/receipts/mysql.rb: Do not run the task
32
+ print_credentials (and for root) if it is already in the ARGV (it will be
33
+ executed twice. closes #3 @5m
34
+
35
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.7.0
36
+
37
+ * lib/capistrano-exts/receipts/multistage.rb: MISC: Add a task that will
38
+ synchronise any stage with any other stage with confirmation of course.
39
+
40
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.6.0
41
+
42
+ * examples/php_fpm/deploy/development.rb,
43
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
44
+ examples/rails_passenger/deploy/development.rb,
45
+ examples/rails_passenger/deploy/production.rb,
46
+ examples/rails_passenger/deploy/staging.rb,
47
+ examples/rails_reverse_proxy/deploy/development.rb,
48
+ examples/rails_reverse_proxy/deploy/production.rb,
49
+ examples/rails_reverse_proxy/deploy/staging.rb,
50
+ lib/capistrano-exts/receipts/mysql.rb,
51
+ lib/capistrano-exts/templates/multistage.rb: MISC: Add a new config param to
52
+ setup the backups path.
53
+
54
+ * lib/capistrano-exts/receipts/functions.rb: MISC: Using data.present? breaks
55
+ if data are binary.
56
+
57
+ * lib/capistrano-exts/receipts/deploy.rb,
58
+ lib/capistrano-exts/receipts/servers.rb: MISC: Add a task deploy:folders and
59
+ use it in deploy:setup:server:folders and after deploy:setup as well, this
60
+ will ensure folders are available in shared hosts.
61
+
62
+ * lib/capistrano-exts/receipts/contents.rb: MISC: Add a task to import the
63
+ contents folder.
64
+
65
+ * lib/capistrano-exts/receipts/contents.rb: MISC: Add a task to back the
66
+ contents folder before exporting them and use the backup file to export the
67
+ contents.
68
+
69
+ * lib/capistrano-exts/receipts/contao.rb: MISC: Replace the DB_HOST in the
70
+ localconfig as well.
71
+
72
+ * examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
73
+ examples/rails_passenger/deploy/development.rb,
74
+ examples/rails_passenger/deploy/production.rb,
75
+ examples/rails_passenger/deploy/staging.rb,
76
+ examples/rails_reverse_proxy/deploy/development.rb,
77
+ examples/rails_reverse_proxy/deploy/production.rb,
78
+ examples/rails_reverse_proxy/deploy/staging.rb,
79
+ lib/capistrano-exts/templates/multistage.rb: MISC: Remove a misleadin comment
80
+ in the config file.
81
+
82
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.5.1
83
+
84
+ * examples/php_fpm/deploy/development.rb,
85
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
86
+ examples/rails_passenger/deploy/development.rb,
87
+ examples/rails_passenger/deploy/production.rb,
88
+ examples/rails_passenger/deploy/staging.rb,
89
+ examples/rails_reverse_proxy/deploy/development.rb,
90
+ examples/rails_reverse_proxy/deploy/production.rb,
91
+ examples/rails_reverse_proxy/deploy/staging.rb,
92
+ lib/capistrano-exts/receipts/mysql.rb,
93
+ lib/capistrano-exts/templates/multistage.rb: MISC: We should be able to
94
+ specify the username and the hostname of the database, we should not parse
95
+ the db role because it should be SSHable, it can't be on a shared hosting.
96
+
97
+ * lib/capistrano-exts/receipts/contents.rb: MISC: Add the h option to the tar
98
+ command, this will replace symlinks with regular files.
99
+
100
+ * lib/capistrano-exts/receipts/git.rb: Rename deploy to git
101
+
102
+ * lib/capistrano-exts/receipts/deploy.rb: MISC: Move more default public
103
+ folder out of the way.
104
+
105
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.5.0
106
+
107
+ * lib/capistrano-exts/receipts/contents.rb,
108
+ lib/capistrano-exts/receipts/deploy.rb,
109
+ lib/capistrano-exts/receipts/mysql.rb,
110
+ lib/capistrano-exts/receipts/servers.rb: MISC: Add a task to send the ssh key
111
+ and another to move the htdocs folder if it does indeed exist.
112
+
113
+ 2011-09-06 Wael Nasreddine <wael.nasreddine@gmail.com>
114
+
115
+ * lib/capistrano-exts/receipts/contents.rb,
116
+ lib/capistrano-exts/receipts/mysql.rb: MISC: Export file name should not be
117
+ mandatory.'
118
+
119
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.4.0
120
+
121
+ * lib/capistrano-exts/receipts/functions.rb: MISC: Add the millisecond to the
122
+ generated file name, to prevent any race condition that might arise.
123
+
124
+ * README.md, examples/php_fpm/deploy/development.rb,
125
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
126
+ examples/rails_passenger/deploy/development.rb,
127
+ examples/rails_passenger/deploy/production.rb,
128
+ examples/rails_passenger/deploy/staging.rb,
129
+ examples/rails_reverse_proxy/deploy/development.rb,
130
+ examples/rails_reverse_proxy/deploy/production.rb,
131
+ examples/rails_reverse_proxy/deploy/staging.rb,
132
+ lib/capistrano-exts/receipts/contao.rb,
133
+ lib/capistrano-exts/receipts/contents.rb,
134
+ lib/capistrano-exts/receipts/deploy.rb,
135
+ lib/capistrano-exts/templates/multistage.rb: MISC: Add a contents receipt to
136
+ import/export contents.
137
+
138
+ * README.md, examples/php_fpm/deploy/development.rb,
139
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
140
+ examples/rails_passenger/deploy/development.rb,
141
+ examples/rails_passenger/deploy/production.rb,
142
+ examples/rails_passenger/deploy/staging.rb,
143
+ examples/rails_reverse_proxy/deploy/development.rb,
144
+ examples/rails_reverse_proxy/deploy/production.rb,
145
+ examples/rails_reverse_proxy/deploy/staging.rb,
146
+ lib/capistrano-exts/receipts/multistage.rb,
147
+ lib/capistrano-exts/receipts/servers.rb,
148
+ lib/capistrano-exts/receipts/servers/db_server.rb,
149
+ lib/capistrano-exts/receipts/servers/web_server.rb,
150
+ lib/capistrano-exts/templates/multistage.rb: Rename all :prepare tasks to
151
+ :setup which is a more appropriate name @10m
152
+
153
+ 2011-09-05 Wael Nasreddine <wael.nasreddine@gmail.com>
154
+
155
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.3.6
156
+
157
+ * lib/capistrano-exts/receipts/contao.rb: MISC: Add a \n after order
158
+ deny,allow
159
+
160
+ * .../receipts/servers/web_server/nginx.rb: MISC: Define denied_access only
161
+ if it exists.
162
+
163
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.3.5
164
+
165
+ * examples/php_fpm/deploy/development.rb,
166
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
167
+ examples/rails_passenger/deploy/development.rb,
168
+ examples/rails_passenger/deploy/production.rb,
169
+ examples/rails_passenger/deploy/staging.rb,
170
+ examples/rails_reverse_proxy/deploy/development.rb,
171
+ examples/rails_reverse_proxy/deploy/production.rb,
172
+ examples/rails_reverse_proxy/deploy/staging.rb,
173
+ .../receipts/servers/web_server/nginx.rb,
174
+ lib/capistrano-exts/templates/multistage.rb,
175
+ .../templates/web_servers/nginx.conf.erb,
176
+ spec/rendered_templates/nginx_php_fpm.conf,
177
+ spec/servers/web_server/nginx_spec.rb: MISC: Implement a denied_access.
178
+
179
+ * lib/capistrano-exts/receipts/contao.rb: MISC: Deny access from logs folder.
180
+
181
+ * lib/capistrano-exts/receipts/contao.rb: MISC: Use fetch
182
+
183
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.3.4
184
+
185
+ * lib/capistrano-exts/receipts/functions.rb,
186
+ lib/capistrano-exts/receipts/mysql.rb: Use a random remote file name to avoid
187
+ race condition closes #2 @5m
188
+
189
+ 2011-09-04 Wael Nasreddine <wael.nasreddine@gmail.com>
190
+
191
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.3.3
192
+
193
+ * lib/capistrano-exts/receipts/mysql.rb: Enhance how we look for the sql file
194
+ in {import,export}_db_dump Instead of expecting just one more argument (like
195
+ staging in 'cap staging mysql:import_db_dump), look for the index of the task
196
+ we're requesting and add one to it.. This way wherever the task has been
197
+ added to the call, we are able to fetch the file name from the command line
198
+ string refs #1 @10m
199
+
200
+ * lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Rename
201
+ print_web_server_http_auth to print_http_auth.
202
+
203
+ * lib/capistrano-exts/receipts/servers/web_server.rb: Rename
204
+ print_web_server_auth_file to print_web_server_http_auth.
205
+
206
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.3.2
207
+
208
+ * lib/capistrano-exts/receipts/multistage.rb,
209
+ lib/capistrano-exts/receipts/mysql.rb: Fix mysql:import_db_dump and
210
+ mysql:export_db_dump closes #1 @13m
211
+
212
+ * README.md, lib/capistrano-exts/version.rb: Bump to version 1.3.1
213
+
214
+ * lib/capistrano-exts/receipts/mysql.rb: MISC: Fix a few issues with mysql
215
+ receipt.
216
+
217
+ * lib/capistrano-exts/version.rb: Bump to version 1.3.0
218
+
219
+ * lib/capistrano-exts/receipts/mysql.rb,
220
+ lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Use cp/rm instead
221
+ of mv.
222
+
223
+ * lib/capistrano-exts/receipts/mysql.rb: MISC: Do not write to the target
224
+ folder directly but instead write it to a temporary file and move it with
225
+ try_sudo.
226
+
227
+ * lib/capistrano-exts/receipts/contao.rb,
228
+ lib/capistrano-exts/receipts/mysql.rb,
229
+ lib/capistrano-exts/receipts/servers/web_server.rb: MISC: The database server
230
+ should not be localhost but instead the primary database server.
231
+
232
+ * lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Instead of
233
+ looking for a proc, better is to look if it responds to :call.
234
+
235
+ * lib/capistrano-exts/version.rb: Bump to version 1.2.0
236
+
237
+ * lib/capistrano-exts/receipts/functions.rb,
238
+ lib/capistrano-exts/receipts/mysql.rb: MISC: Make sure we do have a user and
239
+ a pass, don't assume that if we have a hash we do have auth.
240
+
241
+ * lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Add a new task
242
+ that prints the http_basic_auth for easier access to these informations.
243
+
244
+ * lib/capistrano-exts/receipts/mysql.rb: MISC: Enhance the warnings (user
245
+ experience)
246
+
247
+ * lib/capistrano-exts/receipts/mysql.rb: MISC: If we couldn't drop the
248
+ database (if we do not have permissions to do so) try dropping all tables.
249
+
250
+ 2011-09-03 Wael Nasreddine <wael.nasreddine@gmail.com>
251
+
252
+ * spec/spec_helper.rb: MISC: in 34f771f5ddfa0b5274396e75d3b45e92d67ee3c0 I
253
+ have remove some gems, disable mocha for the moment.
254
+
255
+ * lib/capistrano-exts/version.rb: Bump to version 1.1.5
256
+
257
+ * examples/php_fpm/deploy/development.rb,
258
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
259
+ examples/rails_passenger/deploy/development.rb,
260
+ examples/rails_passenger/deploy/production.rb,
261
+ examples/rails_passenger/deploy/staging.rb,
262
+ examples/rails_reverse_proxy/deploy/development.rb,
263
+ examples/rails_reverse_proxy/deploy/production.rb,
264
+ examples/rails_reverse_proxy/deploy/staging.rb,
265
+ lib/capistrano-exts/receipts/contao.rb,
266
+ lib/capistrano-exts/receipts/servers/web_server.rb,
267
+ lib/capistrano-exts/templates/multistage.rb: MISC: Calling the latest_relase
268
+ this early (deploy:server:prepare) breaks because capistrano is trying to run
269
+ ls -x on the server.
270
+
271
+ * lib/capistrano-exts/version.rb: Bump to version 1.1.4
272
+
273
+ * capistrano-exts.gemspec, spec/spec_helper.rb, spec/support/factories.rb:
274
+ MISC: Fix the homepage url and remove some non-used developement gems.
275
+
276
+ * lib/capistrano-exts/version.rb: Bump to version 1.1.3
277
+
278
+ * lib/capistrano-exts/receipts/contao.rb,
279
+ lib/capistrano-exts/templates/multistage.rb: MISC: Assign a default for
280
+ public_path.
281
+
282
+ * examples/php_fpm/deploy/development.rb,
283
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
284
+ examples/rails_passenger/deploy/development.rb,
285
+ examples/rails_passenger/deploy/production.rb,
286
+ examples/rails_passenger/deploy/staging.rb,
287
+ examples/rails_reverse_proxy/deploy/development.rb,
288
+ examples/rails_reverse_proxy/deploy/production.rb,
289
+ examples/rails_reverse_proxy/deploy/staging.rb,
290
+ lib/capistrano-exts/receipts/contao.rb,
291
+ lib/capistrano-exts/templates/multistage.rb: MISC: Fix a few minor issues and
292
+ add some more comments in the config file.
293
+
294
+ * lib/capistrano-exts/version.rb: Bump to version 1.1.2
295
+
296
+ * lib/capistrano-exts/templates/multistage.rb: MISC: Rename nasreddine.com to
297
+ example.com in the server-details in the template.
298
+
299
+ * lib/capistrano-exts/version.rb: Bump to version 1.1.1
300
+
301
+ * lib/capistrano-exts/receipts/multistage.rb: MISC: Print some info while
302
+ preparing the multistage.
303
+
304
+ * lib/capistrano-exts/version.rb: Bump to version 1.1.0
305
+
306
+ * lib/capistrano-exts/receipts/contao.rb,
307
+ lib/capistrano-exts/receipts/mysql.rb: MISC: Add some rollback callbacks.
308
+
309
+ * examples/php_fpm/deploy/development.rb,
310
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
311
+ examples/rails_passenger/deploy/development.rb,
312
+ examples/rails_passenger/deploy/production.rb,
313
+ examples/rails_passenger/deploy/staging.rb,
314
+ examples/rails_reverse_proxy/deploy/development.rb,
315
+ examples/rails_reverse_proxy/deploy/production.rb,
316
+ examples/rails_reverse_proxy/deploy/staging.rb,
317
+ lib/capistrano-exts/receipts/contao.rb,
318
+ lib/capistrano-exts/receipts/deploy.rb,
319
+ lib/capistrano-exts/receipts/functions.rb,
320
+ lib/capistrano-exts/receipts/mysql.rb,
321
+ lib/capistrano-exts/templates/multistage.rb: MISC: Add some comments
322
+ explaining the configurations.
323
+
324
+ * README.md: MISC: Wrong gem name.
325
+
326
+ * lib/capistrano-exts/receipts/mysql.rb: MISC: Make sure we have parsed the
327
+ credentials, if the regex does not match we would have gotten a few
328
+ surprises.
329
+
330
+ * lib/capistrano-exts/receipts/functions.rb,
331
+ lib/capistrano-exts/receipts/mysql.rb,
332
+ lib/capistrano-exts/receipts/servers.rb,
333
+ lib/capistrano-exts/receipts/servers/db_server.rb,
334
+ lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Fix a few minor
335
+ issues, it has been tested now.
336
+
337
+ * lib/capistrano-exts/receipts/contao.rb,
338
+ lib/capistrano-exts/receipts/mysql.rb: MISC: Create the database once the
339
+ server is setup and not after contao:setup
340
+
341
+ * lib/capistrano-exts/receipts/functions.rb,
342
+ lib/capistrano-exts/receipts/mysql.rb,
343
+ lib/capistrano-exts/receipts/servers/db_server.rb,
344
+ lib/capistrano-exts/receipts/servers/web_server.rb: MISC: Create the database
345
+ user and add it to the mysql_credentials_file.
346
+
347
+ * examples/php_fpm/deploy/development.rb,
348
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
349
+ examples/rails_passenger/deploy/development.rb,
350
+ examples/rails_passenger/deploy/production.rb,
351
+ examples/rails_passenger/deploy/staging.rb,
352
+ examples/rails_reverse_proxy/deploy/development.rb,
353
+ examples/rails_reverse_proxy/deploy/production.rb,
354
+ examples/rails_reverse_proxy/deploy/staging.rb,
355
+ lib/capistrano-exts/servers/web_server.rb,
356
+ lib/capistrano-exts/servers/web_server/nginx.rb,
357
+ lib/capistrano-exts/templates/multistage.rb, spec/requests/nginx_spec.rb,
358
+ spec/servers/web_server/nginx_spec.rb: MISC: Rename rails_reverse_proxy to
359
+ reverse_proxy.
360
+
361
+ * lib/capistrano-exts/version.rb: Bump to version 1.0.1
362
+
363
+ * examples/php_fpm/deploy/development.rb,
364
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
365
+ examples/rails_passenger/deploy/development.rb,
366
+ examples/rails_passenger/deploy/production.rb,
367
+ examples/rails_passenger/deploy/staging.rb,
368
+ examples/rails_reverse_proxy/deploy/development.rb,
369
+ examples/rails_reverse_proxy/deploy/production.rb,
370
+ examples/rails_reverse_proxy/deploy/staging.rb,
371
+ lib/capistrano-exts/servers/web_server.rb,
372
+ lib/capistrano-exts/servers/web_server/nginx.rb,
373
+ lib/capistrano-exts/templates/multistage.rb,
374
+ .../templates/web_servers/nginx.conf.erb, spec/requests/nginx_spec.rb,
375
+ spec/servers/web_server/nginx_spec.rb: MISC: Write all tests for nginx and
376
+ fix a minor issue with reverse_proxy_socket
377
+
378
+ * .travis.yml, capistrano-exts.gemspec: MISC: Remove jruby testing for the
379
+ moment, I should look at it later.
380
+
381
+ * .travis.yml: MISC: Let's try without bundle exec.
382
+
383
+ * .travis.yml: MISC: Let bundle install everything.
384
+
385
+ * Gemfile, capistrano-exts.gemspec: MISC: Disable growl_notify because it
386
+ only works on Mac, keep it commented as a guideline.
387
+
388
+ * .travis.yml, Gemfile, capistrano-exts.gemspec: MISC: Make sure rspec is
389
+ included in test group.
390
+
391
+ * .travis.yml: MISC: Still trying to fix travis-ci
392
+
393
+ * .../receipts/servers/web_server/apache.rb,
394
+ .../receipts/servers/web_server/nginx.rb: MISC: Use fetch()
395
+
396
+ * lib/capistrano-exts/receipts/contao.rb,
397
+ lib/capistrano-exts/receipts/deploy.rb: MISC: Move contao:fix_permissions to
398
+ deploy:fix_permissions, and chmod g+w if group_writable, by default true.
399
+
400
+ * .travis.yml: MISC: Don't install developement nor staging groups.
401
+
402
+ * README.md, examples/php_fpm/deploy.rb, examples/rails_passenger/deploy.rb,
403
+ examples/rails_reverse_proxy/deploy.rb, lib/capistrano-exts/receipts/base.rb,
404
+ lib/capistrano-exts/receipts/contao.rb,
405
+ lib/capistrano-exts/receipts/deploy.rb, lib/capistrano-exts/receipts/git.rb,
406
+ lib/capistrano-exts/receipts/mysql.rb, lib/capistrano-exts/receipts/rails.rb,
407
+ lib/capistrano-exts/receipts/servers.rb,
408
+ lib/capistrano-exts/templates/multistage.rb: MISC: Replace base with deploy.
409
+
410
+ * README.md: MISC: A new line is needed before block codes.
411
+
412
+ * MIT-LICENSE, README.md: MISC: Add a very basic README and a License.
413
+
414
+ * examples/rails_passenger/deploy.rb, examples/rails_reverse_proxy/deploy.rb,
415
+ lib/capistrano-exts/receipts/rails.rb: MISC: Rails applications should
416
+ require rails and not contao.
417
+
418
+ 2011-09-02 Wael Nasreddine <wael.nasreddine@gmail.com>
419
+
420
+ * .travis.yml: MISC: Add travis-ci config file.
421
+
422
+ * examples/php_fpm/deploy.rb, examples/php_fpm/deploy/development.rb,
423
+ examples/php_fpm/deploy/production.rb, examples/php_fpm/deploy/staging.rb,
424
+ examples/rails_passenger/deploy.rb,
425
+ examples/rails_passenger/deploy/development.rb,
426
+ examples/rails_passenger/deploy/production.rb,
427
+ examples/rails_passenger/deploy/staging.rb,
428
+ examples/rails_reverse_proxy/deploy.rb,
429
+ examples/rails_reverse_proxy/deploy/development.rb,
430
+ examples/rails_reverse_proxy/deploy/production.rb,
431
+ examples/rails_reverse_proxy/deploy/staging.rb,
432
+ lib/capistrano-exts/templates/multistage.rb: MISC: Add some examples.
433
+
434
+ * lib/capistrano-exts/templates/multistage.rb: MISC: Fix a typo in the
435
+ template file.
436
+
437
+ * spec/requests/nginx_spec.rb, spec/servers/web_server/nginx_spec.rb: MISC:
438
+ Fix the tests.
439
+
440
+ * Gemfile, Guardfile, capistrano-extensions.gemspec, capistrano-exts.gemspec,
441
+ lib/capistrano-extensions.rb, lib/capistrano-extensions/core_ext.rb,
442
+ .../core_ext/string/filters.rb, lib/capistrano-extensions/receipts.rb,
443
+ lib/capistrano-extensions/receipts/base.rb,
444
+ lib/capistrano-extensions/receipts/contao.rb,
445
+ lib/capistrano-extensions/receipts/functions.rb,
446
+ lib/capistrano-extensions/receipts/git.rb,
447
+ lib/capistrano-extensions/receipts/god.rb,
448
+ lib/capistrano-extensions/receipts/multistage.rb,
449
+ lib/capistrano-extensions/receipts/mysql.rb,
450
+ lib/capistrano-extensions/receipts/rails.rb,
451
+ lib/capistrano-extensions/receipts/servers.rb,
452
+ .../receipts/servers/db_server.rb, .../receipts/servers/web_server.rb,
453
+ lib/capistrano-extensions/receipts/unicorn.rb,
454
+ lib/capistrano-extensions/servers/utils/erb.rb,
455
+ .../servers/utils/variables.rb,
456
+ lib/capistrano-extensions/servers/web_server.rb,
457
+ .../servers/web_server/nginx.rb,
458
+ lib/capistrano-extensions/templates/multistage.rb,
459
+ .../templates/web_servers/nginx.conf.erb,
460
+ lib/capistrano-extensions/version.rb, lib/capistrano-exts.rb,
461
+ lib/capistrano-exts/core_ext.rb,
462
+ lib/capistrano-exts/core_ext/string/filters.rb,
463
+ lib/capistrano-exts/receipts.rb, lib/capistrano-exts/receipts/base.rb,
464
+ lib/capistrano-exts/receipts/contao.rb,
465
+ lib/capistrano-exts/receipts/functions.rb,
466
+ lib/capistrano-exts/receipts/git.rb, lib/capistrano-exts/receipts/god.rb,
467
+ lib/capistrano-exts/receipts/multistage.rb,
468
+ lib/capistrano-exts/receipts/mysql.rb, lib/capistrano-exts/receipts/rails.rb,
469
+ lib/capistrano-exts/receipts/servers.rb,
470
+ lib/capistrano-exts/receipts/servers/db_server.rb,
471
+ lib/capistrano-exts/receipts/servers/web_server.rb,
472
+ .../receipts/servers/web_server/apache.rb,
473
+ .../receipts/servers/web_server/nginx.rb,
474
+ lib/capistrano-exts/receipts/unicorn.rb,
475
+ lib/capistrano-exts/servers/utils/erb.rb,
476
+ lib/capistrano-exts/servers/utils/variables.rb,
477
+ lib/capistrano-exts/servers/web_server.rb,
478
+ lib/capistrano-exts/servers/web_server/nginx.rb,
479
+ lib/capistrano-exts/templates/multistage.rb,
480
+ .../templates/web_servers/nginx.conf.erb, lib/capistrano-exts/version.rb,
481
+ spec/spec_helper.rb: MISC: Rename the extension to capistrano-exts as an
482
+ existing gem exists with that name and add some useful tasks for nginx and
483
+ apache.
484
+
485
+ * lib/capistrano-extensions/receipts/multistage.rb,
486
+ lib/capistrano-extensions/receipts/mysql.rb,
487
+ .../receipts/servers/web_server.rb,
488
+ lib/capistrano-extensions/servers/web_server.rb,
489
+ lib/capistrano-extensions/templates/multistage.rb,
490
+ .../templates/web_servers/nginx.conf.erb: MISC: MySQL needs a host and fix a
491
+ few minor issues.
492
+
493
+ * lib/capistrano-extensions.rb, lib/capistrano-extensions/receipts/contao.rb,
494
+ lib/capistrano-extensions/receipts/functions.rb,
495
+ lib/capistrano-extensions/receipts/mysql.rb,
496
+ lib/capistrano-extensions/receipts/servers.rb,
497
+ .../receipts/servers/db_server.rb, .../receipts/servers/web_server.rb,
498
+ lib/capistrano-extensions/servers/web_server.rb,
499
+ .../servers/web_server/nginx.rb: MISC: Web configuration and passwords are
500
+ complete..
501
+
502
+ * lib/capistrano-extensions/version.rb: MISC: Define Version::ARRAY in case
503
+ we use it later.
504
+
505
+ * capistrano-extensions.gemspec, lib/capistrano-extensions.rb,
506
+ lib/capistrano-extensions/core_ext.rb, .../core_ext/string/filters.rb,
507
+ lib/capistrano-extensions/receipts.rb,
508
+ lib/capistrano-extensions/receipts/base.rb,
509
+ lib/capistrano-extensions/receipts/contao.rb,
510
+ lib/capistrano-extensions/receipts/functions.rb,
511
+ lib/capistrano-extensions/receipts/git.rb,
512
+ lib/capistrano-extensions/receipts/god.rb,
513
+ lib/capistrano-extensions/receipts/mysql.rb,
514
+ .../receipts/servers/web_server.rb,
515
+ lib/capistrano-extensions/servers/utils/erb.rb,
516
+ .../servers/utils/variables.rb,
517
+ lib/capistrano-extensions/servers/web_server.rb,
518
+ .../servers/web_server/nginx.rb, lib/capistrano-extensions/version.rb,
519
+ spec/spec_helper.rb: MISC: Make sure we run in a specific role, don't let
520
+ active_support overwrite capture and move the functions to functions.rb
521
+
522
+ * lib/capistrano-extensions/receipts/base.rb,
523
+ lib/capistrano-extensions/receipts/contao.rb,
524
+ lib/capistrano-extensions/receipts/rails.rb: MISC: Replace blank?() and
525
+ present?() with the one given by active_support's core_ext.
526
+
527
+ * capistrano-extensions.gemspec: MISC: Change the summary.
528
+
529
+ * lib/capistrano-extensions/receipts/multistage.rb: MISC: Bring home all of
530
+ capistrano-ext features.
531
+
532
+ * lib/capistrano-extensions/receipts.rb, .../receipts/configurations.rb,
533
+ lib/capistrano-extensions/receipts/multistage.rb: MISC: Include most of
534
+ capistrano-ext functionalities.
535
+
536
+ * Gemfile, Guardfile, capistrano-extensions.gemspec,
537
+ capistrano-technogate.gemspec, lib/capistrano-extensions.rb,
538
+ lib/capistrano-extensions/core_ext.rb, .../core_ext/string/filters.rb,
539
+ lib/capistrano-extensions/receipts.rb,
540
+ lib/capistrano-extensions/receipts/base.rb, .../receipts/configurations.rb,
541
+ lib/capistrano-extensions/receipts/contao.rb,
542
+ lib/capistrano-extensions/receipts/god.rb,
543
+ lib/capistrano-extensions/receipts/mysql.rb,
544
+ lib/capistrano-extensions/receipts/rails.rb,
545
+ lib/capistrano-extensions/receipts/servers.rb,
546
+ .../receipts/servers/db_server.rb, .../receipts/servers/web_server.rb,
547
+ lib/capistrano-extensions/receipts/unicorn.rb,
548
+ lib/capistrano-extensions/servers/utils/erb.rb,
549
+ .../servers/utils/variables.rb,
550
+ lib/capistrano-extensions/servers/web_server.rb,
551
+ .../servers/web_server/nginx.rb, .../templates/web_servers/nginx.conf.erb,
552
+ lib/capistrano-extensions/version.rb, lib/capistrano-technogate.rb,
553
+ lib/capistrano-technogate/core_ext.rb, .../core_ext/string/filters.rb,
554
+ lib/capistrano-technogate/receipts/base.rb, .../receipts/configurations.rb,
555
+ lib/capistrano-technogate/receipts/contao.rb,
556
+ lib/capistrano-technogate/receipts/god.rb,
557
+ lib/capistrano-technogate/receipts/mysql.rb,
558
+ lib/capistrano-technogate/receipts/rails.rb,
559
+ lib/capistrano-technogate/receipts/servers.rb,
560
+ .../receipts/servers/db_server.rb, .../receipts/servers/web_server.rb,
561
+ lib/capistrano-technogate/receipts/unicorn.rb,
562
+ lib/capistrano-technogate/servers/utils/erb.rb,
563
+ .../servers/utils/variables.rb,
564
+ lib/capistrano-technogate/servers/web_server.rb,
565
+ .../servers/web_server/nginx.rb, .../templates/web_servers/nginx.conf.erb,
566
+ lib/capistrano-technogate/version.rb, spec/spec_helper.rb: MISC: Rename this
567
+ project to capistrano-extensions.
568
+
569
+ * capistrano-technogate.gemspec, lib/capistrano-technogate/receipts/base.rb,
570
+ lib/capistrano-technogate/receipts/servers.rb,
571
+ .../receipts/servers/db_server.rb, .../receipts/servers/web_server.rb,
572
+ .../templates/web_servers/nginx.conf.erb,
573
+ spec/servers/web_server/nginx_spec.rb: MISC: deploy:server are still in
574
+ progress.
575
+
576
+ 2011-09-01 Wael Nasreddine <wael.nasreddine@gmail.com>
577
+
578
+ * capistrano-technogate.gemspec, lib/capistrano-technogate.rb,
579
+ lib/capistrano-technogate/core_ext.rb,
580
+ lib/capistrano-technogate/core_ext/README.rdoc,
581
+ lib/capistrano-technogate/core_ext/object/blank.rb,
582
+ lib/capistrano-technogate/core_ext/object/try.rb,
583
+ .../core_ext/string/encoding.rb, .../core_ext/string/filters.rb: MISC: Why
584
+ not use active_support/core_ext ?
585
+
586
+ * lib/capistrano-technogate/receipts/servers.rb,
587
+ .../receipts/servers/db_server.rb, .../receipts/servers/web_server.rb: MISC:
588
+ Add tasks for server preparations, tasks need to be implemented.
589
+
590
+ * spec/rendered_templates/nginx_php_fpm.conf: MISC: Fix the test.
591
+
592
+ * .../core_ext/string/filters.rb,
593
+ lib/capistrano-technogate/servers/utils/erb.rb,
594
+ lib/capistrano-technogate/servers/web_server.rb,
595
+ .../templates/web_servers/nginx.conf.erb,
596
+ spec/rendered_templates/nginx_php_fpm.conf: MISC: Beautify the output a
597
+ little bit.
598
+
599
+ * lib/capistrano-technogate/servers/web_server.rb,
600
+ spec/rendered_templates/nginx_php_fpm.conf, spec/requests/nginx_spec.rb,
601
+ spec/servers/web_server/nginx_spec.rb, spec/spec_helper.rb: MISC: Complete
602
+ the nginx template for php_fpm.
603
+
604
+ * lib/capistrano-technogate/servers/web_server.rb,
605
+ spec/servers/web_server/nginx_spec.rb: MISC: Finish php_fpm functionality.
606
+
607
+ * lib/capistrano-technogate/servers/utils/erb.rb,
608
+ lib/capistrano-technogate/servers/web_server.rb,
609
+ .../templates/web_servers/nginx.conf.erb,
610
+ spec/servers/web_server/nginx_spec.rb: MISC: A few enhancements.
611
+
612
+ * Guardfile, capistrano-technogate.gemspec: MISC: Enable guard for bundler
613
+ and rspec
614
+
615
+ * .../servers/utils/variables.rb,
616
+ lib/capistrano-technogate/servers/web_server.rb,
617
+ .../servers/web_server/common.rb, .../servers/web_server/nginx.rb: MISC:
618
+ Replace the template variables by a meta-programming for easier maintenance.
619
+
620
+ * Rakefile, capistrano-technogate.gemspec, lib/capistrano-technogate.rb,
621
+ lib/capistrano-technogate/core_ext.rb,
622
+ lib/capistrano-technogate/core_ext/README.rdoc,
623
+ lib/capistrano-technogate/core_ext/object/blank.rb,
624
+ lib/capistrano-technogate/core_ext/object/try.rb,
625
+ .../core_ext/string/encoding.rb, lib/capistrano-technogate/receipts/base.rb,
626
+ .../receipts/configurations.rb, lib/capistrano-technogate/receipts/contao.rb,
627
+ lib/capistrano-technogate/receipts/god.rb,
628
+ lib/capistrano-technogate/receipts/mysql.rb,
629
+ lib/capistrano-technogate/receipts/rails.rb,
630
+ lib/capistrano-technogate/receipts/servers.rb,
631
+ lib/capistrano-technogate/receipts/unicorn.rb,
632
+ lib/capistrano-technogate/servers/utils/erb.rb,
633
+ .../servers/web_server/common.rb, .../servers/web_server/nginx.rb,
634
+ .../templates/web_servers/nginx.conf.erb,
635
+ lib/capistrano-technogate/version.rb, lib/capistrano/technogate/base.rb,
636
+ lib/capistrano/technogate/configurations.rb,
637
+ lib/capistrano/technogate/contao.rb, lib/capistrano/technogate/god.rb,
638
+ lib/capistrano/technogate/mysql.rb, lib/capistrano/technogate/rails.rb,
639
+ lib/capistrano/technogate/unicorn.rb, lib/capistrano/technogate/version.rb,
640
+ spec/servers/web_server/nginx_spec.rb, spec/spec_helper.rb,
641
+ spec/support/factories.rb: MISC: Major redesign.
642
+
643
+ 2011-08-31 Wael Nasreddine <wael.nasreddine@gmail.com>
644
+
645
+ * lib/capistrano/technogate/base.rb,
646
+ lib/capistrano/technogate/configurations.rb,
647
+ lib/capistrano/technogate/mysql.rb: MISC: Add a function parsing mysql root
648
+ credentials.
649
+
650
+ * lib/capistrano/technogate/version.rb: MISC: Bump to version 0.1.1
651
+
652
+ * lib/capistrano/technogate/rails.rb: MISC: Before running
653
+ deploy:assets:precompile make sure bundle:install has ran.
654
+
655
+ * lib/capistrano/technogate/version.rb: MISC: Bump to version 0.1.0
656
+
657
+ * lib/capistrano/technogate/configurations.rb,
658
+ lib/capistrano/technogate/contao.rb, lib/capistrano/technogate/mysql.rb,
659
+ lib/capistrano/technogate/rails.rb: MISC: Move MySQL tasks into it's own
660
+ file.
661
+
662
+ * lib/capistrano/technogate/base.rb, lib/capistrano/technogate/contao.rb,
663
+ lib/capistrano/technogate/version.rb: MISC: If contao is included, overwrite
664
+ deploy:finalize_update.
665
+
666
+ * capistrano-technogate.gemspec: MISC: Add github projet page as the home
667
+ page.
668
+
669
+ * ..gemspec, .gitignore, Gemfile, Rakefile, base.rb,
670
+ capistrano-technogate.gemspec, configurations.rb, contao.rb, god.rb,
671
+ lib/capistrano/technogate/base.rb,
672
+ lib/capistrano/technogate/configurations.rb,
673
+ lib/capistrano/technogate/contao.rb, lib/capistrano/technogate/god.rb,
674
+ lib/capistrano/technogate/mysql.rb, lib/capistrano/technogate/rails.rb,
675
+ lib/capistrano/technogate/unicorn.rb, lib/capistrano/technogate/version.rb,
676
+ mysql.rb, rails.rb, unicorn.rb: Initial gem.
677
+
678
+ * base.rb, configurations.rb, mysql.rb: MISC: Import modifications from my
679
+ latest projects.
680
+
681
+ 2011-08-25 Wael Nasreddine <wael.nasreddine@gmail.com>
682
+
683
+ * contao.rb: Commit contao.rb
684
+
685
+ * base.rb, configurations.rb, god.rb, rails.rb, unicorn.rb: MISC: Adjust the
686
+ receipts.
687
+
688
+ * base.rb, configurations.rb, god.rb, rails.rb: Initial Import.
data/README.md CHANGED
@@ -1,12 +1,11 @@
1
- Capistrano Extensions [![Build Status](http://travis-ci.org/TechnoGate/capistrano-exts.png)](http://travis-ci.org/TechnoGate/capistrano-exts)
2
- =====
3
- This gem provides some useful capistrano tasks, for preparing the server,
4
- the database and the application without ever SSH'ing to the destination server,
5
- it also provides multistage functionality just like [capistano-ext](https://github.com/capistrano/capistrano-ext)
6
- gem, in fact the included multistage file is a modified version of capistrano-ext
1
+ # Capistrano Extensions [![Build Status](http://travis-ci.org/TechnoGate/capistrano-exts.png)](http://travis-ci.org/TechnoGate/capistrano-exts)
7
2
 
8
- Installation
9
- ------------
3
+ capistrano-exts is a set of helper tasks to help with the initial server
4
+ configuration and application provisioning. Things like creating the directory
5
+ structure, setting up that database, and other one-off you might find yourself
6
+ doing by hand far too often.
7
+
8
+ # Installation
10
9
 
11
10
  Install the gem
12
11
 
@@ -17,12 +16,13 @@ gem install capistrano-exts
17
16
  or add it to your Gemfile
18
17
 
19
18
  ```ruby
20
- gem 'capistrano-exts', '>=1.8.1'
19
+ gem 'capistrano-exts', '>=1.8.2', :require => false
21
20
  ```
22
21
 
23
- Setup
24
- -----
25
- First make sure you have capified your project, if not then run the following command on the root of your project:
22
+ # Setup
23
+
24
+ First make sure you have capified your project, if not then run the following
25
+ command on the root of your project:
26
26
 
27
27
  ```bash
28
28
  $ capify .
@@ -47,26 +47,140 @@ Then run the command
47
47
  $ cap multistage:setup
48
48
  ```
49
49
 
50
- Then edit the files found at __config/deploy/*.rb__, that's it you're ready..
50
+ This command will create default configuration files in the folder
51
+ __config/deploy__, one configuration file for each stage you defined above,
52
+ before deploying the project to a stage you should carefully edit the
53
+ configuration files.
54
+
55
+ # Usage
56
+
57
+ ## Server preparation
58
+
59
+ If you have edited the config files, the mysql and web server section, then
60
+ you're ready to prepare the server using the command:
61
+
62
+ ```bash
63
+ $ cap [stage] deploy:server:setup
64
+ ```
65
+
66
+ You'd have to prepare the project's folder with the command:
67
+
68
+ ```bash
69
+ $ cap [stage] deploy:setup
70
+ ```
71
+
72
+ ## Deployment
73
+
74
+ The project can be deployed with the plain old capistrano command:
75
+
76
+ ```bash
77
+ $ cap [stage] deploy
78
+ ```
79
+
80
+ ## Post deployment
81
+
82
+ Capistrano exts provide several tasks to help with your everyday development,
83
+ like importing/exporting the database, importing/exporting the contents and
84
+ sync two stages, sync is of course one way.
85
+
86
+ ### Importing the database
87
+
88
+ Assuming you're developing locally, for example using a CMS, when the project
89
+ is ready for deployment, all you have to do is
90
+
91
+ 1. Dump the database locally, for this example, I'll assume
92
+ **/tmp/project\_db\_dump.sql** is the dump of your project's database
93
+ 2. Import the database into the target server using the following command
94
+
95
+ ```bash
96
+ $ cap [stage] mysql:import_db_dump /tmp/project_db_dump.sql
97
+ ```
98
+
99
+ ### Importing the contents
51
100
 
52
- Usage
53
- -----
101
+ You can also import the contents from your local development (or a tarball
102
+ from another server), using the command
54
103
 
55
- The server can be prepared by running:
104
+ ```bash
105
+ $ cap [stage] contents:import /tmp/contents.tar.gz
106
+ ```
107
+
108
+ N.B: The tarball will be extracted in **shared/shared\_contents** so you
109
+ should make sure you have the
110
+ [**contents\_folder**](https://github.com/TechnoGate/capistrano-exts/blob/master/lib/capistrano-exts/templates/multistage.rb#L54)
111
+ in the configuration file of the stage.
112
+
113
+
114
+ ### Exporting the database
115
+
116
+ If you want to export the database you can simply run
117
+
118
+ ```bash
119
+ $ cap [stage] mysql:export_db_dump [sql_dump_file]
120
+ ```
121
+
122
+ The **sql\_dump\_file** is of course optional, if not given a random file in
123
+ /tmp will be created.
124
+
125
+ ### Exporting the contents
126
+
127
+ If you want to export the contents you can simply run
128
+
129
+ ```bash
130
+ $ cap [stage] mysql:export_db_dump [contents_file]
131
+ ```
132
+
133
+ The **contents\_file** is of course optional, if not given a random file in
134
+ /tmp will be created.
135
+
136
+ ### Sync
137
+
138
+ Capistrano exts has special tasks defined under the **multistage** namespace
139
+ for syncing one stage with another, and the tasks are generate on runtime
140
+ depending on the stages you have defined, for example, if you have a staging
141
+ and a production stage, you can develop your application on the staging area
142
+ and then sync one or both of the database and contents of the production stage
143
+ with those of staging like so:
144
+
145
+ Sync the database only
56
146
 
57
147
  ```bash
58
- $ cap deploy:server:setup deploy:setup
148
+ $ cap multistage:sync_production_database_with_staging
59
149
  ```
60
150
 
61
- Deploy with
151
+ Sync the contents only
62
152
 
63
153
  ```bash
64
- $ cap deploy
154
+ $ cap multistage:sync_production_contents_with_staging
65
155
  ```
66
156
 
67
- That's pretty much it
157
+ Sync both
158
+
159
+ ```bash
160
+ $ cap multistage:sync_production_with_staging
161
+ ```
162
+
163
+ # License
164
+
165
+ ## This code is free to use under the terms of the MIT license.
166
+
167
+ Copyright (c) 2011 Wael Nasreddine <wael.nasreddine@gmail.com>
168
+
169
+ Permission is hereby granted, free of charge, to any person obtaining
170
+ a copy of this software and associated documentation files (the
171
+ "Software"), to deal in the Software without restriction, including
172
+ without limitation the rights to use, copy, modify, merge, publish,
173
+ distribute, sublicense, and/or sell copies of the Software, and to
174
+ permit persons to whom the Software is furnished to do so, subject to
175
+ the following conditions:
68
176
 
177
+ The above copyright notice and this permission notice shall be
178
+ included in all copies or substantial portions of the Software.
69
179
 
70
- License
71
- -------
72
- This code is free to use under the terms of the MIT license.
180
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
181
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
182
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
183
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
184
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
185
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
186
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -8,8 +8,13 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Wael Nasreddine"]
9
9
  s.email = ["wael.nasreddine@gmail.com"]
10
10
  s.homepage = "https://github.com/TechnoGate/capistrano-exts"
11
- s.summary = %q{Handy extensions for Capistrano}
12
- s.description = s.summary
11
+ s.summary = %q{Set of helper tasks to help with the initial server configuration and application provisioning.}
12
+ s.description = <<-EOD
13
+ capistrano-exts is a set of helper tasks to help with the initial server
14
+ configuration and application provisioning. Things like creating the directory
15
+ structure, setting up that database, and other one-off you might find yourself
16
+ doing by hand far too often.
17
+ EOD
13
18
 
14
19
  s.rubyforge_project = "capistrano-exts"
15
20
 
@@ -29,6 +29,7 @@ Capistrano::Configuration.instance(:must_exist).load do
29
29
  #{try_sudo} mkdir -p #{shared_path}/config
30
30
  CMD
31
31
 
32
+ # TODO: The deny access should follow denied_access config
32
33
  deny_htaccess = "order deny,allow\n"
33
34
  deny_htaccess << "deny from all"
34
35
 
@@ -37,26 +38,30 @@ Capistrano::Configuration.instance(:must_exist).load do
37
38
 
38
39
  desc "[internal] Setup contao's localconfig"
39
40
  task :setup_localconfig, :roles => :app, :except => { :no_release => true } do
40
- on_rollback { run "rm -f #{shared_path}/config/localconfig.php" }
41
+ unless remote_file_exists?("#{fetch :shared_path}/config/localconfig.php")
42
+ on_rollback { run "rm -f #{shared_path}/config/localconfig.php" }
41
43
 
42
- localconfig = File.read("public/system/config/localconfig.php.sample")
43
- mysql_credentials = fetch :mysql_credentials
44
- mysql_db_name = fetch :mysql_db_name
44
+ localconfig = File.read("public/system/config/localconfig.php.sample")
45
+ mysql_credentials = fetch :mysql_credentials
46
+ mysql_db_name = fetch :mysql_db_name
45
47
 
46
- # localconfig
47
- if mysql_credentials.blank?
48
- puts "WARNING: The mysql credential file can't be found, localconfig has just been copied from the sample file"
49
- end
48
+ # localconfig
49
+ if mysql_credentials.blank?
50
+ puts "WARNING: The mysql credential file can't be found, localconfig has just been copied from the sample file"
51
+ end
50
52
 
51
- # Add MySQL credentials
52
- unless localconfig.blank? or mysql_credentials.blank?
53
- localconfig.gsub!(/#DB_HOST#/, mysql_credentials[:host])
54
- localconfig.gsub!(/#DB_USER#/, mysql_credentials[:user])
55
- localconfig.gsub!(/#DB_PASS#/, mysql_credentials[:pass])
56
- localconfig.gsub!(/#DB_NAME#/, mysql_db_name)
57
- end
53
+ # Add MySQL credentials
54
+ unless localconfig.blank? or mysql_credentials.blank?
55
+ localconfig.gsub!(/#DB_HOST#/, mysql_credentials[:host])
56
+ localconfig.gsub!(/#DB_USER#/, mysql_credentials[:user])
57
+ localconfig.gsub!(/#DB_PASS#/, mysql_credentials[:pass])
58
+ localconfig.gsub!(/#DB_NAME#/, mysql_db_name)
59
+ end
58
60
 
59
- put localconfig, "#{fetch :shared_path}/config/localconfig.php"
61
+ put localconfig, "#{fetch :shared_path}/config/localconfig.php"
62
+ else
63
+ puts "WARNING: The file '#{fetch :shared_path}/config/localconfig.php' already exists, not overwriting."
64
+ end
60
65
  end
61
66
 
62
67
  desc "[internal] Setup .htaccess"
@@ -115,10 +115,7 @@ Capistrano::Configuration.instance(:must_exist).load do
115
115
  on_rollback { run "rm -f #{random_file}" }
116
116
 
117
117
  # Ask for a confirmation
118
- response = ask("I am going to add/replace all the files in the contents folder of #{fetch :application} with the contents of #{import_filename_argv}, are you sure you would like to continue (Yes, [No], Abort)", default:'N')
119
- if response =~ /(no?)|(a(bort)?|\n)/i
120
- abort "Canceled by the user."
121
- end
118
+ ask_for_confirmation "I am going to add/replace all the files in the contents folder of #{fetch :application} with the contents of #{import_filename_argv}, are you sure you would like to continue (Yes, [No], Abort)", default:'N'
122
119
 
123
120
  # Transfer the SQL file to the server
124
121
  # TODO: Try upload(filename, remote_file_name) function instead
@@ -32,7 +32,7 @@ Capistrano::Configuration.instance(:must_exist).load do
32
32
  return newpass
33
33
  end
34
34
 
35
- def ask(what, options)
35
+ def ask(what, options = {})
36
36
  default = options[:default]
37
37
  validate = options[:validate] || /(y(es)?)|(no?)|(a(bort)?|\n)/i
38
38
  echo = (options[:echo].nil?) ? true : options[:echo]
@@ -79,4 +79,17 @@ Capistrano::Configuration.instance(:must_exist).load do
79
79
  def read(file)
80
80
  capture("cat #{file}")
81
81
  end
82
+
83
+ # ask_for_confirmation(what)
84
+ # This function asks the user for confirmation (confirm running the task)
85
+ # If the user answers no, then the task won't be executed.
86
+ def ask_for_confirmation(what, options = {})
87
+ unless exists?(:force) and fetch(:force) == true
88
+ # Ask for a confirmation
89
+ response = ask(what, options)
90
+ if response =~ /(no?)|(a(bort)?|\n)/i
91
+ abort "Canceled by the user."
92
+ end
93
+ end
94
+ end
82
95
  end
@@ -3,6 +3,7 @@
3
3
  # To allow configuration in either seperate files or in-line configurations
4
4
 
5
5
  require 'capistrano'
6
+ require 'capistrano-exts/receipts/functions'
6
7
  require 'fileutils'
7
8
 
8
9
  unless Capistrano::Configuration.respond_to?(:instance)
@@ -91,13 +92,10 @@ Capistrano::Configuration.instance.load do
91
92
  # Don't you just love metaprogramming? I know I fucking do!
92
93
  stages.each do |target_stage|
93
94
  stages.reject { |s| s == target_stage }.each do |source_stage|
94
- desc "Synchronise #{target_stage} with #{source_stage}"
95
- task "sync_#{target_stage}_with_#{source_stage}", :roles => :app, :except => { :no_release => true } do
95
+ desc "Synchronise #{target_stage}'s database with #{source_stage}"
96
+ task "sync_#{target_stage}_database_with_#{source_stage}", :roles => :db, :except => { :no_release => true } do
96
97
  # Ask for a confirmation
97
- response = ask("I am going to synchronise '#{target_stage}' with '#{source_stage}', it means I will overwrite both the database and the contents of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N')
98
- if response =~ /(no?)|(a(bort)?|\n)/i
99
- abort "Canceled by the user."
100
- end
98
+ ask_for_confirmation "I am going to synchronise '#{target_stage}' database with '#{source_stage}', it means I will overwrite the database of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'
101
99
 
102
100
  # Generate a random folder name
103
101
  random_folder = random_tmp_file
@@ -105,17 +103,48 @@ Capistrano::Configuration.instance.load do
105
103
  # Create the folder
106
104
  FileUtils.mkdir_p random_folder
107
105
 
108
- # Get the database/contents of the source
106
+ # Get the database of the source
109
107
  system "bundle exec cap #{source_stage} mysql:export_db_dump #{random_folder}/database.sql"
108
+
109
+ # Send it to the target
110
+ system "bundle exec cap -S force=true #{target_stage} mysql:import_db_dump #{random_folder}/database.sql"
111
+
112
+ # Remove the entire folder
113
+ FileUtils.rm_rf random_folder
114
+ end
115
+
116
+ desc "Synchronise #{target_stage}'s contents with #{source_stage}"
117
+ task "sync_#{target_stage}_contents_with_#{source_stage}", :roles => :app, :except => { :no_release => true } do
118
+ # Ask for a confirmation
119
+ ask_for_confirmation "I am going to synchronise '#{target_stage}' contents with '#{source_stage}', it means I will overwrite the contents of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'
120
+
121
+ # Generate a random folder name
122
+ random_folder = random_tmp_file
123
+
124
+ # Create the folder
125
+ FileUtils.mkdir_p random_folder
126
+
127
+ # Get the contents of the source
110
128
  system "bundle exec cap #{source_stage} contents:export #{random_folder}/contents.tar.gz"
111
129
 
112
130
  # Send them to the target
113
- system "echo 'yes' | bundle exec cap #{target_stage} mysql:import_db_dump #{random_folder}/database.sql"
114
- system "echo 'yes' | bundle exec cap #{target_stage} contents:import #{random_folder}/contents.tar.gz"
131
+ system "bundle exec cap -S force=true #{target_stage} contents:import #{random_folder}/contents.tar.gz"
115
132
 
116
133
  # Remove the entire folder
117
134
  FileUtils.rm_rf random_folder
118
135
  end
136
+
137
+ desc "Synchronise #{target_stage} with #{source_stage}"
138
+ task "sync_#{target_stage}_with_#{source_stage}", :roles => [:app, :db], :except => { :no_release => true } do
139
+ # Ask for a confirmation
140
+ ask_for_confirmation "I am going to synchronise '#{target_stage}' with '#{source_stage}', it means I will overwrite both the database and the contents of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'
141
+
142
+ # Synchronise the database
143
+ system "bundle exec cap -S force=true multistage:sync_#{target_stage}_database_with_#{source_stage}"
144
+
145
+ # Synchronise the contents
146
+ system "bundle exec cap -S force=true multistage:sync_#{target_stage}_contents_with_#{source_stage}"
147
+ end
119
148
  end
120
149
  end
121
150
  end
@@ -175,10 +175,7 @@ Capistrano::Configuration.instance(:must_exist).load do
175
175
 
176
176
  if mysql_credentials.present?
177
177
  # Ask for a confirmation
178
- response = ask("I am going to replace the database of #{fetch :application} with the contents of #{import_filename_argv}, are you sure you would like to continue (Yes, [No], Abort)", default:'N')
179
- if response =~ /(no?)|(a(bort)?|\n)/i
180
- abort "Canceled by the user."
181
- end
178
+ ask_for_confirmation "I am going to replace the database of #{fetch :application} with the contents of #{import_filename_argv}, are you sure you would like to continue (Yes, [No], Abort)", default:'N'
182
179
 
183
180
  # Transfer the SQL file to the server
184
181
  # TODO: Try upload(filename, remote_file_name) function instead
@@ -3,10 +3,10 @@ module Capistrano
3
3
  module Version #:nodoc:
4
4
  MAJOR = 1
5
5
  MINOR = 8
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  ARRAY = [MAJOR, MINOR, TINY]
9
9
  STRING = ARRAY.join(".")
10
10
  end
11
11
  end
12
- end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-exts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-08 00:00:00.000000000 Z
12
+ date: 2011-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2160876540 !ruby/object:Gem::Requirement
16
+ requirement: &2157047840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160876540
24
+ version_requirements: *2157047840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &2160876040 !ruby/object:Gem::Requirement
27
+ requirement: &2157047340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160876040
35
+ version_requirements: *2157047340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &2160875580 !ruby/object:Gem::Requirement
38
+ requirement: &2157046880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2160875580
46
+ version_requirements: *2157046880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &2160875120 !ruby/object:Gem::Requirement
49
+ requirement: &2157046420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.6.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2160875120
57
+ version_requirements: *2157046420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-bundler
60
- requirement: &2160874660 !ruby/object:Gem::Requirement
60
+ requirement: &2152964960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.1.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2160874660
68
+ version_requirements: *2152964960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &2160874200 !ruby/object:Gem::Requirement
71
+ requirement: &2152961660 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2160874200
79
+ version_requirements: *2152961660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2160873740 !ruby/object:Gem::Requirement
82
+ requirement: &2152959180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,8 +87,17 @@ dependencies:
87
87
  version: 2.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2160873740
91
- description: Handy extensions for Capistrano
90
+ version_requirements: *2152959180
91
+ description: ! 'capistrano-exts is a set of helper tasks to help with the initial
92
+ server
93
+
94
+ configuration and application provisioning. Things like creating the directory
95
+
96
+ structure, setting up that database, and other one-off you might find yourself
97
+
98
+ doing by hand far too often.
99
+
100
+ '
92
101
  email:
93
102
  - wael.nasreddine@gmail.com
94
103
  executables: []
@@ -97,6 +106,7 @@ extra_rdoc_files: []
97
106
  files:
98
107
  - .gitignore
99
108
  - .travis.yml
109
+ - ChangeLog
100
110
  - Gemfile
101
111
  - Guardfile
102
112
  - MIT-LICENSE
@@ -168,7 +178,8 @@ rubyforge_project: capistrano-exts
168
178
  rubygems_version: 1.8.10
169
179
  signing_key:
170
180
  specification_version: 3
171
- summary: Handy extensions for Capistrano
181
+ summary: Set of helper tasks to help with the initial server configuration and application
182
+ provisioning.
172
183
  test_files:
173
184
  - spec/rendered_templates/nginx_php_fpm.conf
174
185
  - spec/requests/nginx_spec.rb