matthewtodd-wordpress 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,46 @@
1
+ == 0.6.0
2
+
3
+ * Slight documentation updates.
4
+ * Now using http://gems.github.com.
5
+
6
+ == 0.5.1
7
+
8
+ * Quick Bugfix: Capfile still needs to require the wordpress gem.
9
+
10
+ == 0.5.0
11
+
12
+ * <tt>wordpress/recipes/deploy</tt> should now be <tt>require</tt>d in your <tt>Capfile</tt>, not <tt>load</tt>ed. This seems more in keeping with Jamis' intentions for third-party libraries.
13
+
14
+ == 0.4.0
15
+
16
+ * Renamed <tt>wordpress</tt> -> <tt>wordpressify</tt>.
17
+ * Extracted wordpress tarball to separate wordpress-release gem.
18
+ * Added placeholders for required database parameters to generated deploy.rb.
19
+ * Command <tt>wordpressify</tt> writes both config/wp-config.php and config/wp-config-sample.php.
20
+
21
+ == 0.3.1
22
+
23
+ * BUGFIX Recipe <tt>update_code</tt> failed to call <tt>finalize_update</tt> once it became a namespace.
24
+ * BUGFIX Prevent chmod from complaining about symbolic links.
25
+ * Command <tt>wordpress</tt> only creates <tt>config/wp-config-sample.php</tt>. You'll need to do the rest.
26
+
27
+ == 0.3.0
28
+
29
+ * Command <tt>wordpress</tt> sets up <tt>script/server</tt> using <tt>config/lighttpd.conf</tt>.
30
+ * Command <tt>wordpress</tt> creates a default <tt>config/wp-config.php</tt> and symlinks it in <tt>public</tt>.
31
+ * Task <tt>deploy:setup:config</tt> creates shared <tt>wp-config.php</tt>.
32
+ * Task <tt>deploy:finalize_update:config</tt> symlinks to shared <tt>wp-config.php</tt>.
33
+
34
+ == 0.2.0
35
+
36
+ * Task <tt>deploy:database:backup</tt> to backup database into <tt>#{shared_path}/backups</tt>, along with <tt>restore</tt> script
37
+ * Task <tt>deploy:plugins:disable</tt> to disable all active plugins (useful before an upgrade)
38
+ * Task <tt>deploy:upgrade</tt> to backup database and disable plugins before deploying with an upgraded version of Wordpress
39
+
40
+ == 0.1.1
41
+
42
+ * Fledgling documentation.
43
+
44
+ == 0.1.0
45
+
46
+ * Initial release.
data/README.rdoc ADDED
@@ -0,0 +1,24 @@
1
+ Manages a Wordpress project Rails-ishly.
2
+
3
+ * <tt>wordpressify</tt> sets up a new project and upgrades an existing one to the latest Wordpress.
4
+ * <tt>cap deploy:setup</tt> and <tt>cap deploy</tt> do the right thing, handling <tt>wp-config.php</tt>.
5
+ * <tt>cap deploy:upgrade</tt> additionally backs up your database and disables your plugins, as recommended[http://codex.wordpress.org/Upgrading_WordPress_Extended].
6
+ * <tt>script/server</tt> fires up lighttpd for local development.
7
+
8
+ ==Installation
9
+
10
+ $ gem install capistrano
11
+ $ gem install matthewtodd-wordpress --source http://gems.github.com
12
+
13
+ $ sudo port install lighttpd mysql5 +server php5 +fastcgi +mysql5
14
+ $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
15
+
16
+ ==Getting Started
17
+
18
+ $ wordpressify blog
19
+ $ mysqladmin -u root create blog
20
+ $ cd blog && script/server
21
+
22
+ ==Wordpress Releases
23
+
24
+ This gem depends on wordpress-release[http://github.com/matthewtodd/wordpress-release] for its copy of the Wordpress code.
data/TODO.rdoc ADDED
@@ -0,0 +1,5 @@
1
+ * TODO support copying "production" data into local database
2
+ * TODO always overwrite wp-config-sample.php?
3
+ * TODO wordpress cli could take arguments to pass in creating initial wp-config.php
4
+ * TODO wordpress cli should handle -h --help to show usage
5
+ * TODO wordpress cli should handle -f --force to force file creation
data/bin/wordpressify ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+ require 'wordpress'
5
+
6
+ Wordpress::Cli.new(*ARGV).run
@@ -0,0 +1,166 @@
1
+ require 'digest/sha1'
2
+
3
+ module Wordpress
4
+ # Sets up a new project or upgrades the Wordpress installation in an
5
+ # existing project.
6
+ class Cli
7
+ attr_reader :base
8
+
9
+ def initialize(*argv)
10
+ abort "Please specify the directory set up, e.g. #{File.basename($0)} ." if argv.empty?
11
+ abort 'Too many arguments; please specify only the directory to set up.' if argv.length > 1
12
+ @base = File.expand_path(argv.shift)
13
+ end
14
+
15
+ def run
16
+ directory(base) do
17
+ file 'Capfile', <<-END
18
+ %w(rubygems wordpress).each { |lib| require lib }
19
+ require 'wordpress/recipes/deploy'
20
+ load 'config/deploy'
21
+ END
22
+
23
+ directory('config') do
24
+ file 'boot.rb', <<-END
25
+ %w( rubygems wordpress ).each { |lib| require lib }
26
+ WORDPRESS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
27
+ END
28
+
29
+ file 'deploy.rb', <<-END
30
+ set :application, 'set your application name here'
31
+ set :repository, 'set your repository location here'
32
+ set :database_name, 'set your database name here'
33
+ set :database_username, 'set your database username here'
34
+
35
+ # If you aren't deploying to /u/apps/\#{application} on the target
36
+ # servers (which is the default), you can specify the actual location
37
+ # via the :deploy_to variable:
38
+ # set :deploy_to, "/var/www/\#{application}"
39
+
40
+ # If you aren't using Subversion to manage your source code, specify
41
+ # your SCM below:
42
+ # set :scm, :git
43
+ # set :git_shallow_clone, 1
44
+
45
+ server 'your server here', :web, :app, :db, :primary => true
46
+ END
47
+
48
+ file 'lighttpd.conf', <<-END
49
+ server.port = 3000
50
+
51
+ var.root = env.WORDPRESS_ROOT
52
+ server.document-root = var.root + "/public"
53
+ server.error-handler-404 = "/index.php"
54
+ server.modules = ( "mod_fastcgi" )
55
+ index-file.names = ( "index.php" )
56
+ fastcgi.server = ( ".php" => ((
57
+ "bin-path" => env.PHP_FASTCGI,
58
+ "socket" => var.root + "/tmp/sockets/php"
59
+ )))
60
+
61
+ include "lighttpd-mimetypes.conf"
62
+ END
63
+
64
+ file 'lighttpd-mimetypes.conf', <<-END
65
+ mimetype.assign = (
66
+ ".pdf" => "application/pdf",
67
+ ".sig" => "application/pgp-signature",
68
+ ".spl" => "application/futuresplash",
69
+ ".class" => "application/octet-stream",
70
+ ".ps" => "application/postscript",
71
+ ".torrent" => "application/x-bittorrent",
72
+ ".dvi" => "application/x-dvi",
73
+ ".gz" => "application/x-gzip",
74
+ ".pac" => "application/x-ns-proxy-autoconfig",
75
+ ".swf" => "application/x-shockwave-flash",
76
+ ".tar.gz" => "application/x-tgz",
77
+ ".tgz" => "application/x-tgz",
78
+ ".tar" => "application/x-tar",
79
+ ".zip" => "application/zip",
80
+ ".mp3" => "audio/mpeg",
81
+ ".m3u" => "audio/x-mpegurl",
82
+ ".wma" => "audio/x-ms-wma",
83
+ ".wax" => "audio/x-ms-wax",
84
+ ".ogg" => "application/ogg",
85
+ ".wav" => "audio/x-wav",
86
+ ".gif" => "image/gif",
87
+ ".jpg" => "image/jpeg",
88
+ ".jpeg" => "image/jpeg",
89
+ ".png" => "image/png",
90
+ ".xbm" => "image/x-xbitmap",
91
+ ".xpm" => "image/x-xpixmap",
92
+ ".xwd" => "image/x-xwindowdump",
93
+ ".css" => "text/css",
94
+ ".html" => "text/html",
95
+ ".htm" => "text/html",
96
+ ".js" => "text/javascript",
97
+ ".asc" => "text/plain",
98
+ ".c" => "text/plain",
99
+ ".cpp" => "text/plain",
100
+ ".log" => "text/plain",
101
+ ".conf" => "text/plain",
102
+ ".text" => "text/plain",
103
+ ".txt" => "text/plain",
104
+ ".dtd" => "text/xml",
105
+ ".xml" => "text/xml",
106
+ ".mpeg" => "video/mpeg",
107
+ ".mpg" => "video/mpeg",
108
+ ".mov" => "video/quicktime",
109
+ ".qt" => "video/quicktime",
110
+ ".avi" => "video/x-msvideo",
111
+ ".asf" => "video/x-ms-asf",
112
+ ".asx" => "video/x-ms-asf",
113
+ ".wmv" => "video/x-ms-wmv",
114
+ ".bz2" => "application/x-bzip",
115
+ ".tbz" => "application/x-bzip-compressed-tar",
116
+ ".tar.bz2" => "application/x-bzip-compressed-tar",
117
+ # default mime type
118
+ "" => "application/octet-stream",
119
+ )
120
+ END
121
+
122
+ config = Wordpress.config(:db_name => File.basename(base),
123
+ :db_user => 'root',
124
+ :db_password => '',
125
+ :secret_key => Digest::SHA1.hexdigest(rand.to_s),
126
+ :abspath => '/../public/')
127
+
128
+ file 'wp-config.php', config
129
+ file 'wp-config-sample.php', config
130
+ end
131
+
132
+ directory('public') do
133
+ Wordpress.release.upgrade
134
+ system 'rm', 'wp-config-sample.php'
135
+ symlink '../config/wp-config.php'
136
+ end
137
+
138
+ directory('script') do
139
+ file 'server', <<-END, :mode => 0755
140
+ #!/usr/bin/env ruby
141
+ require File.join(File.dirname(__FILE__), '..', 'config', 'boot')
142
+ require 'wordpress/servers/lighttpd'
143
+ END
144
+ end
145
+ end
146
+ end
147
+
148
+ private
149
+
150
+ def directory(path)
151
+ system 'mkdir', '-p', path
152
+ Dir.chdir(path) { yield }
153
+ end
154
+
155
+ def file(path, contents, options={})
156
+ indent = contents.scan(/^ +/m).first
157
+ contents.gsub! /^#{indent}/, ''
158
+ File.open(path, 'w') { |f| f.write(contents) } unless File.exists?(path)
159
+ File.chmod(options[:mode], path) if options[:mode]
160
+ end
161
+
162
+ def symlink(file)
163
+ system 'ln', '-sf', file
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,332 @@
1
+ # =========================================================================
2
+ # This file started as a direct copy of capistrano/recipes/deploy.
3
+ # Thanks so much for Capistrano, Jamis!
4
+ # =========================================================================
5
+ require 'yaml'
6
+ require 'capistrano/recipes/deploy/scm'
7
+ require 'capistrano/recipes/deploy/strategy'
8
+
9
+ Capistrano::Configuration.instance(:must_exist).load do
10
+ def _cset(name, *args, &block) #:nodoc:
11
+ unless exists?(name)
12
+ set(name, *args, &block)
13
+ end
14
+ end
15
+
16
+ # =========================================================================
17
+ # These variables MUST be set in the client capfiles. If they are not set,
18
+ # the deploy will fail with an error.
19
+ # =========================================================================
20
+
21
+ _cset(:application) { abort "Please specify the name of your application, set :application, 'foo'" }
22
+ _cset(:repository) { abort "Please specify the repository that houses your application's code, set :repository, 'foo'" }
23
+ _cset(:database_name) { abort "Please specify the name of your Wordpress database, set :database_name, 'foo'" }
24
+ _cset(:database_username) { abort "Please specify the username for your Wordpress database, set :database_username, 'foo'" }
25
+
26
+ # =========================================================================
27
+ # These variables may be set in the client capfile if their default values
28
+ # are not sufficient.
29
+ # =========================================================================
30
+
31
+ _cset :scm, :subversion
32
+ _cset :deploy_via, :checkout
33
+
34
+ _cset(:deploy_to) { "/u/apps/#{application}" }
35
+ _cset(:revision) { source.head }
36
+
37
+ # =========================================================================
38
+ # These variables should NOT be changed unless you are very confident in
39
+ # what you are doing. Make sure you understand all the implications of your
40
+ # changes if you do decide to muck with these!
41
+ # =========================================================================
42
+
43
+ _cset(:source) { Capistrano::Deploy::SCM.new(scm, self) }
44
+ _cset(:real_revision) { source.local.query_revision(revision) { |cmd| with_env("LC_ALL", "C") { `#{cmd}` } } }
45
+
46
+ _cset(:strategy) { Capistrano::Deploy::Strategy.new(deploy_via, self) }
47
+
48
+ _cset(:release_name) { set :deploy_timestamped, true; Time.now.utc.strftime("%Y%m%d%H%M%S") }
49
+
50
+ _cset :version_dir, "releases"
51
+ _cset :shared_dir, "shared"
52
+ _cset :current_dir, "current"
53
+
54
+ _cset(:releases_path) { File.join(deploy_to, version_dir) }
55
+ _cset(:shared_path) { File.join(deploy_to, shared_dir) }
56
+ _cset(:current_path) { File.join(deploy_to, current_dir) }
57
+ _cset(:release_path) { File.join(releases_path, release_name) }
58
+
59
+ _cset(:releases) { capture("ls -x #{releases_path}").split.sort }
60
+ _cset(:current_release) { File.join(releases_path, releases.last) }
61
+ _cset(:previous_release) { File.join(releases_path, releases[-2]) }
62
+
63
+ _cset(:current_revision) { capture("cat #{current_path}/REVISION").chomp }
64
+ _cset(:latest_revision) { capture("cat #{current_release}/REVISION").chomp }
65
+ _cset(:previous_revision) { capture("cat #{previous_release}/REVISION").chomp }
66
+
67
+ _cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run }
68
+
69
+ _cset(:database_password) { Capistrano::CLI.password_prompt("Please enter the database password for #{database_username} on #{database_name}: ") }
70
+
71
+ # some tasks, like symlink, need to always point at the latest release, but
72
+ # they can also (occassionally) be called standalone. In the standalone case,
73
+ # the timestamped release_path will be inaccurate, since the directory won't
74
+ # actually exist. This variable lets tasks like symlink work either in the
75
+ # standalone case, or during deployment.
76
+ _cset(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_release }
77
+
78
+ # =========================================================================
79
+ # These are helper methods that will be available to your recipes.
80
+ # =========================================================================
81
+
82
+ # Auxiliary helper method for the `deploy:check' task. Lets you set up your
83
+ # own dependencies.
84
+ def depend(location, type, *args) #:nodoc:
85
+ deps = fetch(:dependencies, {})
86
+ deps[location] ||= {}
87
+ deps[location][type] ||= []
88
+ deps[location][type] << args
89
+ set :dependencies, deps
90
+ end
91
+
92
+ # Temporarily sets an environment variable, yields to a block, and restores
93
+ # the value when it is done.
94
+ def with_env(name, value) #:nodoc:
95
+ saved, ENV[name] = ENV[name], value
96
+ yield
97
+ ensure
98
+ ENV[name] = saved
99
+ end
100
+
101
+ # =========================================================================
102
+ # These are the tasks that are available to help with deploying web apps,
103
+ # and specifically, Wordpress. You can have cap give you a summary
104
+ # of them with `cap -T'.
105
+ # =========================================================================
106
+
107
+ namespace :deploy do
108
+ desc <<-DESC
109
+ Copies your project and updates the symlink. It does this in a \
110
+ transaction, so that if either `update_code' or `symlink' fail, all \
111
+ changes made to the remote servers will be rolled back, leaving your \
112
+ system in the same state it was in before `update' was invoked.
113
+ DESC
114
+ task :default do
115
+ transaction do
116
+ update_code
117
+ symlink
118
+ end
119
+ end
120
+
121
+ namespace :setup do
122
+ desc <<-DESC
123
+ Prepares one or more servers for deployment. Before you can use any \
124
+ of the Capistrano deployment tasks with your project, you will need to \
125
+ make sure all of your servers have been prepared with `cap deploy:setup'. When \
126
+ you add a new server to your cluster, you can easily run the setup task \
127
+ on just that server by specifying the HOSTS environment variable:
128
+
129
+ $ cap HOSTS=new.server.com deploy:setup
130
+
131
+ It is safe to run this task on servers that have already been set up; it \
132
+ will not destroy any deployed revisions or data.
133
+ DESC
134
+ task :default, :except => { :no_release => true } do
135
+ directories
136
+ restore
137
+ config
138
+ end
139
+
140
+ desc <<-DESC
141
+ [internal] Creates deployment directories.
142
+ DESC
143
+ task :directories, :except => { :no_release => true } do
144
+ dirs = [deploy_to, releases_path, shared_path]
145
+ dirs += %w(backups uploads).map { |d| File.join(shared_path, d) }
146
+ run "umask 02 && mkdir -p #{dirs.join(' ')}"
147
+ end
148
+
149
+ desc <<-DESC
150
+ [internal] Writes a script to restore a database backup.
151
+ DESC
152
+ task :restore, :except => { :no_release => true } do
153
+ put <<-END.gsub(/^ */, ''), "#{shared_path}/backups/restore", :mode => 0755
154
+ #!/bin/sh
155
+ gzcat $1 | mysql -u #{database_username} -p #{database_name}
156
+ END
157
+ end
158
+
159
+ desc <<-DESC
160
+ Creates a shared wp-config.php.
161
+ DESC
162
+ task :config, :except => { :no_release => true } do
163
+ require 'digest/sha1'
164
+ wp_config = Wordpress.config(:db_name => database_name,
165
+ :db_user => database_username,
166
+ :db_password => database_password,
167
+ :secret_key => Digest::SHA1.hexdigest(rand.to_s),
168
+ :abspath => '/../current/public/')
169
+
170
+ put wp_config, "#{shared_path}/wp-config.php", :mode => 0600
171
+ end
172
+ end
173
+
174
+ desc <<-DESC
175
+ [internal] Copies your project to the remote servers. This is the first stage \
176
+ of any deployment; moving your updated code and assets to the deployment \
177
+ servers. You will rarely call this task directly, however; instead, you \
178
+ should call the `deploy' task (to do a complete deploy) or the `update' \
179
+ task (if you want to perform the `restart' task separately).
180
+
181
+ You will need to make sure you set the :scm variable to the source \
182
+ control software you are using (it defaults to :subversion), and the \
183
+ :deploy_via variable to the strategy you want to use to deploy (it \
184
+ defaults to :checkout).
185
+ DESC
186
+ task :update_code, :except => { :no_release => true } do
187
+ on_rollback { run "rm -rf #{release_path}; true" }
188
+ strategy.deploy!
189
+ finalize_update.default
190
+ end
191
+
192
+ namespace :finalize_update do
193
+ desc <<-DESC
194
+ [internal] Touches up the released code. This is called by update_code \
195
+ after the basic deploy finishes.
196
+
197
+ This task will make the release group-writable (if the :group_writable \
198
+ variable is set to true, which is the default). It will then set up \
199
+ symlinks to the shared directory for the uploads directory.
200
+ DESC
201
+ task :default, :except => { :no_release => true } do
202
+ chmod
203
+ symlink_shared_paths
204
+ config
205
+ end
206
+
207
+ desc <<-DESC
208
+ [internal] Makes the release group writable, if desired.
209
+ DESC
210
+ task :chmod, :except => { :no_release => true } do
211
+ run "chmod -fR g+w #{latest_release}" if fetch(:group_writable, true)
212
+ end
213
+
214
+ desc <<-DESC
215
+ [internal] Symlinks shared paths, like uploads, into the release.
216
+ DESC
217
+ task :symlink_shared_paths, :except => { :no_release => true } do
218
+ run <<-CMD
219
+ rm -rf #{latest_release}/public/wp-content/uploads &&
220
+ ln -s #{shared_path}/uploads #{latest_release}/public/wp-content/uploads
221
+ CMD
222
+ end
223
+
224
+ desc <<-DESC
225
+ [internal] Symlinks the shared wp-config.php into the release.
226
+ DESC
227
+ task :config, :except => { :no_release => true } do
228
+ run <<-CMD
229
+ rm -f #{latest_release}/public/wp-config.php &&
230
+ ln -s #{shared_path}/wp-config.php #{latest_release}/public/wp-config.php
231
+ CMD
232
+ end
233
+ end
234
+
235
+ desc <<-DESC
236
+ [internal] Updates the symlink to the most recently deployed version. Capistrano works \
237
+ by putting each new release of your application in its own directory. When \
238
+ you deploy a new version, this task's job is to update the `current' symlink \
239
+ to point at the new version. You will rarely need to call this task \
240
+ directly; instead, use the `deploy' task (which performs a complete \
241
+ deploy, including `restart') or the 'update' task (which does everything \
242
+ except `restart').
243
+ DESC
244
+ task :symlink, :except => { :no_release => true } do
245
+ on_rollback { run "rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true" }
246
+ run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}"
247
+ end
248
+
249
+ desc <<-DESC
250
+ Rolls back to a previous version. This is handy if you ever \
251
+ discover that you've deployed a lemon; `cap rollback' and you're right \
252
+ back where you were, on the previously deployed version.
253
+ DESC
254
+ task :rollback do
255
+ if releases.length < 2
256
+ abort "could not rollback the code because there is no prior release"
257
+ else
258
+ run "rm #{current_path}; ln -s #{previous_release} #{current_path} && rm -rf #{current_release}"
259
+ end
260
+ end
261
+
262
+ namespace :database do
263
+ desc <<-DESC
264
+ Backup the database. This is HIGHLY recommended before upgrading \
265
+ Wordpress.
266
+
267
+ Backups may be restored manually by running
268
+ \#{shared_path}/backups/restore filename.sql.gz.
269
+ DESC
270
+ task :backup do
271
+ run "mysqldump -u #{database_username} -p#{database_password} --compress --opt --lock-tables=false --skip-add-locks --skip-extended-insert #{database_name} | gzip > #{shared_path}/backups/#{release_name}.sql.gz"
272
+ end
273
+ end
274
+
275
+ namespace :plugins do
276
+ desc 'Disable all plugins.'
277
+ task :disable do
278
+ run "mysql -u #{database_username} -p#{database_password} -e 'update wp_options set option_value=\"a:0:{}\" where option_name=\"active_plugins\"' #{database_name}"
279
+ end
280
+ end
281
+
282
+ desc 'Backup the database, disable all plugins, and deploy.'
283
+ task :upgrade do
284
+ database.backup
285
+ plugins.disable
286
+ deploy.default
287
+ puts 'You should now visit wp-admin/upgrade.php and manually reactivate your plugins.'
288
+ end
289
+
290
+ desc <<-DESC
291
+ Clean up old releases. By default, the last 5 releases are kept on each \
292
+ server (though you can change this with the keep_releases variable). All \
293
+ other deployed revisions are removed from the servers. By default, this \
294
+ will use sudo to clean up the old releases, but if sudo is not available \
295
+ for your environment, set the :use_sudo variable to false instead.
296
+ DESC
297
+ task :cleanup, :except => { :no_release => true } do
298
+ count = fetch(:keep_releases, 5).to_i
299
+ if count >= releases.length
300
+ logger.important "no old releases to clean up"
301
+ else
302
+ logger.info "keeping #{count} of #{releases.length} deployed releases"
303
+
304
+ directories = (releases - releases.last(count)).map { |release|
305
+ File.join(releases_path, release) }.join(" ")
306
+
307
+ invoke_command "rm -rf #{directories}", :via => run_method
308
+ end
309
+ end
310
+
311
+ namespace :pending do
312
+ desc <<-DESC
313
+ Displays the `diff' since your last deploy. This is useful if you want \
314
+ to examine what changes are about to be deployed. Note that this might \
315
+ not be supported on all SCM's.
316
+ DESC
317
+ task :diff, :except => { :no_release => true } do
318
+ system(source.local.diff(current_revision))
319
+ end
320
+
321
+ desc <<-DESC
322
+ Displays the commits since your last deploy. This is good for a summary \
323
+ of the changes that have occurred since the last deploy. Note that this \
324
+ might not be supported on all SCM's.
325
+ DESC
326
+ task :default, :except => { :no_release => true } do
327
+ from = source.next_revision(current_revision)
328
+ system(source.local.log(from))
329
+ end
330
+ end
331
+ end
332
+ end
@@ -0,0 +1,10 @@
1
+ unless File.exists?(File.join(WORDPRESS_ROOT, 'config', 'wp-config.php'))
2
+ $stderr.puts "You'll need to set up config/wp-config.php before running the server."
3
+ $stderr.puts "(Hint: config/wp-config-sample.php.)"
4
+ exit 1
5
+ end
6
+
7
+ ENV['WORDPRESS_ROOT'] ||= WORDPRESS_ROOT
8
+ ENV['PHP_FASTCGI'] ||= `which php-cgi`.strip
9
+ Dir.mkdir(File.join(WORDPRESS_ROOT, 'tmp', 'sockets')) unless File.exists?(File.join(WORDPRESS_ROOT, 'tmp', 'sockets'))
10
+ exec 'lighttpd', '-D', '-f', File.join(WORDPRESS_ROOT, 'config', 'lighttpd.conf'), *ARGV
data/lib/wordpress.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'wordpress/release'
2
+
3
+ module Wordpress #:nodoc:
4
+ VERSION = '0.6.0'
5
+
6
+ def self.config(options={})
7
+ config = release.contents('wp-config-sample.php')
8
+ options.each do |key, value|
9
+ config.sub! /'#{key.to_s.upcase}',(.*?)'.*?'/m do |match|
10
+ "'#{key.to_s.upcase}',#{$1}'#{value}'"
11
+ end
12
+ end
13
+ config
14
+ end
15
+
16
+ def self.release
17
+ @@release ||= Release.new
18
+ end
19
+ end
20
+
21
+ require 'wordpress/cli'
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: matthewtodd-wordpress
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Todd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-02 00:00:00 -08:00
13
+ default_executable: wordpressify
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: capistrano
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.2.0
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: matthewtodd-wordpress-release
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
32
+ version:
33
+ description:
34
+ email: matthew.todd@gmail.com
35
+ executables:
36
+ - wordpressify
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - CHANGELOG.rdoc
41
+ - README.rdoc
42
+ - TODO.rdoc
43
+ files:
44
+ - CHANGELOG.rdoc
45
+ - README.rdoc
46
+ - TODO.rdoc
47
+ - bin/wordpressify
48
+ - lib/wordpress/cli.rb
49
+ - lib/wordpress/recipes/deploy.rb
50
+ - lib/wordpress/servers/lighttpd.rb
51
+ - lib/wordpress.rb
52
+ has_rdoc: true
53
+ homepage:
54
+ post_install_message:
55
+ rdoc_options:
56
+ - --main
57
+ - README.rdoc
58
+ - --title
59
+ - wordpress-0.6.0
60
+ - --inline-source
61
+ - --line-numbers
62
+ - --all
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.2.0
81
+ signing_key:
82
+ specification_version: 2
83
+ summary: Automates creating, upgrading and deploying a Wordpress installation.
84
+ test_files: []
85
+