cappress 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2005-2009, WDT Media Corp (http://wdtmedia.net)
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of Capcake, WDT Media, WDT Media Corp, nor the names of its contributors
13
+ may be used to endorse or promote products derived from this software
14
+ without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.markdown ADDED
@@ -0,0 +1,104 @@
1
+ # cappress
2
+
3
+ Looking to deploy a [Wordpress](http://wordpress.org) application you've built? Cappress extends [Capistrano](http://capify.org), removing the *rails-ism*, replacing them by more *wp-ish* ones.
4
+
5
+ ## Installation
6
+
7
+ If you don't have Capistrano and/or Cappress already installed (basically, just the 1st time):
8
+
9
+ # gem install capistrano
10
+ # gem install cappress -s http://gemcutter.org
11
+
12
+ For every application you'll want to deploy:
13
+
14
+ # cd /path/to/app && capify .
15
+
16
+ This will create the following files in your project (don't forget to commit them!):
17
+
18
+ capfile
19
+ config/deploy.rb
20
+
21
+ Prepend your config/deploy.rb with the following lines:
22
+
23
+ require 'rubygems'
24
+ require 'cappress'
25
+
26
+ And make sure you start cappress on the last line of that same file:
27
+
28
+ cappress
29
+
30
+ You should then be able to proceed as you usually would. To familiarize yourself with the now modified list of tasks, you can get a full list with:
31
+
32
+ $ cap -T
33
+
34
+ ## Configuration
35
+
36
+ Before continuing, some changes to config/deploy.rb are necessary. First, your project's name:
37
+
38
+ set :application, "your_app_name"
39
+
40
+ Next, setting up the Git repository (make sure it's accessible by both your local machine and server your are deploying to):
41
+
42
+ set :repository, "git@domain.com:path/to/repo"
43
+
44
+ Now, to deploy from Git, and by following [GitHub's suggestion](http://github.com/guides/deploying-with-capistrano) (they must know what they are talking about), add a user (defaults to *deployer* by cappress's recipe) to your server(s) just for deployments. In this example, I will be using SSH keys instead of getting a Git password prompt. Local user's SSH key must be added to *deployer*'s ~/.ssh/authorized_keys for this to work as described.
45
+
46
+ ssh_options[:forward_agent] = true
47
+
48
+ We need to tell it where to deploy, using what methods:
49
+
50
+ server "www.domain.tld", :app, :db, :primary => true
51
+
52
+ And finally, some CakePHP related settings (if omitted, Cappress will NOT handle deploying Wordpress):
53
+
54
+ set :wp_branch, ""
55
+
56
+ You can change the default values for the following variables also:
57
+
58
+ set :wp_branch, "1.2"
59
+ set :wp_path, "/path/to"
60
+ set :user, "your_username"
61
+ set :branch, "tag"
62
+
63
+ ## Deployment
64
+
65
+ The first time you are deploying, you need to run:
66
+
67
+ # cap deploy:setup
68
+
69
+ That should create on your server the following directory structure:
70
+
71
+ [deploy_to]
72
+ [deploy_to]/releases
73
+ [deploy_to]/shared
74
+ [deploy_to]/shared/wordpress
75
+ [deploy_to]/shared/system
76
+ [deploy_to]/shared/uploads
77
+
78
+ Finally, deploy:
79
+
80
+ # cap deploy
81
+
82
+ Which will change the directory structure to become:
83
+
84
+ [deploy_to]
85
+ [deploy_to]/current -> [deploy_to]/releases/20091013001122
86
+ [deploy_to]/releases
87
+ [deploy_to]/releases/20091013001122
88
+ [deploy_to]/releases/20091013001122/system -> [deploy_to]/shared/system
89
+ [deploy_to]/releases/20091013001122/wp-content/uploads -> [deploy_to]/shared/uploads
90
+ [deploy_to]/shared
91
+ [deploy_to]/shared/system
92
+ [deploy_to]/shared/uploads
93
+
94
+ ## Patches & Features
95
+
96
+ * Fork
97
+ * Mod, fix
98
+ * Test - this is important, so it's not unintentionally broken
99
+ * Commit - do not mess with license, todo, version, etc. (if you do change any, make them into commits of their own that I can ignore when I pull)
100
+ * Pull request - bonus point for topic branches
101
+
102
+ ## Bugs & Feedback
103
+
104
+ http://github.com/jadb/cappress/issues
data/lib/cappress.rb ADDED
@@ -0,0 +1,440 @@
1
+ # Capcake capistrano's recipe
2
+ #
3
+ # Author:: Jad Bitar (mailto:jadbitar@mac.com)
4
+ # Copyright:: Copyright (c) 2005-2009, WDT Media Corp (http://wdtmedia.net)
5
+ # License:: http://opensource.org/licenses/bsd-license.php The BSD License
6
+
7
+ Capistrano::Configuration.instance(:must_exist).load do
8
+
9
+ require 'capistrano/recipes/deploy/scm'
10
+ require 'capistrano/recipes/deploy/strategy'
11
+
12
+ # =========================================================================
13
+ # These variables may be set in the client capfile if their default values
14
+ # are not sufficient.
15
+ # =========================================================================
16
+
17
+ set :application, ""
18
+ set :branch, "master"
19
+ set :deploy_to, ""
20
+ set :keep_releases, 5
21
+ set :repository, ""
22
+ set :use_sudo, false
23
+ set :user, "deployer"
24
+
25
+ # =========================================================================
26
+ # These variables should NOT be changed unless you are very confident in
27
+ # what you are doing. Make sure you understand all the implications of your
28
+ # changes if you do decide to muck with these!
29
+ # =========================================================================
30
+
31
+ set :scm, :git
32
+ set :git_enable_submodules, 1
33
+ set :revision, source.head
34
+ set :deploy_via, :checkout
35
+ set :shared_children, %w(uploads system)
36
+
37
+ set :git_flag_quiet, ""
38
+
39
+ def capcake()
40
+ set :deploy_to, "/var/www/#{application}" if (deploy_to.empty?)
41
+ set(:current_path) { File.join(deploy_to, current_dir) }
42
+ set(:config_path) { File.join(shared_path, "wp-config.php") }
43
+ set(:shared_path) { File.join(deploy_to, shared_dir) }
44
+ _cset(:uploads_path) { File.join(shared_path, "uploads") }
45
+
46
+ after("deploy:setup", "wp:config:setup") if (!remote_file_exists?(config_path))
47
+ after("deploy:symlink", "wp:config:symlink") if (remote_file_exists?(config_path))
48
+ after("deploy:symlink", "wp:symlink") if (remote_file_exists?(uploads_path))
49
+ end
50
+
51
+ def defaults(val, default)
52
+ val = default if (val.empty?)
53
+ val
54
+ end
55
+
56
+ def remote_file_exists?(full_path)
57
+ 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
58
+ end
59
+
60
+ # =========================================================================
61
+ # These are the tasks that are available to help with deploying web apps,
62
+ # and specifically, Rails applications. You can have cap give you a summary
63
+ # of them with `cap -T'.
64
+ # =========================================================================
65
+
66
+ namespace :deploy do
67
+ desc <<-DESC
68
+ Deploys your project. This calls `update'. Note that \
69
+ this will generally only work for applications that have already been deployed \
70
+ once. For a "cold" deploy, you'll want to take a look at the `deploy:cold' \
71
+ task, which handles the cold start specifically.
72
+ DESC
73
+ task :default do
74
+ update
75
+ end
76
+ desc <<-DESC
77
+ Prepares one or more servers for deployment. Before you can use any \
78
+ of the Capistrano deployment tasks with your project, you will need to \
79
+ make sure all of your servers have been prepared with `cap deploy:setup'. When \
80
+ you add a new server to your cluster, you can easily run the setup task \
81
+ on just that server by specifying the HOSTS environment variable:
82
+
83
+ $ cap HOSTS=new.server.com deploy:setup
84
+
85
+ It is safe to run this task on servers that have already been set up; it \
86
+ will not destroy any deployed revisions or data.
87
+ DESC
88
+ task :setup, :except => { :no_release => true } do
89
+ dirs = [deploy_to, releases_path, shared_path]
90
+ dirs += shared_children.map { |d| File.join(shared_path, d) }
91
+ tmp_dirs = tmp_children.map { |d| File.join(tmp_path, d) }
92
+ tmp_dirs += cache_children.map { |d| File.join(cache_path, d) }
93
+ run "#{try_sudo} mkdir -p #{(dirs + tmp_dirs).join(' ')} && #{try_sudo} chmod -R 777 #{tmp_path}" if (!user.empty?)
94
+ set :git_flag_quiet, "-q "
95
+ cake.setup if (!cake_branch.empty?)
96
+ end
97
+
98
+ desc <<-DESC
99
+ Copies your project and updates the symlink. It does this in a \
100
+ transaction, so that if either `update_code' or `symlink' fail, all \
101
+ changes made to the remote servers will be rolled back, leaving your \
102
+ system in the same state it was in before `update' was invoked. Usually, \
103
+ you will want to call `deploy' instead of `update', but `update' can be \
104
+ handy if you want to deploy, but not immediately restart your application.
105
+ DESC
106
+ task :update do
107
+ transaction do
108
+ update_code
109
+ symlink
110
+ end
111
+ end
112
+
113
+ desc <<-DESC
114
+ Copies your project to the remote servers. This is the first stage \
115
+ of any deployment; moving your updated code and assets to the deployment \
116
+ servers. You will rarely call this task directly, however; instead, you \
117
+ should call the `deploy' task (to do a complete deploy) or the `update' \
118
+ task (if you want to perform the `restart' task separately).
119
+
120
+ You will need to make sure you set the :scm variable to the source \
121
+ control software you are using (it defaults to :subversion), and the \
122
+ :deploy_via variable to the strategy you want to use to deploy (it \
123
+ defaults to :checkout).
124
+ DESC
125
+ task :update_code, :except => { :no_release => true } do
126
+ on_rollback { run "rm -rf #{release_path}; true" }
127
+ strategy.deploy!
128
+ finalize_update
129
+ end
130
+
131
+ desc <<-DESC
132
+ [internal] Touches up the released code. This is called by update_code \
133
+ after the basic deploy finishes. It assumes a Rails project was deployed, \
134
+ so if you are deploying something else, you may want to override this \
135
+ task with your own environment's requirements.
136
+
137
+ This task will make the release group-writable (if the :group_writable \
138
+ variable is set to true, which is the default). It will then set up \
139
+ symlinks to the shared directory for the log, system, and tmp/pids \
140
+ directories, and will lastly touch all assets in public/images, \
141
+ public/stylesheets, and public/javascripts so that the times are \
142
+ consistent (so that asset timestamping works). This touch process \
143
+ is only carried out if the :normalize_asset_timestamps variable is \
144
+ set to true, which is the default.
145
+ DESC
146
+ task :finalize_update, :except => { :no_release => true } do
147
+ run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
148
+ end
149
+
150
+ desc <<-DESC
151
+ Updates the symlinks to the most recently deployed version. Capistrano works \
152
+ by putting each new release of your application in its own directory. When \
153
+ you deploy a new version, this task's job is to update the `current', \
154
+ `current/tmp', `current/webroot/system' symlinks to point at the new version. \
155
+
156
+ You will rarely need to call this task directly; instead, use the `deploy' \
157
+ task (which performs a complete deploy, including `restart') or the 'update' \
158
+ task (which does everything except `restart').
159
+ DESC
160
+ task :symlink, :except => { :no_release => true } do
161
+ on_rollback do
162
+ if previous_release
163
+ run "rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true"
164
+ else
165
+ logger.important "no previous release to rollback to, rollback of symlink skipped"
166
+ end
167
+ end
168
+ run "ln -s #{shared_path}/system #{latest_release}/system && ln -s #{shared_path}/uploads #{latest_release}/wp-content/uploads";
169
+ run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}"
170
+ end
171
+
172
+ desc <<-DESC
173
+ Copy files to the currently deployed version. This is useful for updating \
174
+ files piecemeal, such as when you need to quickly deploy only a single \
175
+ file. Some files, such as updated templates, images, or stylesheets, \
176
+ might not require a full deploy, and especially in emergency situations \
177
+ it can be handy to just push the updates to production, quickly.
178
+
179
+ To use this task, specify the files and directories you want to copy as a \
180
+ comma-delimited list in the FILES environment variable. All directories \
181
+ will be processed recursively, with all files being pushed to the \
182
+ deployment servers.
183
+
184
+ $ cap deploy:upload FILES=templates,controller.rb
185
+
186
+ Dir globs are also supported:
187
+
188
+ $ cap deploy:upload FILES='config/apache/*.conf'
189
+ DESC
190
+ task :upload, :except => { :no_release => true } do
191
+ files = (ENV["FILES"] || "").split(",").map { |f| Dir[f.strip] }.flatten
192
+ abort "Please specify at least one file or directory to update (via the FILES environment variable)" if files.empty?
193
+
194
+ files.each { |file| top.upload(file, File.join(current_path, file)) }
195
+ end
196
+
197
+ namespace :rollback do
198
+ desc <<-DESC
199
+ [internal] Points the current symlink at the previous revision.
200
+ This is called by the rollback sequence, and should rarely (if
201
+ ever) need to be called directly.
202
+ DESC
203
+ task :revision, :except => { :no_release => true } do
204
+ if previous_release
205
+ run "rm #{current_path}; ln -s #{previous_release} #{current_path};"
206
+ else
207
+ abort "could not rollback the code because there is no prior release"
208
+ end
209
+ end
210
+
211
+ desc <<-DESC
212
+ [internal] Removes the most recently deployed release.
213
+ This is called by the rollback sequence, and should rarely
214
+ (if ever) need to be called directly.
215
+ DESC
216
+ task :cleanup, :except => { :no_release => true } do
217
+ run "if [ `readlink #{current_path}` != #{current_release} ]; then rm -rf #{current_release}; fi"
218
+ end
219
+
220
+ desc <<-DESC
221
+ Rolls back to the previously deployed version. The `current' symlink will \
222
+ be updated to point at the previously deployed version, and then the \
223
+ current release will be removed from the servers.
224
+ DESC
225
+ task :code, :except => { :no_release => true } do
226
+ revision
227
+ cleanup
228
+ end
229
+
230
+ desc <<-DESC
231
+ Rolls back to a previous version and restarts. This is handy if you ever \
232
+ discover that you've deployed a lemon; `cap rollback' and you're right \
233
+ back where you were, on the previously deployed version.
234
+ DESC
235
+ task :default do
236
+ revision
237
+ cleanup
238
+ end
239
+ end
240
+
241
+ desc <<-DESC
242
+ Clean up old releases. By default, the last 5 releases are kept on each \
243
+ server (though you can change this with the keep_releases variable). All \
244
+ other deployed revisions are removed from the servers. By default, this \
245
+ will use sudo to clean up the old releases, but if sudo is not available \
246
+ for your environment, set the :use_sudo variable to false instead.
247
+ DESC
248
+ task :cleanup, :except => { :no_release => true } do
249
+ count = fetch(:keep_releases, 5).to_i
250
+ if count >= releases.length
251
+ logger.important "no old releases to clean up"
252
+ else
253
+ logger.info "keeping #{count} of #{releases.length} deployed releases"
254
+
255
+ directories = (releases - releases.last(count)).map { |release|
256
+ File.join(releases_path, release) }.join(" ")
257
+
258
+ try_sudo "rm -rf #{directories}"
259
+ end
260
+ end
261
+
262
+ desc <<-DESC
263
+ Test deployment dependencies. Checks things like directory permissions, \
264
+ necessary utilities, and so forth, reporting on the things that appear to \
265
+ be incorrect or missing. This is good for making sure a deploy has a \
266
+ chance of working before you actually run `cap deploy'.
267
+
268
+ You can define your own dependencies, as well, using the `depend' method:
269
+
270
+ depend :remote, :gem, "tzinfo", ">=0.3.3"
271
+ depend :local, :command, "svn"
272
+ depend :remote, :directory, "/u/depot/files"
273
+ DESC
274
+ task :check, :except => { :no_release => true } do
275
+ dependencies = strategy.check!
276
+
277
+ other = fetch(:dependencies, {})
278
+ other.each do |location, types|
279
+ types.each do |type, calls|
280
+ if type == :gem
281
+ dependencies.send(location).command(fetch(:gem_command, "gem")).or("`gem' command could not be found. Try setting :gem_command")
282
+ end
283
+
284
+ calls.each do |args|
285
+ dependencies.send(location).send(type, *args)
286
+ end
287
+ end
288
+ end
289
+
290
+ if dependencies.pass?
291
+ puts "You appear to have all necessary dependencies installed"
292
+ else
293
+ puts "The following dependencies failed. Please check them and try again:"
294
+ dependencies.reject { |d| d.pass? }.each do |d|
295
+ puts "--> #{d.message}"
296
+ end
297
+ abort
298
+ end
299
+ end
300
+
301
+ desc <<-DESC
302
+ Deploys and starts a `cold' application. This is useful if you have never \
303
+ deployed your application before. It currently runs `deploy:setup` followed \
304
+ by `deploy:update`. \
305
+ (This is still an experimental feature, and is subject to change without \
306
+ notice!)
307
+ DESC
308
+ task :cold do
309
+ setup
310
+ update
311
+ end
312
+
313
+ namespace :pending do
314
+ desc <<-DESC
315
+ Displays the `diff' since your last deploy. This is useful if you want \
316
+ to examine what changes are about to be deployed. Note that this might \
317
+ not be supported on all SCM's.
318
+ DESC
319
+ task :diff, :except => { :no_release => true } do
320
+ system(source.local.diff(current_revision))
321
+ end
322
+
323
+ desc <<-DESC
324
+ Displays the commits since your last deploy. This is good for a summary \
325
+ of the changes that have occurred since the last deploy. Note that this \
326
+ might not be supported on all SCM's.
327
+ DESC
328
+ task :default, :except => { :no_release => true } do
329
+ from = source.next_revision(current_revision)
330
+ system(source.local.log(from))
331
+ end
332
+ end
333
+
334
+ namespace :web do
335
+ desc <<-DESC
336
+ Present a maintenance page to visitors. Disables your application's web \
337
+ interface by writing a "maintenance.html" file to each web server. The \
338
+ servers must be configured to detect the presence of this file, and if \
339
+ it is present, always display it instead of performing the request.
340
+
341
+ By default, the maintenance page will just say the site is down for \
342
+ "maintenance", and will be back "shortly", but you can customize the \
343
+ page by specifying the REASON and UNTIL environment variables:
344
+
345
+ $ cap deploy:web:disable \\
346
+ REASON="hardware upgrade" \\
347
+ UNTIL="12pm Central Time"
348
+
349
+ Further customization will require that you write your own task.
350
+ DESC
351
+ task :disable, :roles => :web, :except => { :no_release => true } do
352
+ require 'erb'
353
+ on_rollback { run "rm #{shared_path}/system/maintenance.html" }
354
+
355
+ warn <<-EOHTACCESS
356
+
357
+ # Please add something like this to your site's htaccess to redirect users to the maintenance page.
358
+ # More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
359
+
360
+ ErrorDocument 503 /system/maintenance.html
361
+ RewriteEngine On
362
+ RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
363
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
364
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
365
+ RewriteRule ^.*$ - [redirect=503,last]
366
+ EOHTACCESS
367
+
368
+ reason = ENV['REASON']
369
+ deadline = ENV['UNTIL']
370
+
371
+ template = File.read(File.join(File.dirname(__FILE__), "templates", "maintenance.rhtml"))
372
+ result = ERB.new(template).result(binding)
373
+
374
+ put(result, "#{shared_path}/system/maintenance.html", :mode => 0644, :via => :scp)
375
+ end
376
+
377
+ desc <<-DESC
378
+ Makes the application web-accessible again. Removes the \
379
+ "maintenance.html" page generated by deploy:web:disable, which (if your \
380
+ web servers are configured correctly) will make your application \
381
+ web-accessible again.
382
+ DESC
383
+ task :enable, :roles => :web, :except => { :no_release => true } do
384
+ run "rm #{shared_path}/system/maintenance.html"
385
+ end
386
+ end
387
+
388
+ desc <<-DESC
389
+ Quick server(s) reset. For now, it deletes all files/folders in :deploy_to \
390
+ (This is still an experimental feature, and is subject to change without \
391
+ notice!) \
392
+
393
+ Used only when first testing setup deploy recipes and want to quickly \
394
+ reset servers.
395
+ DESC
396
+ task :destroy do
397
+ set(:confirm) do
398
+ Capistrano::CLI.ui.ask "This will delete your project on all servers. Are you sure you wish to continue? [Y/n]"
399
+ end
400
+ run "#{try_sudo} rm -rf #{deploy_to}/*" if (confirm == "Y")
401
+ end
402
+
403
+ end
404
+
405
+ namespace :wp do
406
+
407
+ namespace :config do
408
+ desc <<-DESC
409
+ Generates Wordpress configuration file in #{shared_path} \
410
+ and symlinks #{current_path}/wp-config.php to it
411
+ DESC
412
+ task :setup, :roles => :web, :except => { :no_release => true } do
413
+ require 'erb'
414
+ on_rollback { run "rm #{config_path}" }
415
+ puts "Wordpress Configuration"
416
+ _cset :db_host, defaults(Capistrano::CLI.ui.ask("hostname [localhost]:"), 'localhost')
417
+ _cset :db_login, defaults(Capistrano::CLI.ui.ask("username [#{user}]:"), user)
418
+ _cset :db_password, Capistrano::CLI.password_prompt("password:")
419
+ _cset :db_name, defaults(Capistrano::CLI.ui.ask("db name [#{application}]:"), application)
420
+ _cset :db_prefix, Capistrano::CLI.ui.ask("prefix [wp_]:")
421
+ _cset :db_charset, defaults(Capistrano::CLI.ui.ask("charset []:"), '')
422
+ _cset :db_collate, defaults(Capistrano::CLI.ui.ask("encoding []:"), '')
423
+
424
+ template = File.read(File.join(File.dirname(__FILE__), "templates", "wp-config.rphp"))
425
+ result = ERB.new(template).result(binding)
426
+
427
+ put(result, "#{database_path}", :mode => 0644, :via => :scp)
428
+ after("deploy:symlink", "wp:config:symlink")
429
+ end
430
+ desc <<-DESC
431
+ Creates required CakePHP's APP/config/database.php as a symlink to \
432
+ #{deploy_to}/shared/config/database.php
433
+ DESC
434
+ task :symlink, :roles => :web, :except => { :no_release => true } do
435
+ run "#{try_sudo} ln -s #{config_path} #{current_path}/wp-config.php"
436
+ end
437
+ end
438
+ end
439
+
440
+ end # Capistrano::Configuration.instance(:must_exist).load do
@@ -0,0 +1,6 @@
1
+ <% mysql_grant_locations.each do |location| %>GRANT <%= mysql_grant_priv_type %> ON <%= db_name %>.* TO '<%= db_login %>'@'<%= location %>' IDENTIFIED BY '<%= db_password %>';
2
+ <% end %>
3
+
4
+ CREATE DATABASE IF NOT EXISTS <%= db_name %> CHARACTER SET = <%= db_encoding %>;
5
+
6
+ FLUSH PRIVILEGES;
@@ -0,0 +1,14 @@
1
+ <?php
2
+ class DATABASE_CONFIG {
3
+ public $default = array(
4
+ 'driver' => '<%= db_driver %>',
5
+ 'persistent' => '<%= db_persistent %>',
6
+ 'host' => '<%= db_host %>',
7
+ 'login' => '<%= db_login %>',
8
+ 'password' => '<%= db_password %>',
9
+ 'database' => '<%= db_name %>',
10
+ 'prefix' => '<%= db_prefix %>',
11
+ 'encoding' => '<%= db_encoding %>',
12
+ );
13
+ }
14
+ ?>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
8
+ <title>System down for maintenance</title>
9
+
10
+ <style type="text/css">
11
+ div.outer {
12
+ position: absolute;
13
+ left: 50%;
14
+ top: 50%;
15
+ width: 500px;
16
+ height: 300px;
17
+ margin-left: -260px;
18
+ margin-top: -150px;
19
+ }
20
+
21
+ .DialogBody {
22
+ margin: 0;
23
+ padding: 10px;
24
+ text-align: left;
25
+ border: 1px solid #ccc;
26
+ border-right: 1px solid #999;
27
+ border-bottom: 1px solid #999;
28
+ background-color: #fff;
29
+ }
30
+
31
+ body { background-color: #fff; }
32
+ </style>
33
+ </head>
34
+
35
+ <body>
36
+
37
+ <div class="outer">
38
+ <div class="DialogBody" style="text-align: center;">
39
+ <div style="text-align: center; width: 200px; margin: 0 auto;">
40
+ <p style="color: red; font-size: 16px; line-height: 20px;">
41
+ The system is down for <%= reason ? reason : "maintenance" %>
42
+ as of <%= Time.now.strftime("%H:%M %Z") %>.
43
+ </p>
44
+ <p style="color: #666;">
45
+ It'll be back <%= deadline ? deadline : "shortly" %>.
46
+ </p>
47
+ </div>
48
+ </div>
49
+ </div>
50
+
51
+ </body>
52
+ </html>
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cappress
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Jad Bitar
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-05 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: capistrano
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 9
30
+ segments:
31
+ - 2
32
+ - 5
33
+ version: "2.5"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Deploy Wordpress websites using Capistrano
37
+ email: jadbitar@mac.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - LICENSE
44
+ - README.markdown
45
+ files:
46
+ - lib/cappress.rb
47
+ - lib/templates/create_database.rsql
48
+ - lib/templates/database.rphp
49
+ - lib/templates/maintenance.rhtml
50
+ - LICENSE
51
+ - README.markdown
52
+ has_rdoc: true
53
+ homepage: http://github.com/jadb/cappress
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Deploy Wordpress websites using Capistrano
86
+ test_files: []
87
+