capistrano-ash 1.1.19 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/capistrano-ash.gemspec +3 -3
- data/lib/ash/base.rb +8 -1
- data/lib/ash/drupal.rb +35 -30
- data/lib/ash/magento.rb +8 -3
- data/lib/ash/wordpress.rb +64 -58
- data/lib/ash/zend_doctrine.rb +12 -7
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/capistrano-ash.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "capistrano-ash"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["August Ash"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-08-23"
|
13
13
|
s.description = "August Ash recipes for Capistrano"
|
14
14
|
s.email = "code@augustash.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
]
|
35
35
|
s.homepage = "https://github.com/augustash/capistrano-ash"
|
36
36
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = "1.8.
|
37
|
+
s.rubygems_version = "1.8.23"
|
38
38
|
s.summary = "Useful task libraries for August Ash recipes for Capistrano"
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
data/lib/ash/base.rb
CHANGED
@@ -118,8 +118,15 @@ configuration.load do
|
|
118
118
|
run "#{try_sudo} mkdir -p #{backups_path} #{tmp_backups_path} && #{try_sudo} chmod 755 #{backups_path}"
|
119
119
|
end
|
120
120
|
|
121
|
+
desc <<-DESC
|
122
|
+
Deprecated API. This has become deploy:create_symlink, please update your recipes
|
123
|
+
DESC
|
124
|
+
task :symlink, :except => { :no_release => true } do
|
125
|
+
logger.important "[Deprecation Warning] This API has changed, please hook `deploy:create_symlink` instead of `deploy:symlink`."
|
126
|
+
create_symlink
|
127
|
+
end
|
121
128
|
|
122
|
-
|
129
|
+
desc <<-DESC
|
123
130
|
Clean up old releases. By default, the last 5 releases are kept on each \
|
124
131
|
server (though you can change this with the keep_releases variable). All \
|
125
132
|
other deployed revisions are removed from the servers. By default, this \
|
data/lib/ash/drupal.rb
CHANGED
@@ -14,12 +14,12 @@ configuration.load do
|
|
14
14
|
proc{_cset( :multisites, {"#{application}" => "#{application}"} )}
|
15
15
|
set :drush_bin, "drush"
|
16
16
|
_cset :dump_options, "" # blank options b/c of MYISAM engine (unless anyone knows options that should be included)
|
17
|
-
|
18
|
-
|
17
|
+
|
18
|
+
|
19
19
|
# --------------------------------------------
|
20
20
|
# Ubercart Files/Folders
|
21
21
|
# assumes ubercart files are located
|
22
|
-
# within a files/ubercart directory
|
22
|
+
# within a files/ubercart directory
|
23
23
|
# for each multisite
|
24
24
|
# --------------------------------------------
|
25
25
|
set :uc_root, "ubercart"
|
@@ -31,9 +31,14 @@ configuration.load do
|
|
31
31
|
# --------------------------------------------
|
32
32
|
after "deploy:setup", "deploy:setup_local"
|
33
33
|
after "deploy:finalize_update", "ash:fixperms"
|
34
|
-
after "deploy:
|
34
|
+
# after "deploy:create_symlink", "drupal:symlink"
|
35
|
+
|
36
|
+
# workaround for issues with capistrano v2.13.3 and
|
37
|
+
# before/after callbacks not firing for 'deploy:symlink'
|
38
|
+
# or 'deploy:create_symlink'
|
39
|
+
after "deploy", "drupal:symlink"
|
35
40
|
after "drupal:symlink","drupal:protect"
|
36
|
-
after "
|
41
|
+
after "drupal:symlink", "drupal:clearcache"
|
37
42
|
after "deploy", "deploy:cleanup"
|
38
43
|
|
39
44
|
# --------------------------------------------
|
@@ -45,7 +50,7 @@ configuration.load do
|
|
45
50
|
# attempt to create files needed for proper deployment
|
46
51
|
system("cp .htaccess htaccess.dist")
|
47
52
|
end
|
48
|
-
|
53
|
+
|
49
54
|
desc "Setup shared application directories and permissions after initial setup"
|
50
55
|
task :setup_shared do
|
51
56
|
# remove Capistrano specific directories
|
@@ -66,7 +71,7 @@ configuration.load do
|
|
66
71
|
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
67
72
|
# remove shared directories
|
68
73
|
multisites.each_pair do |folder, url|
|
69
|
-
if folder != url
|
74
|
+
if folder != url
|
70
75
|
run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
|
71
76
|
end
|
72
77
|
run "rm -Rf #{latest_release}/sites/#{url}/files"
|
@@ -89,7 +94,7 @@ configuration.load do
|
|
89
94
|
end
|
90
95
|
end
|
91
96
|
end
|
92
|
-
|
97
|
+
|
93
98
|
# --------------------------------------------
|
94
99
|
# Remote/Local database migration tasks
|
95
100
|
# --------------------------------------------
|
@@ -97,18 +102,18 @@ configuration.load do
|
|
97
102
|
task :local_export do
|
98
103
|
mysqldump = fetch(:mysqldump, "mysqldump")
|
99
104
|
dump_options = fetch(:dump_options, "")
|
100
|
-
|
105
|
+
|
101
106
|
system "#{mysqldump} #{dump_options} --opt -h#{db_local_host} -u#{db_local_user} -p#{db_local_pass} #{db_local_name} | gzip -c --best > #{db_local_name}.sql.gz"
|
102
107
|
end
|
103
|
-
|
108
|
+
|
104
109
|
desc "Create a compressed MySQL dumpfile of the remote database"
|
105
110
|
task :remote_export, :roles => :db do
|
106
111
|
mysqldump = fetch(:mysqldump, "mysqldump")
|
107
112
|
dump_options = fetch(:dump_options, "")
|
108
|
-
|
113
|
+
|
109
114
|
run "#{mysqldump} #{dump_options} --opt -h#{db_remote_host} -u#{db_remote_user} -p#{db_remote_pass} #{db_remote_name} | gzip -c --best > #{deploy_to}/#{db_remote_name}.sql.gz"
|
110
115
|
end
|
111
|
-
|
116
|
+
|
112
117
|
end
|
113
118
|
|
114
119
|
namespace :backup do
|
@@ -137,15 +142,15 @@ configuration.load do
|
|
137
142
|
multisites.each_pair do |folder, url|
|
138
143
|
# symlinks the appropriate environment's settings.php file
|
139
144
|
symlink_config_file
|
140
|
-
|
145
|
+
|
141
146
|
run "ln -nfs #{shared_path}/#{url}/files #{latest_release}/sites/#{url}/files"
|
142
147
|
run "#{drush_bin} -l #{url} -r #{current_path} vset --yes file_directory_path sites/#{url}/files"
|
143
148
|
end
|
144
149
|
end
|
145
|
-
|
150
|
+
|
146
151
|
desc <<-DESC
|
147
152
|
Symlinks the appropriate environment's settings file within the proper sites directory
|
148
|
-
|
153
|
+
|
149
154
|
Assumes the environment's settings file will be in one of two formats:
|
150
155
|
settings.<environment>.php => new default
|
151
156
|
settings.php.<environment> => deprecated
|
@@ -153,7 +158,7 @@ configuration.load do
|
|
153
158
|
task :symlink_config_file, :roles => :web, :except => { :no_release => true} do
|
154
159
|
multisites.each_pair do |folder, url|
|
155
160
|
drupal_app_site_dir = " #{latest_release}/sites/#{url}"
|
156
|
-
|
161
|
+
|
157
162
|
case true
|
158
163
|
when remote_file_exists?("#{drupal_app_site_dir}/settings.#{stage}.php")
|
159
164
|
run "ln -nfs #{drupal_app_site_dir}/settings.#{stage}.php #{drupal_app_site_dir}/settings.php"
|
@@ -178,7 +183,7 @@ configuration.load do
|
|
178
183
|
run "#{drush_bin} -l #{url} -r #{current_path} cache-clear all"
|
179
184
|
end
|
180
185
|
end
|
181
|
-
|
186
|
+
|
182
187
|
desc "Protect system files"
|
183
188
|
task :protect, :roles => :web, :except => { :no_release => true } do
|
184
189
|
multisites.each_pair do |folder, url|
|
@@ -196,7 +201,7 @@ configuration.load do
|
|
196
201
|
# setup necessary directories within our shared directory
|
197
202
|
setup_ubercart_shared
|
198
203
|
|
199
|
-
# move the sites/*/files/downloadable_products
|
204
|
+
# move the sites/*/files/downloadable_products
|
200
205
|
# to the shared directory via rsync
|
201
206
|
secure_downloadable_files
|
202
207
|
|
@@ -219,15 +224,15 @@ configuration.load do
|
|
219
224
|
end
|
220
225
|
|
221
226
|
desc <<-DESC
|
222
|
-
Moves downloadable files from the public directory (Drupal root) to the shared
|
227
|
+
Moves downloadable files from the public directory (Drupal root) to the shared
|
223
228
|
directories
|
224
229
|
|
225
230
|
Example:
|
226
|
-
sites/abc/files/ubercart/products
|
227
|
-
sites/xyz/files/ubercart/downloadable_products
|
231
|
+
sites/abc/files/ubercart/products
|
232
|
+
sites/xyz/files/ubercart/downloadable_products
|
228
233
|
|
229
234
|
are moved to:
|
230
|
-
shared/abc/ubercart/products
|
235
|
+
shared/abc/ubercart/products
|
231
236
|
shared/xyz/ubercart/downloadable_products
|
232
237
|
DESC
|
233
238
|
task :secure_downloadable_files, :except => { :no_release => true } do
|
@@ -245,23 +250,23 @@ configuration.load do
|
|
245
250
|
end
|
246
251
|
|
247
252
|
|
248
|
-
# update the ubercart's database tracking of where the
|
249
|
-
# root file path is for downloadable products. This should
|
253
|
+
# update the ubercart's database tracking of where the
|
254
|
+
# root file path is for downloadable products. This should
|
250
255
|
# be set as relative to the root of the drupal directory
|
251
256
|
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes uc_file_base_dir ../../shared/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
|
252
257
|
end
|
253
258
|
end
|
254
259
|
|
255
260
|
desc <<-DESC
|
256
|
-
Moves encryption key files from the public directory (Drupal root) to the shared
|
261
|
+
Moves encryption key files from the public directory (Drupal root) to the shared
|
257
262
|
directories
|
258
263
|
|
259
264
|
Example:
|
260
|
-
sites/abc/files/ubercart/keys
|
261
|
-
sites/xyz/files/ubercart/keys
|
265
|
+
sites/abc/files/ubercart/keys
|
266
|
+
sites/xyz/files/ubercart/keys
|
262
267
|
|
263
268
|
are moved to:
|
264
|
-
shared/abc/ubercart/keys
|
269
|
+
shared/abc/ubercart/keys
|
265
270
|
shared/xyz/ubercart/keys
|
266
271
|
DESC
|
267
272
|
task :secure_encryption_key, :roles => :web, :except => { :no_release => true } do
|
@@ -269,8 +274,8 @@ configuration.load do
|
|
269
274
|
multisites.each_pair do |folder, url|
|
270
275
|
run "mkdir -p #{shared_path}/#{url}/#{uc_root}/#{uc_encryption_keys_root}"
|
271
276
|
|
272
|
-
# update the ubercart's database tracking of where the
|
273
|
-
# root file path is for encryption keys. This should
|
277
|
+
# update the ubercart's database tracking of where the
|
278
|
+
# root file path is for encryption keys. This should
|
274
279
|
# be set as relative to the root of the drupal directory
|
275
280
|
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes uc_credit_encryption_path ../../shared/#{url}/#{uc_root}/#{uc_encryption_keys_root}"
|
276
281
|
end
|
data/lib/ash/magento.rb
CHANGED
@@ -14,8 +14,13 @@ configuration.load do
|
|
14
14
|
after "deploy:setup", "deploy:setup_local"
|
15
15
|
# after "deploy:setup_shared", "pma:install"
|
16
16
|
after "deploy:finalize_update", "magento:activate_config"
|
17
|
-
after "deploy:
|
18
|
-
|
17
|
+
# after "deploy:create_symlink", "magento:symlink"
|
18
|
+
|
19
|
+
# workaround for issues with capistrano v2.13.3 and
|
20
|
+
# before/after callbacks not firing for 'deploy:symlink'
|
21
|
+
# or 'deploy:create_symlink'
|
22
|
+
after "deploy", "magento:symlink"
|
23
|
+
after "magento:symlink", "magento:purge_cache"
|
19
24
|
|
20
25
|
# --------------------------------------------
|
21
26
|
# Overloaded tasks
|
@@ -123,7 +128,7 @@ configuration.load do
|
|
123
128
|
end
|
124
129
|
end
|
125
130
|
end
|
126
|
-
|
131
|
+
|
127
132
|
# --------------------------------------------
|
128
133
|
# Override the base.rb backup tasks
|
129
134
|
# --------------------------------------------
|
data/lib/ash/wordpress.rb
CHANGED
@@ -7,70 +7,76 @@ configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
|
7
7
|
Capistrano.configuration(:must_exist)
|
8
8
|
|
9
9
|
configuration.load do
|
10
|
-
|
11
|
-
# --------------------------------------------
|
12
|
-
# Setting defaults
|
13
|
-
# --------------------------------------------
|
14
|
-
set :uploads_path, "wp-content/uploads"
|
15
10
|
|
16
|
-
# --------------------------------------------
|
17
|
-
#
|
18
|
-
# --------------------------------------------
|
19
|
-
|
20
|
-
after "deploy:symlink", "wordpress:symlink"
|
21
|
-
after "ash:fixperms", "wordpress:protect"
|
11
|
+
# --------------------------------------------
|
12
|
+
# Setting defaults
|
13
|
+
# --------------------------------------------
|
14
|
+
set :uploads_path, "wp-content/uploads"
|
22
15
|
|
23
|
-
# --------------------------------------------
|
24
|
-
#
|
25
|
-
# --------------------------------------------
|
26
|
-
|
27
|
-
|
28
|
-
task :setup_shared, :roles => :web do
|
29
|
-
# remove Capistrano specific directories
|
30
|
-
run "rm -Rf #{shared_path}/log"
|
31
|
-
run "rm -Rf #{shared_path}/pids"
|
32
|
-
run "rm -Rf #{shared_path}/system"
|
33
|
-
|
34
|
-
# create shared directories
|
35
|
-
run "mkdir -p #{shared_path}/uploads"
|
36
|
-
run "mkdir -p #{shared_path}/cache"
|
16
|
+
# --------------------------------------------
|
17
|
+
# Calling our Methods
|
18
|
+
# --------------------------------------------
|
19
|
+
after "deploy:setup", "deploy:setup_shared"
|
20
|
+
# after "deploy:create_symlink", "wordpress:symlink"
|
37
21
|
|
38
|
-
|
39
|
-
|
40
|
-
|
22
|
+
# workaround for issues with capistrano v2.13.3 and
|
23
|
+
# before/after callbacks not firing for 'deploy:symlink'
|
24
|
+
# or 'deploy:create_symlink'
|
25
|
+
after "deploy", "wordpress:symlink"
|
26
|
+
after "wordpress:symlink", "ash:fixperms"
|
27
|
+
after "ash:fixperms", "wordpress:protect"
|
41
28
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
29
|
+
# --------------------------------------------
|
30
|
+
# Overloaded Methods
|
31
|
+
# --------------------------------------------
|
32
|
+
namespace :deploy do
|
33
|
+
desc "Setup shared application directories and permissions after initial setup"
|
34
|
+
task :setup_shared, :roles => :web do
|
35
|
+
# remove Capistrano specific directories
|
36
|
+
run "rm -Rf #{shared_path}/log"
|
37
|
+
run "rm -Rf #{shared_path}/pids"
|
38
|
+
run "rm -Rf #{shared_path}/system"
|
53
39
|
|
54
|
-
#
|
55
|
-
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
40
|
+
# create shared directories
|
41
|
+
run "mkdir -p #{shared_path}/uploads"
|
42
|
+
run "mkdir -p #{shared_path}/cache"
|
43
|
+
|
44
|
+
# set correct permissions
|
45
|
+
run "chmod -R 777 #{shared_path}/*"
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
49
|
+
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
50
|
+
# remove shared directories
|
51
|
+
run "rm -Rf #{latest_release}/#{uploads_path}"
|
52
|
+
run "rm -Rf #{latest_release}/wp-content/cache"
|
53
|
+
|
54
|
+
# Removing cruft files.
|
55
|
+
run "rm -Rf #{latest_release}/license.txt"
|
56
|
+
run "rm -Rf #{latest_release}/readme.html"
|
57
|
+
end
|
68
58
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
|
60
|
+
# --------------------------------------------
|
61
|
+
# Wordpress-specific methods
|
62
|
+
# --------------------------------------------
|
63
|
+
namespace :wordpress do
|
64
|
+
desc "Links the correct settings file"
|
65
|
+
task :symlink, :roles => :web, :except => { :no_release => true } do
|
66
|
+
run "ln -nfs #{shared_path}/uploads #{current_release}/#{uploads_path}"
|
67
|
+
run "ln -nfs #{shared_path}/cache #{current_release}/wp-content/cache"
|
68
|
+
run "ln -nfs #{latest_release}/wp-config.php.#{stage} #{latest_release}/wp-config.php"
|
69
|
+
end
|
70
|
+
|
71
|
+
desc "Set URL in database"
|
72
|
+
task :updatedb, :roles => :db, :except => { :no_release => true } do
|
73
|
+
run "mysql -u #{dbuser} -p #{dbpass} #{dbname} -e 'UPDATE #{dbprefix}options SET option_value = \"#{application}\" WHERE option_name = \"siteurl\" OR option_name = \"home\"'"
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "Protect system files"
|
77
|
+
task :protect, :except => { :no_release => true } do
|
78
|
+
run "chmod 440 #{latest_release}/wp-config.php*"
|
79
|
+
end
|
73
80
|
end
|
74
|
-
end
|
75
81
|
|
76
82
|
end
|
data/lib/ash/zend_doctrine.rb
CHANGED
@@ -13,7 +13,12 @@ configuration.load do
|
|
13
13
|
# --------------------------------------------
|
14
14
|
after "deploy:setup", "deploy:setup_shared"
|
15
15
|
after "deploy:finalize_update", "ash:fixperms"
|
16
|
-
after "deploy:
|
16
|
+
# after "deploy:create_symlink", "zend:symlink"
|
17
|
+
|
18
|
+
# workaround for issues with capistrano v2.13.3 and
|
19
|
+
# before/after callbacks not firing for 'deploy:symlink'
|
20
|
+
# or 'deploy:create_symlink'
|
21
|
+
after "deploy", "zend:symlink"
|
17
22
|
after "deploy", "deploy:cleanup"
|
18
23
|
|
19
24
|
# --------------------------------------------
|
@@ -29,7 +34,7 @@ configuration.load do
|
|
29
34
|
run "mkdir -p #{shared_path}/system"
|
30
35
|
try_sudo "chmod -R 777 #{shared_path}/*"
|
31
36
|
end
|
32
|
-
|
37
|
+
|
33
38
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
34
39
|
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
35
40
|
# remove shared directories
|
@@ -37,7 +42,7 @@ configuration.load do
|
|
37
42
|
run "rm -Rf #{latest_release}/public/system"
|
38
43
|
end
|
39
44
|
end
|
40
|
-
|
45
|
+
|
41
46
|
namespace :zend do
|
42
47
|
desc "Symlink shared directories"
|
43
48
|
task :symlink, :roles => :web, :except => { :no_release => true } do
|
@@ -47,10 +52,10 @@ configuration.load do
|
|
47
52
|
run "ln -nfs #{latest_release}/application/Application.#{stage}.php #{latest_release}/application/Application.php"
|
48
53
|
run "mv #{latest_release}/public/htaccess.#{stage} #{latest_release}/public/.htaccess"
|
49
54
|
run "cp #{latest_release}/scripts/doctrine-cli.#{stage} #{latest_release}/scripts/doctrine-cli"
|
50
|
-
|
51
|
-
|
55
|
+
|
56
|
+
|
52
57
|
try_sudo "chmod +x #{latest_release}/scripts/doctrine-cli"
|
53
|
-
|
58
|
+
|
54
59
|
# remove the example or other environment example files
|
55
60
|
run "rm -f #{latest_release}/scripts/doctrine-cli.dist"
|
56
61
|
run "rm -f #{latest_release}/scripts/doctrine-cli.staging"
|
@@ -58,7 +63,7 @@ configuration.load do
|
|
58
63
|
run "rm -f #{latest_release}/application/Application.example.php"
|
59
64
|
end
|
60
65
|
end
|
61
|
-
|
66
|
+
|
62
67
|
namespace :doctrine do
|
63
68
|
desc "Run Doctrine Migrations"
|
64
69
|
task :migrate, :roles => :web, :except => { :no_release => true } do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: August Ash recipes for Capistrano
|
15
15
|
email: code@augustash.com
|