wordpresstrano 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/README.md +2 -0
- data/lib/capistrano/wordpress/hooks.rb +8 -4
- data/lib/capistrano/wordpress/tasks/binaries.rake +3 -3
- data/lib/capistrano/wordpress/tasks/deploy.rake +27 -0
- data/lib/capistrano/wordpress/tasks/htaccess.rake +21 -0
- data/lib/capistrano/wordpress/tasks/uploads.rake +24 -14
- data/wordpresstrano.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a39a6ee135372c5de3d06d78771e8165e92948f
|
4
|
+
data.tar.gz: 03465170ef4519a96e2a4e74b1a39dcc89546128
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6f2916a978dd401a9dfc46fe7afe3783b8d45396851678fd41d9538f2c8fc51788fb4eedb77fa04e6beff70ca4aea22ad1d3d531279579e8ad3eda415524fad
|
7
|
+
data.tar.gz: 78528b29a4c75b9fcd73f19b76dec33636f300267e023966c013ff9a234cadf307e5dc8f62d282b616480817c224899df75496a78a7d7d378a994332b57ef824
|
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -63,6 +63,9 @@ before "wp:core:download", "wp:core:remove"
|
|
63
63
|
# Download the WordPress core files before finishing deploy:updated
|
64
64
|
before "deploy:updated", "wp:core:download"
|
65
65
|
|
66
|
+
# Check if we can deploy without pushing htaccess/uploads/database
|
67
|
+
before "deploy", "deploy:check_for_previous_deployment"
|
68
|
+
|
66
69
|
# Link the release into the website root
|
67
70
|
after "deploy:finished", "webroot:symlink"
|
68
71
|
|
@@ -88,8 +91,9 @@ after "db:push", "db:check_maintenance_disable"
|
|
88
91
|
# Check if maintenance mode should be disabled after restoring the database
|
89
92
|
after "db:restore", "db:check_maintenance_disable"
|
90
93
|
|
91
|
-
#
|
94
|
+
# Rollback the database after rolling back the files
|
92
95
|
after "deploy:reverted", "db:rollback"
|
93
|
-
|
94
|
-
|
95
|
-
after "deploy:updated", "
|
96
|
+
|
97
|
+
# Clone resources from the previous release (if they exist)
|
98
|
+
after "deploy:updated", "htaccess:clone_from_previous_release"
|
99
|
+
after "deploy:updated", "uploads:clone_from_previous_release"
|
@@ -4,11 +4,11 @@ namespace :binaries do
|
|
4
4
|
next if true == fetch(:checked_binaries)
|
5
5
|
|
6
6
|
required_binaries = {
|
7
|
-
local: [:php, :rm, :rsync, :wp],
|
7
|
+
local: [:mysql, :mysqldump, :mysqlshow, :php, :rm, :rsync, :wp],
|
8
8
|
remote: {
|
9
|
-
:all => [:chmod, :find, :rm, :wp],
|
9
|
+
:all => [:chmod, :find, :mysql, :mysqldump, :mysqlshow, :rm, :wp],
|
10
10
|
:app => [:ln, :readlink, :rsync],
|
11
|
-
:db => [:du, :grep
|
11
|
+
:db => [:du, :grep]
|
12
12
|
}
|
13
13
|
}
|
14
14
|
|
@@ -1,4 +1,31 @@
|
|
1
1
|
namespace :deploy do
|
2
|
+
task :all do
|
3
|
+
Rake::Task["deploy"].prerequisites.delete("deploy:check_for_previous_deployment")
|
4
|
+
Rake::Task["deploy:updated"].prerequisites.delete("htaccess:clone_from_previous_release")
|
5
|
+
|
6
|
+
after "deploy:updated", "htaccess:push"
|
7
|
+
after "deploy:updated", "uploads:push"
|
8
|
+
after "deploy:updated", "db:push"
|
9
|
+
|
10
|
+
invoke "deploy"
|
11
|
+
end
|
12
|
+
|
13
|
+
task :check_for_previous_deployment do
|
14
|
+
previous_deployment = true
|
15
|
+
|
16
|
+
on roles(:all) do |server|
|
17
|
+
unless test("[ -d #{current_path} ]")
|
18
|
+
error "Unable to locate a current release on #{server.user}@#{server.hostname}"
|
19
|
+
|
20
|
+
previous_deployment = false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
unless previous_deployment
|
25
|
+
raise "One or more servers don't have a current release on them. You should run 'deploy:all' first."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
2
29
|
task :shared_configs do
|
3
30
|
config_path = File.join(shared_path, "wp-config.php")
|
4
31
|
robots_path = File.join(shared_path, "robots.txt")
|
@@ -129,4 +129,25 @@ namespace :htaccess do
|
|
129
129
|
execute :chmod, 644, remote_path
|
130
130
|
end
|
131
131
|
end
|
132
|
+
|
133
|
+
task :clone_from_previous_release do
|
134
|
+
file = ".htaccess"
|
135
|
+
|
136
|
+
remote_path = File.join(release_path, file)
|
137
|
+
|
138
|
+
on roles(:app) do |server|
|
139
|
+
if test("[ -d #{current_path} ]")
|
140
|
+
actual_current_path = capture("readlink -f #{current_path}").strip
|
141
|
+
actual_release_path = capture("readlink -f #{release_path}").strip
|
142
|
+
|
143
|
+
previous_remote_path = File.join(actual_current_path, file)
|
144
|
+
|
145
|
+
if actual_current_path != actual_release_path and test("[ -d #{previous_remote_path} ]")
|
146
|
+
debug "Cloning #{file} file from current release on #{server.user}@#{server.hostname}"
|
147
|
+
|
148
|
+
execute :cp, "--preserve=timestamps", previous_remote_path, remote_path
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
132
153
|
end
|
@@ -68,25 +68,14 @@ namespace :uploads do
|
|
68
68
|
remote_path = File.join(release_path, directory)
|
69
69
|
|
70
70
|
unless File.directory? local_path
|
71
|
-
|
71
|
+
run_locally do
|
72
|
+
error "No local uploads directory exists"
|
73
|
+
end
|
72
74
|
|
73
75
|
next
|
74
76
|
end
|
75
77
|
|
76
78
|
on roles(:app) do |server|
|
77
|
-
if test("[ -d #{current_path} ]") and (ENV["clone_uploads"].nil? or ENV["clone_uploads"].empty? or [true, "true", "yes", "y"].include? ENV["clone_uploads"].downcase)
|
78
|
-
actual_current_path = capture("readlink -f #{current_path}").strip
|
79
|
-
actual_release_path = capture("readlink -f #{release_path}").strip
|
80
|
-
|
81
|
-
previous_remote_path = File.join(actual_current_path, directory)
|
82
|
-
|
83
|
-
if actual_current_path != actual_release_path and test("[ -d #{previous_remote_path} ]")
|
84
|
-
debug "Cloning uploads directory from current release on #{server.user}@#{server.hostname}"
|
85
|
-
|
86
|
-
execute :cp, "-R", "--preserve=timestamps", previous_remote_path, remote_path
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
79
|
execute :mkdir, "-p", remote_path
|
91
80
|
|
92
81
|
info "Pushing #{directory} directory to #{server.user}@#{server.hostname}"
|
@@ -119,4 +108,25 @@ namespace :uploads do
|
|
119
108
|
execute :find, remote_path, "-type f", "-exec", :chmod, 644, "{}", "\\;"
|
120
109
|
end
|
121
110
|
end
|
111
|
+
|
112
|
+
task :clone_from_previous_release do
|
113
|
+
directory = File.join("wp-content", "uploads")
|
114
|
+
|
115
|
+
remote_path = File.join(release_path, directory)
|
116
|
+
|
117
|
+
on roles(:app) do |server|
|
118
|
+
if test("[ -d #{current_path} ]")
|
119
|
+
actual_current_path = capture("readlink -f #{current_path}").strip
|
120
|
+
actual_release_path = capture("readlink -f #{release_path}").strip
|
121
|
+
|
122
|
+
previous_remote_path = File.join(actual_current_path, directory)
|
123
|
+
|
124
|
+
if actual_current_path != actual_release_path and test("[ -d #{previous_remote_path} ]")
|
125
|
+
debug "Cloning uploads directory from current release on #{server.user}@#{server.hostname}"
|
126
|
+
|
127
|
+
execute :cp, "-R", "--preserve=timestamps", previous_remote_path, remote_path
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
122
132
|
end
|
data/wordpresstrano.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordpresstrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nialto Services
|
@@ -37,6 +37,7 @@ executables: []
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
+
- ".gitignore"
|
40
41
|
- LICENSE
|
41
42
|
- README.md
|
42
43
|
- lib/capistrano/wordpress.rb
|