wp-capistrano 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/LICENCE +13 -0
- data/README.rdoc +48 -33
- data/VERSION +1 -1
- data/bin/wpcapify +96 -0
- data/lib/wp-capistrano/deploy.rb +122 -0
- data/lib/wp-capistrano/feature/cforms.rb +8 -0
- data/lib/wp-capistrano/feature/htaccess.rb +9 -0
- data/lib/wp-capistrano/feature/plugin-install.rb +14 -0
- data/lib/wp-capistrano/feature/sass.rb +22 -0
- data/lib/wp-capistrano/feature/shared-dirs.rb +70 -0
- data/lib/wp-capistrano/feature/wp-super-cache.rb +39 -0
- data/lib/{wp_capistrano/namespace/wp.rb → wp-capistrano/setup.rb} +14 -8
- data/lib/{wp_capistrano → wp-capistrano}/wp-config.php.erb +8 -0
- data/lib/wp-capistrano.rb +100 -0
- data/lib/{wp_config.rb → wp-config.rb} +0 -0
- data/lib/wp_capistrano/deploy.rb +2 -92
- metadata +20 -14
- data/lib/wp_capistrano/namespace/deploy.rb +0 -97
- data/lib/wp_capistrano/namespace/setup.rb +0 -66
- data/lib/wp_generate/generator/capify.rb +0 -10
- data/lib/wp_generate/templates/capify/Capfile +0 -2
- data/lib/wp_generate/templates/capify/config.yml +0 -38
data/.gitignore
ADDED
data/LICENCE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright © 2010, The Dextrous Web
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
9
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -4,58 +4,73 @@ Capistrano receipe for WordPress
|
|
4
4
|
|
5
5
|
== Usage
|
6
6
|
|
7
|
-
|
7
|
+
gem install wp-capistrano
|
8
|
+
cd /path/to/wordpress/wp-content
|
9
|
+
wpcapify .
|
10
|
+
vim lib/config.yml
|
11
|
+
cap setup # once
|
12
|
+
cap deploy
|
8
13
|
|
9
|
-
|
14
|
+
Configuration options:
|
10
15
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
-
|
16
|
+
[application.repository] The repository that contains wp-content
|
17
|
+
[wordpress.repository] By default, it uses our GitHub mirror
|
18
|
+
[wordpress.version] A git tree-ish, which can be a branch name, tag, or a commit hash (e.g. v3.0.1)
|
19
|
+
[deploy.*] These names are used when doing cap deploy when deploying to non-default environments (i.e. cap production deploy)
|
20
|
+
[deploy.*.default] Set this to true to make this the default target
|
21
|
+
[deploy.*.ssh_user] The deploy user (who should have write access to +path+ on the remote machine)
|
22
|
+
[deploy.*.ssh_domain] The host where the site lives
|
23
|
+
[deploy.*.path] The path on the remote machine
|
24
|
+
[deploy.*.vhost] The HTTP hostname - sets WP_HOME and WP_SITEURL
|
25
|
+
[deploy.*.database.*] All the database settings (name, user, host, password)
|
26
|
+
[deploy.*.modules] A list of modules that should be enabled
|
20
27
|
|
21
|
-
|
28
|
+
Before you run <tt>cap setup</tt> or <tt>cap deploy</tt>, you should ensure the path on the remote machine exists and is chmodded such that the deploy user can write to it.
|
22
29
|
|
23
|
-
|
30
|
+
To deploy to production rather than staging, for instance:
|
24
31
|
|
25
|
-
|
32
|
+
cap production deploy
|
26
33
|
|
27
|
-
|
34
|
+
== Modules
|
28
35
|
|
29
|
-
|
36
|
+
These are configured in deploy.*.modules:
|
30
37
|
|
31
|
-
|
38
|
+
[plugin-install] Makes the plugin directory writable by all, and creates the upgrade directory
|
39
|
+
[shared-dirs] Copies local directory to remote machine at setup time, and makes it writable by all
|
40
|
+
[wp-super-cache] Sets up WP Super Cache, including wp-config, and setting up the appropriate cache directories
|
32
41
|
|
33
|
-
|
42
|
+
Note: Some modules are set with a string, others are set with a hash. For instance:
|
34
43
|
|
35
|
-
|
44
|
+
- modules:
|
45
|
+
- plugin-install
|
46
|
+
- shared-dirs:
|
47
|
+
- plugins
|
48
|
+
- uploads
|
49
|
+
- wp-super-cache
|
36
50
|
|
37
|
-
|
38
|
-
cap production deploy
|
39
|
-
|
40
|
-
== Additional features
|
51
|
+
== Automagic features
|
41
52
|
|
42
53
|
=== SASS
|
43
54
|
|
44
|
-
If there exists wp-content/themes/*/*/sass_output.php it will be executed
|
55
|
+
If there exists wp-content/themes/*/*/sass_output.php it will be executed locally and its contents will be uploaded as sass_output.css. Then style.css will be sedded to s/\.php/\.css/.
|
56
|
+
|
57
|
+
A sample sass_output.php can be found in wp-generate ( http://github.com/dxw/wp-generate ).
|
45
58
|
|
46
|
-
|
59
|
+
=== htaccess
|
47
60
|
|
48
|
-
|
61
|
+
Uploads ./htaccess to .htaccess if it exists.
|
49
62
|
|
50
|
-
|
63
|
+
=== Fixing plugins
|
51
64
|
|
52
|
-
|
53
|
-
cd wp-content
|
54
|
-
wp-generate capify
|
65
|
+
Some plugins require esoteric setups. We fix these automatically:
|
55
66
|
|
56
|
-
|
67
|
+
- Cforms
|
57
68
|
|
58
69
|
== Credits
|
59
70
|
|
60
|
-
|
61
|
-
http://github.com/jestro/wordpress-capistrano
|
71
|
+
[Main author] Tom Adams <tom@thedextrousweb.com>
|
72
|
+
[Some code] http://github.com/jestro/wordpress-capistrano
|
73
|
+
|
74
|
+
== Copyright
|
75
|
+
|
76
|
+
Copyright © 2010 The Dextrous Web. See LICENCE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/wpcapify
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
FILES = {
|
7
|
+
'Capfile' => <<-END,
|
8
|
+
load 'deploy'
|
9
|
+
require 'wp-capistrano'
|
10
|
+
END
|
11
|
+
'lib/config.yml' => <<-END
|
12
|
+
---
|
13
|
+
application:
|
14
|
+
repository: git@github.com:user/repo.git
|
15
|
+
wordpress:
|
16
|
+
repository: git://github.com/dxw/wordpress.git
|
17
|
+
version: v3.0.1
|
18
|
+
deploy:
|
19
|
+
base: &base
|
20
|
+
ssh_user: deploy
|
21
|
+
ssh_domain: example.org
|
22
|
+
modules:
|
23
|
+
- shared-dirs:
|
24
|
+
- uploads
|
25
|
+
staging:
|
26
|
+
<<: *base
|
27
|
+
default: true
|
28
|
+
path: /var/vhosts/example.org/staging/www
|
29
|
+
vhost: staging.example.org
|
30
|
+
database:
|
31
|
+
name: example_staging
|
32
|
+
user: root
|
33
|
+
production:
|
34
|
+
<<: *base
|
35
|
+
path: /var/vhosts/example.org/www
|
36
|
+
vhost: example.org
|
37
|
+
database:
|
38
|
+
name: example_production
|
39
|
+
user: root
|
40
|
+
END
|
41
|
+
}
|
42
|
+
|
43
|
+
opt = OptionParser.new do |opts|
|
44
|
+
opts.banner = "Usage: wpcapify PATH"
|
45
|
+
end
|
46
|
+
|
47
|
+
argv = opt.parse(ARGV)
|
48
|
+
|
49
|
+
if argv.empty?
|
50
|
+
warn "Please specify the directory to wpcapify, e.g. `wpcapify .'"
|
51
|
+
exit 1
|
52
|
+
elsif argv.length > 1
|
53
|
+
warn "Too many arguments; please specify only the directory to wpcapify."
|
54
|
+
exit 1
|
55
|
+
else
|
56
|
+
dir = argv.first
|
57
|
+
|
58
|
+
# Do something really clever (set application/repository automagically)
|
59
|
+
|
60
|
+
app_repo = nil
|
61
|
+
Dir.chdir(dir) do
|
62
|
+
f = `git remote -v 2>/dev/null`
|
63
|
+
f.each do |l|
|
64
|
+
if m = l.match(/^origin\s+(.+)\s+\(fetch\)$/)
|
65
|
+
app_repo = m[1]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
FILES['lib/config.yml'].sub!('git@github.com:user/repo.git', app_repo) if app_repo
|
70
|
+
|
71
|
+
# Write files
|
72
|
+
|
73
|
+
FILES.each do |path,content|
|
74
|
+
reported_path = File.join(dir, path)
|
75
|
+
exact_path = File.expand_path(reported_path)
|
76
|
+
|
77
|
+
if File.exist? exact_path
|
78
|
+
warn "[skip] '#{reported_path}' already exists"
|
79
|
+
else
|
80
|
+
d = File.dirname(exact_path)
|
81
|
+
|
82
|
+
unless File.exist? d
|
83
|
+
FileUtils.mkdir_p(d)
|
84
|
+
warn "[add] making directory '#{File.dirname(reported_path)}'"
|
85
|
+
end
|
86
|
+
|
87
|
+
open(exact_path,'w') do |f|
|
88
|
+
f.write(content)
|
89
|
+
end
|
90
|
+
warn "[add] writing '#{reported_path}'"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
warn "[done] wpcapified!"
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :deploy do
|
3
|
+
|
4
|
+
desc "Override deploy restart to not do anything"
|
5
|
+
task :restart do
|
6
|
+
end
|
7
|
+
|
8
|
+
task :finalize_update, :except => { :no_release => true } do
|
9
|
+
run "chmod -R g+w #{latest_release}"
|
10
|
+
|
11
|
+
# I've got submodules in my submodules
|
12
|
+
#run "cd #{latest_release} && git submodule foreach --recursive git submodule update --init"
|
13
|
+
# Git 1.5-compatability:
|
14
|
+
run "cd #{latest_release} && DIR=`pwd` && for D in `grep '^\\[submodule' .git/config | cut -d\\\" -f2`; do cd $DIR/$D && git submodule init && git submodule update; done"
|
15
|
+
|
16
|
+
run <<-CMD
|
17
|
+
mkdir -p #{latest_release}/finalized &&
|
18
|
+
cp -rv #{shared_path}/wordpress/* #{latest_release}/finalized/ &&
|
19
|
+
rm -rf #{latest_release}/finalized/wp-content &&
|
20
|
+
mkdir #{latest_release}/finalized/wp-content &&
|
21
|
+
rm -rf #{latest_release}/**/.git &&
|
22
|
+
mkdir -p #{latest_release}/finalized/wp-content/cache/ ;
|
23
|
+
chmod -R 777 #{latest_release}/finalized/wp-content/cache/ ;
|
24
|
+
true
|
25
|
+
CMD
|
26
|
+
|
27
|
+
set :content_dirs, {'themes' => :copy,
|
28
|
+
'uploads' => :copy,
|
29
|
+
'plugins' => :copy}
|
30
|
+
|
31
|
+
deploy.content_dirs_configure
|
32
|
+
|
33
|
+
content_dirs.each_pair do |dir,action|
|
34
|
+
dest = "#{latest_release}/finalized/wp-content/"
|
35
|
+
case action
|
36
|
+
when :copy
|
37
|
+
run "cp -rv #{latest_release}/#{dir} #{dest}"
|
38
|
+
when :link then 'ln -s'
|
39
|
+
run "ln -s #{shared_path}/#{dir} #{dest}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
deploy.wp_config
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
# A dummy task to collect content_dirs
|
48
|
+
task :content_dirs_configure do
|
49
|
+
end
|
50
|
+
|
51
|
+
# A dummy task to collect wp-config.php constants
|
52
|
+
task :wp_config_configure do
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Copy shared wp-config into place, adding per-deploy constants"
|
56
|
+
task :wp_config do
|
57
|
+
## Generate a couple of PHP fragments
|
58
|
+
|
59
|
+
# nb:
|
60
|
+
# - in a string=>string pair, the value represents a PHP literal (i.e. it includes the quotes)
|
61
|
+
# the key, however, is a string
|
62
|
+
# - the convention is to put things into preconfig unless there's a reason not to
|
63
|
+
set :preconfig, {}
|
64
|
+
set :postconfig, {}
|
65
|
+
# For certain cases we may allow the user write access (i.e. module plugin-install)
|
66
|
+
# it should always be direct filesystem access (and WordPress' autodetection is pants)
|
67
|
+
preconfig['FS_METHOD'] = "'direct'"
|
68
|
+
|
69
|
+
# Allow modules a chance to interfere
|
70
|
+
deploy.wp_config_configure
|
71
|
+
|
72
|
+
def phpize(h)
|
73
|
+
s = []
|
74
|
+
h.each_pair do |k,v|
|
75
|
+
s << "define('#{k}', #{v});"
|
76
|
+
end
|
77
|
+
s.join("\n")
|
78
|
+
end
|
79
|
+
|
80
|
+
prestring = phpize(preconfig)
|
81
|
+
poststring = phpize(postconfig)
|
82
|
+
|
83
|
+
## Upload fragments
|
84
|
+
|
85
|
+
run "mkdir -p #{latest_release}/build"
|
86
|
+
put prestring, "#{latest_release}/build/pre-config"
|
87
|
+
put poststring, "#{latest_release}/build/post-config"
|
88
|
+
|
89
|
+
## sed them into wp-config (using perl)
|
90
|
+
r = "cp -rv #{shared_path}/wp-config.php #{latest_release}/wp-config.php &&"
|
91
|
+
|
92
|
+
%w[pre post].each do |pp|
|
93
|
+
f = "#{latest_release}/build/#{pp}-config"
|
94
|
+
r += %Q`perl -i -pe 'BEGIN{undef $/;open(F,"<#{f}");@f=<F>;$f=join("",@f);}s/## #{pp.upcase}CONFIG BEGIN.*## #{pp.upcase}CONFIG END./$f/ms' #{latest_release}/wp-config.php &&`
|
95
|
+
end
|
96
|
+
|
97
|
+
r += "cp -rv #{latest_release}/wp-config.php #{latest_release}/finalized/wp-config.php"
|
98
|
+
|
99
|
+
run r
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
task :symlink, :except => { :no_release => true } do
|
104
|
+
on_rollback do
|
105
|
+
if previous_release
|
106
|
+
run "rm -f #{current_path}; ln -s #{previous_release}/finalized #{current_path}; true"
|
107
|
+
else
|
108
|
+
logger.important "no previous release to rollback to, rollback of symlink skipped"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
run "rm -f #{current_path} && ln -s #{latest_release}/finalized #{current_path}"
|
113
|
+
end
|
114
|
+
|
115
|
+
namespace :revision do
|
116
|
+
task :revision do
|
117
|
+
puts 'hhh'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Make the cforms plugin work
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
after 'deploy:finalize_update' do
|
5
|
+
cforms_dir = "#{latest_release}/finalized/wp-content/plugins/cforms"
|
6
|
+
run(%Q%[ -e #{cforms_dir} ] && echo '<?php $abspath="#{latest_release}/finalized/" ?>' > #{cforms_dir}/abspath.php ; true%)
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Allow plugin installation by end-users
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
after 'deploy:finalize_update' do
|
5
|
+
|
6
|
+
if deploy_profile.modules.include? 'plugin-install'
|
7
|
+
|
8
|
+
run("mkdir -p #{latest_release}/finalized/wp-content/upgrade &&
|
9
|
+
chmod -R 777 #{latest_release}/finalized/wp-content/upgrade &&
|
10
|
+
chmod -R 777 #{latest_release}/finalized/wp-content/plugins ; true")
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Assumes you're using DXW's sass_output.php convention
|
2
|
+
# A sample can be found in dxw/wp-generate:
|
3
|
+
# http://github.com/dxw/wp-generate/blob/master/lib/wp_generate/templates/theme/sass/sass_output.php
|
4
|
+
|
5
|
+
Capistrano::Configuration.instance.load do
|
6
|
+
after 'deploy:finalize_update' do
|
7
|
+
Dir.glob("themes/*/*/sass_output.php").map {|d| d.match(%r&/([^/]+)/([^/]+)/sass_output.php$&)[1,2]}[0..0].each do |theme_dir,sass_dir|
|
8
|
+
|
9
|
+
# Run sass_output.php
|
10
|
+
f = IO.popen("cd themes/#{theme_dir}/#{sass_dir} && php sass_output.php 2>/dev/null")
|
11
|
+
sass_output = f.readlines.join
|
12
|
+
remote_sass = "#{latest_release}/finalized/wp-content/themes/#{theme_dir}/#{sass_dir}/sass_output.css"
|
13
|
+
|
14
|
+
# Upload it
|
15
|
+
put(sass_output, remote_sass, :via => :scp)
|
16
|
+
|
17
|
+
# sed style.css to point to it
|
18
|
+
run("sed -i 's/\.php/\.css/' #{latest_release}/finalized/wp-content/themes/#{theme_dir}/style.css &&
|
19
|
+
chmod a+r #{remote_sass}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Shared directories get uploaded at setup-time and don't change
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
after 'set_target_' do
|
5
|
+
|
6
|
+
# Parse config
|
7
|
+
set :shared_dirs, []
|
8
|
+
deploy_profile.modules.select{|m|m.is_a?(Hash) && m['shared-dirs']}.each do |m|
|
9
|
+
m['shared-dirs'].each do |mm|
|
10
|
+
shared_dirs << mm
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
after 'setup:checkout' do
|
17
|
+
|
18
|
+
# Upload dirs
|
19
|
+
shared_dirs.each do |dir|
|
20
|
+
stop = false
|
21
|
+
|
22
|
+
# If it already exists, stop
|
23
|
+
run("ls -d #{shared_path}/#{dir} ; true") do |channel,stream,data|
|
24
|
+
if data.strip=="#{shared_path}/#{dir}"
|
25
|
+
STDERR.puts "*** #{dir} dir already exists. Not re-uploading."
|
26
|
+
stop = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
unless stop
|
31
|
+
# If we have it, upload it
|
32
|
+
if File.exist?(dir)
|
33
|
+
begin
|
34
|
+
upload(dir, shared_path, :recursive => true, :via => :scp)
|
35
|
+
rescue
|
36
|
+
STDERR.puts "*** #{dir} dir already exists and does not belong to us. Can't re-upload."
|
37
|
+
stop = true
|
38
|
+
end
|
39
|
+
else
|
40
|
+
run "mkdir -p #{shared_path}/#{dir}"
|
41
|
+
end
|
42
|
+
|
43
|
+
unless stop
|
44
|
+
# Let our Web server write to it
|
45
|
+
run "chmod -R 777 #{shared_path}/#{dir}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
before 'deploy:wp_config_configure' do
|
53
|
+
|
54
|
+
if shared_dirs.include? 'plugins'
|
55
|
+
preconfig['WP_PLUGIN_DIR'] = "'#{shared_path}/plugins'"
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
before 'deploy:content_dirs_configure' do
|
61
|
+
p 'hihi'
|
62
|
+
|
63
|
+
p shared_dirs
|
64
|
+
|
65
|
+
shared_dirs.each do |dir|
|
66
|
+
content_dirs[dir] = :link
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# WP Super Cache
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
|
5
|
+
before 'deploy:wp_config_configure' do
|
6
|
+
if deploy_profile.modules.include? 'wp-super-cache'
|
7
|
+
preconfig['WP_CACHE'] = "'true'"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
after 'deploy:finalize_update' do
|
12
|
+
|
13
|
+
if File.exist? 'plugins/wp-super-cache/advanced-cache.php'
|
14
|
+
top.upload("plugins/wp-super-cache/advanced-cache.php", "#{latest_release}/finalized/wp-content/" , :via => :scp)
|
15
|
+
sedable_path = "#{latest_release}/finalized/wp-content/plugins/wp-super-cache/".gsub(/\//,'\/')
|
16
|
+
run("sed -i 's/CACHEHOME/#{sedable_path}/g' #{latest_release}/finalized/wp-content/advanced-cache.php")
|
17
|
+
else
|
18
|
+
raise IOError, 'Are you sure you have the WP Super Cache plugin?'
|
19
|
+
end
|
20
|
+
|
21
|
+
if File.exist? 'wp-cache-config.php'
|
22
|
+
top.upload("wp-cache-config.php", "#{latest_release}/finalized/wp-content/" , :via => :scp)
|
23
|
+
elsif File.exist? 'plugins/wp-super-cache/wp-cache-config-sample.php'
|
24
|
+
top.upload("plugins/wp-super-cache/wp-cache-config-sample.php", "#{latest_release}/finalized/wp-content/wp-cache-config.php" , :via => :scp)
|
25
|
+
else
|
26
|
+
raise IOError, 'Are you sure you have the WP Super Cache plugin?'
|
27
|
+
end
|
28
|
+
|
29
|
+
run("mkdir -p #{latest_release}/finalized/wp-content/cache/blogs &&
|
30
|
+
mkdir -p #{latest_release}/finalized/wp-content/cache/meta")
|
31
|
+
|
32
|
+
# Keep writables to a bare minimum
|
33
|
+
if deploy_profile.modules.include? 'wp-super-cache'
|
34
|
+
run("chmod -R 777 #{latest_release}/finalized/wp-content/cache &&
|
35
|
+
chmod -R 777 #{latest_release}/finalized/wp-content/wp-cache-config.php")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -1,5 +1,15 @@
|
|
1
1
|
Capistrano::Configuration.instance.load do
|
2
|
-
namespace :
|
2
|
+
namespace :setup do
|
3
|
+
|
4
|
+
desc "Setup this server for a new wordpress site."
|
5
|
+
task :default do
|
6
|
+
# Capistrano's setup script
|
7
|
+
deploy.setup
|
8
|
+
|
9
|
+
# Our setup scripts
|
10
|
+
setup.config
|
11
|
+
setup.checkout
|
12
|
+
end
|
3
13
|
|
4
14
|
desc "Checks out a copy of wordpress to a shared location"
|
5
15
|
task :checkout do
|
@@ -9,20 +19,16 @@ Capistrano::Configuration.instance.load do
|
|
9
19
|
run "cd #{shared_path}/wordpress && git fetch --tags && git checkout #{wordpress_version}"
|
10
20
|
end
|
11
21
|
|
12
|
-
desc "Sets up wp-config.php"
|
22
|
+
desc "Sets up shared wp-config.php"
|
13
23
|
task :config do
|
14
|
-
file = File.join(File.dirname(__FILE__), "
|
24
|
+
file = File.join(File.dirname(__FILE__), "wp-config.php.erb")
|
15
25
|
template = File.read(file)
|
26
|
+
|
16
27
|
buffer = ERB.new(template).result(binding)
|
17
28
|
|
18
29
|
put buffer, "#{shared_path}/wp-config.php"
|
19
30
|
puts "New wp-config.php uploaded! Please run cap:deploy to activate these changes."
|
20
31
|
end
|
21
32
|
|
22
|
-
desc "Sets up .htaccess"
|
23
|
-
task :htaccess do
|
24
|
-
run 'env echo -e \'<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase /\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /index.php [L]\n</IfModule>\' > '"#{shared_path}/htaccess"
|
25
|
-
end
|
26
|
-
|
27
33
|
end
|
28
34
|
end
|
@@ -21,6 +21,10 @@
|
|
21
21
|
* @package WordPress
|
22
22
|
*/
|
23
23
|
|
24
|
+
## PRECONFIG BEGIN
|
25
|
+
# Anything between these tags will be removed.
|
26
|
+
## PRECONFIG END
|
27
|
+
|
24
28
|
// ** MySQL settings - You can get this info from your web host ** //
|
25
29
|
/** The name of the database for WordPress */
|
26
30
|
define('DB_NAME', '<%= wordpress_db_name %>');
|
@@ -84,6 +88,10 @@ define ('WPLANG', '');
|
|
84
88
|
if ( !defined('ABSPATH') )
|
85
89
|
define('ABSPATH', dirname(__FILE__) . '/');
|
86
90
|
|
91
|
+
## POSTCONFIG BEGIN
|
92
|
+
# Anything between these tags will be removed.
|
93
|
+
## POSTCONFIG END
|
94
|
+
|
87
95
|
/** Sets up WordPress vars and included files. */
|
88
96
|
require_once(ABSPATH . 'wp-settings.php');
|
89
97
|
?>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'digest'
|
3
|
+
require 'digest/sha1'
|
4
|
+
|
5
|
+
require 'wp-config'
|
6
|
+
require 'wp-capistrano/deploy'
|
7
|
+
require 'wp-capistrano/setup'
|
8
|
+
|
9
|
+
# Features
|
10
|
+
require 'wp-capistrano/feature/cforms'
|
11
|
+
require 'wp-capistrano/feature/htaccess'
|
12
|
+
require 'wp-capistrano/feature/plugin-install'
|
13
|
+
require 'wp-capistrano/feature/sass'
|
14
|
+
require 'wp-capistrano/feature/shared-dirs'
|
15
|
+
require 'wp-capistrano/feature/wp-super-cache'
|
16
|
+
|
17
|
+
Capistrano::Configuration.instance.load do
|
18
|
+
default_run_options[:pty] = true
|
19
|
+
|
20
|
+
# Dummy task
|
21
|
+
task :set_target_ do
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_target target
|
25
|
+
tt = WPConfig.instance.h['deploy'][target]
|
26
|
+
if tt
|
27
|
+
t = OpenStruct.new(tt)
|
28
|
+
set :domain, t.ssh_domain
|
29
|
+
set :user, t.ssh_user
|
30
|
+
set :deploy_to, t.path
|
31
|
+
set :wordpress_domain, t.vhost
|
32
|
+
set :wordpress_domain, 'localhost' if wordpress_domain.nil?
|
33
|
+
set :wordpress_db_name, t.database.name
|
34
|
+
set :wordpress_db_user, t.database.user
|
35
|
+
set :wordpress_db_user, 'root' if wordpress_db_user.nil?
|
36
|
+
set :wordpress_db_password, t.database.password
|
37
|
+
set :wordpress_db_host, t.database.host
|
38
|
+
set :wordpress_db_host, 'localhost' if wordpress_db_host.nil?
|
39
|
+
set :use_sudo, t.use_sudo
|
40
|
+
set :deploy_profile, t
|
41
|
+
deploy_profile.modules = [] unless deploy_profile.modules
|
42
|
+
|
43
|
+
@roles = {}
|
44
|
+
role :app, domain
|
45
|
+
role :web, domain
|
46
|
+
role :db, domain, :primary => true
|
47
|
+
end
|
48
|
+
|
49
|
+
# Allow features to plug in here
|
50
|
+
set_target_
|
51
|
+
end
|
52
|
+
|
53
|
+
WPConfig.instance.h['deploy'].each_pair do |k,v|
|
54
|
+
task k do
|
55
|
+
set_target k
|
56
|
+
end
|
57
|
+
set_target k if v['default']
|
58
|
+
end
|
59
|
+
|
60
|
+
# Load from config
|
61
|
+
set :wordpress_version, WPConfig.wordpress.version
|
62
|
+
set :wordpress_git_url, WPConfig.wordpress.repository
|
63
|
+
set :repository, WPConfig.application.repository
|
64
|
+
|
65
|
+
# Everything else
|
66
|
+
set :scm, "git"
|
67
|
+
set :deploy_via, :remote_cache
|
68
|
+
set :branch, "master"
|
69
|
+
set :git_shallow_clone, 1
|
70
|
+
set :git_enable_submodules, 1
|
71
|
+
set :wordpress_db_host, "localhost"
|
72
|
+
set :wordpress_auth_key, Digest::SHA1.hexdigest(rand.to_s)
|
73
|
+
set :wordpress_secure_auth_key, Digest::SHA1.hexdigest(rand.to_s)
|
74
|
+
set :wordpress_logged_in_key, Digest::SHA1.hexdigest(rand.to_s)
|
75
|
+
set :wordpress_nonce_key, Digest::SHA1.hexdigest(rand.to_s)
|
76
|
+
|
77
|
+
#allow deploys w/o having git installed locally
|
78
|
+
set(:real_revision) do
|
79
|
+
output = ""
|
80
|
+
invoke_command("git ls-remote #{repository} #{branch} | cut -f 1", :once => true) do |ch, stream, data|
|
81
|
+
case stream
|
82
|
+
when :out
|
83
|
+
if data =~ /\(yes\/no\)\?/ # first time connecting via ssh, add to known_hosts?
|
84
|
+
ch.send_data "yes\n"
|
85
|
+
elsif data =~ /Warning/
|
86
|
+
elsif data =~ /yes/
|
87
|
+
#
|
88
|
+
else
|
89
|
+
output << data
|
90
|
+
end
|
91
|
+
when :err then warn "[err :: #{ch[:server]}] #{data}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
output.gsub(/\\/, '').chomp
|
95
|
+
end
|
96
|
+
|
97
|
+
#no need for log and pids directory
|
98
|
+
set :shared_children, %w(system)
|
99
|
+
|
100
|
+
end
|
File without changes
|
data/lib/wp_capistrano/deploy.rb
CHANGED
@@ -1,92 +1,2 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'digest'
|
4
|
-
require 'digest/sha1'
|
5
|
-
|
6
|
-
require 'wp_capistrano/namespace/deploy'
|
7
|
-
require 'wp_capistrano/namespace/setup'
|
8
|
-
require 'wp_capistrano/namespace/wp'
|
9
|
-
|
10
|
-
Capistrano::Configuration.instance.load do
|
11
|
-
default_run_options[:pty] = true
|
12
|
-
|
13
|
-
def set_target target
|
14
|
-
tt = WPConfig.instance.h['deploy'][target]
|
15
|
-
if tt
|
16
|
-
t = OpenStruct.new(tt)
|
17
|
-
set :domain, t.ssh_domain
|
18
|
-
set :user, t.ssh_user
|
19
|
-
set :deploy_to, t.path
|
20
|
-
set :wordpress_domain, t.vhost
|
21
|
-
set :wordpress_domain, 'localhost' if wordpress_domain.nil?
|
22
|
-
set :wordpress_db_name, t.database.name
|
23
|
-
set :wordpress_db_user, t.database.user
|
24
|
-
set :wordpress_db_user, 'root' if wordpress_db_user.nil?
|
25
|
-
set :wordpress_db_password, t.database.password
|
26
|
-
set :wordpress_db_host, t.database.host
|
27
|
-
set :wordpress_db_host, 'localhost' if wordpress_db_host.nil?
|
28
|
-
set :use_sudo, t.use_sudo
|
29
|
-
set :deploy_profile, t
|
30
|
-
|
31
|
-
@roles = {}
|
32
|
-
role :app, domain
|
33
|
-
role :web, domain
|
34
|
-
role :db, domain, :primary => true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
WPConfig.instance.h['deploy'].each_pair do |k,v|
|
39
|
-
set_target k if v['default']
|
40
|
-
end
|
41
|
-
|
42
|
-
task :testing do
|
43
|
-
set_target 'testing'
|
44
|
-
end
|
45
|
-
task :staging do
|
46
|
-
set_target 'staging'
|
47
|
-
end
|
48
|
-
task :production do
|
49
|
-
set_target 'production'
|
50
|
-
end
|
51
|
-
|
52
|
-
# Load from config
|
53
|
-
set :wordpress_version, WPConfig.wordpress.version
|
54
|
-
set :wordpress_git_url, WPConfig.wordpress.repository
|
55
|
-
set :repository, WPConfig.application.repository
|
56
|
-
|
57
|
-
# Everything else
|
58
|
-
set :scm, "git"
|
59
|
-
set :deploy_via, :remote_cache
|
60
|
-
set :branch, "master"
|
61
|
-
set :git_shallow_clone, 1
|
62
|
-
set :git_enable_submodules, 1
|
63
|
-
set :wordpress_db_host, "localhost"
|
64
|
-
set :wordpress_auth_key, Digest::SHA1.hexdigest(rand.to_s)
|
65
|
-
set :wordpress_secure_auth_key, Digest::SHA1.hexdigest(rand.to_s)
|
66
|
-
set :wordpress_logged_in_key, Digest::SHA1.hexdigest(rand.to_s)
|
67
|
-
set :wordpress_nonce_key, Digest::SHA1.hexdigest(rand.to_s)
|
68
|
-
|
69
|
-
#allow deploys w/o having git installed locally
|
70
|
-
set(:real_revision) do
|
71
|
-
output = ""
|
72
|
-
invoke_command("git ls-remote #{repository} #{branch} | cut -f 1", :once => true) do |ch, stream, data|
|
73
|
-
case stream
|
74
|
-
when :out
|
75
|
-
if data =~ /\(yes\/no\)\?/ # first time connecting via ssh, add to known_hosts?
|
76
|
-
ch.send_data "yes\n"
|
77
|
-
elsif data =~ /Warning/
|
78
|
-
elsif data =~ /yes/
|
79
|
-
#
|
80
|
-
else
|
81
|
-
output << data
|
82
|
-
end
|
83
|
-
when :err then warn "[err :: #{ch[:server]}] #{data}"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
output.gsub(/\\/, '').chomp
|
87
|
-
end
|
88
|
-
|
89
|
-
#no need for log and pids directory
|
90
|
-
set :shared_children, %w(system)
|
91
|
-
|
92
|
-
end
|
1
|
+
warn "[DeprecationWarning] Capfile should not require 'wp_capistrano/deploy' - require 'wp-capistrano instead'"
|
2
|
+
require 'wp-capistrano' # Compatability
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 3
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- The Dextrous Web
|
@@ -14,31 +14,37 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-09-02 00:00:00 +01:00
|
18
|
+
default_executable: wpcapify
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: ""
|
22
22
|
email: tom@thedextrousweb.com
|
23
|
-
executables:
|
24
|
-
|
23
|
+
executables:
|
24
|
+
- wpcapify
|
25
25
|
extensions: []
|
26
26
|
|
27
27
|
extra_rdoc_files:
|
28
28
|
- README.rdoc
|
29
29
|
files:
|
30
|
+
- .gitignore
|
31
|
+
- LICENCE
|
30
32
|
- README.rdoc
|
31
33
|
- Rakefile
|
32
34
|
- VERSION
|
35
|
+
- bin/wpcapify
|
36
|
+
- lib/wp-capistrano.rb
|
37
|
+
- lib/wp-capistrano/deploy.rb
|
38
|
+
- lib/wp-capistrano/feature/cforms.rb
|
39
|
+
- lib/wp-capistrano/feature/htaccess.rb
|
40
|
+
- lib/wp-capistrano/feature/plugin-install.rb
|
41
|
+
- lib/wp-capistrano/feature/sass.rb
|
42
|
+
- lib/wp-capistrano/feature/shared-dirs.rb
|
43
|
+
- lib/wp-capistrano/feature/wp-super-cache.rb
|
44
|
+
- lib/wp-capistrano/setup.rb
|
45
|
+
- lib/wp-capistrano/wp-config.php.erb
|
46
|
+
- lib/wp-config.rb
|
33
47
|
- lib/wp_capistrano/deploy.rb
|
34
|
-
- lib/wp_capistrano/namespace/deploy.rb
|
35
|
-
- lib/wp_capistrano/namespace/setup.rb
|
36
|
-
- lib/wp_capistrano/namespace/wp.rb
|
37
|
-
- lib/wp_capistrano/wp-config.php.erb
|
38
|
-
- lib/wp_config.rb
|
39
|
-
- lib/wp_generate/generator/capify.rb
|
40
|
-
- lib/wp_generate/templates/capify/Capfile
|
41
|
-
- lib/wp_generate/templates/capify/config.yml
|
42
48
|
has_rdoc: true
|
43
49
|
homepage: http://github.com/dxw/wp-capistrano
|
44
50
|
licenses: []
|
@@ -1,97 +0,0 @@
|
|
1
|
-
Capistrano::Configuration.instance.load do
|
2
|
-
namespace :deploy do
|
3
|
-
|
4
|
-
desc "Override deploy restart to not do anything"
|
5
|
-
task :restart do
|
6
|
-
#
|
7
|
-
end
|
8
|
-
|
9
|
-
task :finalize_update, :except => { :no_release => true } do
|
10
|
-
run "chmod -R g+w #{latest_release}"
|
11
|
-
|
12
|
-
# I've got submodules in my submodules
|
13
|
-
#run "cd #{latest_release} && git submodule foreach --recursive git submodule update --init"
|
14
|
-
# Git 1.5-compatability:
|
15
|
-
run "cd #{latest_release} && DIR=`pwd` && for D in `grep '^\\[submodule' .git/config | cut -d\\\" -f2`; do cd $DIR/$D && git submodule init && git submodule update; done"
|
16
|
-
|
17
|
-
deploy.sass
|
18
|
-
|
19
|
-
run <<-CMD
|
20
|
-
mkdir -p #{latest_release}/finalized &&
|
21
|
-
cp -rv #{shared_path}/wordpress/* #{latest_release}/finalized/ &&
|
22
|
-
cp -rv #{shared_path}/wp-config.php #{latest_release}/finalized/wp-config.php &&
|
23
|
-
cp -rv #{shared_path}/htaccess #{latest_release}/finalized/.htaccess &&
|
24
|
-
rm -rf #{latest_release}/finalized/wp-content &&
|
25
|
-
mkdir #{latest_release}/finalized/wp-content &&
|
26
|
-
rm -rf #{latest_release}/**/.git &&
|
27
|
-
cp -rv #{latest_release}/themes #{latest_release}/finalized/wp-content/ &&
|
28
|
-
cp -rv #{latest_release}/plugins #{latest_release}/finalized/wp-content/ &&
|
29
|
-
ln -s #{shared_path}/uploads #{latest_release}/finalized/wp-content/ &&
|
30
|
-
mkdir -p #{latest_release}/finalized/wp-content/cache/ ;
|
31
|
-
chmod -R 777 #{latest_release}/finalized/wp-content/cache/ ;
|
32
|
-
true
|
33
|
-
CMD
|
34
|
-
|
35
|
-
## WP Super Cache
|
36
|
-
|
37
|
-
if deploy_profile.modules and deploy_profile.modules.include? 'wp-super-cache'
|
38
|
-
|
39
|
-
if File.exist? 'plugins/wp-super-cache/advanced-cache.php'
|
40
|
-
top.upload("plugins/wp-super-cache/advanced-cache.php", "#{latest_release}/finalized/wp-content/" , :via => :scp)
|
41
|
-
sedable_path = "#{latest_release}/finalized/wp-content/plugins/wp-super-cache/".gsub(/\//,'\/')
|
42
|
-
run("sed -i 's/CACHEHOME/#{sedable_path}/g' #{latest_release}/finalized/wp-content/advanced-cache.php")
|
43
|
-
else
|
44
|
-
raise IOError, 'Are you sure you have the WP Super Cache plugin?'
|
45
|
-
end
|
46
|
-
|
47
|
-
if File.exist? 'wp-cache-config.php'
|
48
|
-
top.upload("wp-cache-config.php", "#{latest_release}/finalized/wp-content/" , :via => :scp)
|
49
|
-
elsif File.exist? 'plugins/wp-super-cache/wp-cache-config-sample.php'
|
50
|
-
top.upload("plugins/wp-super-cache/wp-cache-config-sample.php", "#{latest_release}/finalized/wp-content/wp-cache-config.php" , :via => :scp)
|
51
|
-
else
|
52
|
-
raise IOError, 'Are you sure you have the WP Super Cache plugin?'
|
53
|
-
end
|
54
|
-
|
55
|
-
#TODO
|
56
|
-
if File.exist? 'htaccess'
|
57
|
-
top.upload("htaccess", "#{latest_release}/finalized/.htaccess" , :via => :scp)
|
58
|
-
end
|
59
|
-
|
60
|
-
run("mkdir -p #{latest_release}/finalized/wp-content/cache/blogs &&
|
61
|
-
mkdir -p #{latest_release}/finalized/wp-content/cache/meta &&
|
62
|
-
chmod -R 777 #{latest_release}/finalized/wp-content/cache &&
|
63
|
-
chmod -R 777 #{latest_release}/finalized/wp-content/wp-cache-config.php")
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
desc "Compile SASS locally and upload it"
|
69
|
-
task :sass do
|
70
|
-
Dir.glob("themes/*/*/sass_output.php").map {|d| d.match(%r&/([^/]+)/([^/]+)/sass_output.php$&)[1,2]}[0..0].each do |theme_dir,sass_dir|
|
71
|
-
p theme_dir
|
72
|
-
p sass_dir
|
73
|
-
system("cd themes/#{theme_dir}/#{sass_dir} && php sass_output.php > sass_output.css")
|
74
|
-
top.upload("themes/#{theme_dir}/#{sass_dir}/sass_output.css", "#{latest_release}/themes/#{theme_dir}/#{sass_dir}/" , :via => :scp)
|
75
|
-
run("sed -i 's/\.php/\.css/' #{latest_release}/themes/#{theme_dir}/style.css")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
task :symlink, :except => { :no_release => true } do
|
80
|
-
on_rollback do
|
81
|
-
if previous_release
|
82
|
-
run "rm -f #{current_path}; ln -s #{previous_release}/finalized #{current_path}; true"
|
83
|
-
else
|
84
|
-
logger.important "no previous release to rollback to, rollback of symlink skipped"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
run "rm -f #{current_path} && ln -s #{latest_release}/finalized #{current_path}"
|
89
|
-
end
|
90
|
-
|
91
|
-
namespace :revision do
|
92
|
-
task :revision do
|
93
|
-
puts 'hhh'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
Capistrano::Configuration.instance.load do
|
2
|
-
namespace :setup do
|
3
|
-
|
4
|
-
desc "Alias for wordpress"
|
5
|
-
task :default do
|
6
|
-
setup.wordpress
|
7
|
-
end
|
8
|
-
|
9
|
-
desc "Setup this server for a new wordpress site."
|
10
|
-
task :wordpress do
|
11
|
-
"mkdir -p #{deploy_to}"
|
12
|
-
deploy.setup
|
13
|
-
wp.config
|
14
|
-
wp.htaccess
|
15
|
-
wp.checkout
|
16
|
-
setup.uploads
|
17
|
-
setup.mysql
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Creates uploads dir"
|
21
|
-
task :uploads do
|
22
|
-
|
23
|
-
stop = false
|
24
|
-
|
25
|
-
# If it already exists, stop
|
26
|
-
run("ls -d #{shared_path}/uploads") do |channel,stream,data|
|
27
|
-
if data.strip=="#{shared_path}/uploads"
|
28
|
-
STDERR.puts '*** uploads dir already exists. Not re-uploading.'
|
29
|
-
stop = true
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
unless stop
|
34
|
-
# If we have it, upload it
|
35
|
-
if File.exist?('uploads')
|
36
|
-
begin
|
37
|
-
upload("uploads", shared_path, :recursive => true, :via => :scp)
|
38
|
-
rescue
|
39
|
-
STDERR.puts '*** uploads dir already exists and does not belong to us. Can\'t re-upload.'
|
40
|
-
stop = true
|
41
|
-
end
|
42
|
-
else
|
43
|
-
run "mkdir -p #{shared_path}/uploads"
|
44
|
-
end
|
45
|
-
|
46
|
-
unless stop
|
47
|
-
# Let our Web server write to it
|
48
|
-
run "chmod -R 777 #{shared_path}/uploads"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Creates the DB, and loads the dump"
|
54
|
-
task :mysql do
|
55
|
-
if File.exist? 'data/dump.sql.gz'
|
56
|
-
upload("data/dump.sql.gz", shared_path, :via => :scp)
|
57
|
-
run <<-CMD
|
58
|
-
test #{wordpress_db_name}X != `echo 'show databases' | mysql | grep '^#{wordpress_db_name}$'`X &&
|
59
|
-
echo 'create database if not exists `#{wordpress_db_name}`' | mysql &&
|
60
|
-
zcat #{shared_path}/dump.sql.gz | sed 's/localhost/#{wordpress_domain}/g' | mysql #{wordpress_db_name} || true
|
61
|
-
CMD
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
class WpGenerate::Generator::Capify < WpGenerate::Generator
|
2
|
-
def initialize args, options
|
3
|
-
@options = options
|
4
|
-
@templates = {"Capfile" => "Capfile", "config.yml" => "lib/config.yml"}
|
5
|
-
@vars = {}
|
6
|
-
end
|
7
|
-
def templates_dir
|
8
|
-
File.join(File.dirname(__FILE__), '../templates')
|
9
|
-
end
|
10
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
---
|
2
|
-
application:
|
3
|
-
repository: "git@github.com:user/repo.git"
|
4
|
-
wordpress:
|
5
|
-
repository: "git://github.com/dxw/wordpress.git"
|
6
|
-
version: "v2.9.2"
|
7
|
-
deploy:
|
8
|
-
testing:
|
9
|
-
default: true
|
10
|
-
ssh_user: deploy
|
11
|
-
ssh_domain: "example.com"
|
12
|
-
path: "/var/vhosts/example.com/testing/app"
|
13
|
-
vhost: "app.testing.example.com"
|
14
|
-
database:
|
15
|
-
name: "app_testing"
|
16
|
-
user: "app_testing"
|
17
|
-
password: ""
|
18
|
-
host: "localhost"
|
19
|
-
staging:
|
20
|
-
ssh_user: deploy
|
21
|
-
ssh_domain: "example.com"
|
22
|
-
path: "/var/vhosts/example.com/staging/app"
|
23
|
-
vhost: "app.staging.example.com"
|
24
|
-
database:
|
25
|
-
name: "app_staging"
|
26
|
-
user: "app_staging"
|
27
|
-
password: ""
|
28
|
-
host: "localhost"
|
29
|
-
production:
|
30
|
-
ssh_user: deploy
|
31
|
-
ssh_domain: "example.com"
|
32
|
-
path: "/var/vhosts/example.com/production/app"
|
33
|
-
vhost: "app.com"
|
34
|
-
database:
|
35
|
-
name: "app_production"
|
36
|
-
user: "app_production"
|
37
|
-
password: ""
|
38
|
-
host: "localhost"
|