capistrano-ash 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/capistrano-ash.gemspec +15 -17
- data/lib/ash/base.rb +9 -9
- data/lib/ash/common.rb +38 -3
- data/lib/ash/drupal.rb +22 -8
- data/lib/ash/drupal_shared_hosting.rb +1 -1
- data/lib/ash/hosted_magento.rb +10 -20
- data/lib/ash/magento.rb +26 -11
- data/lib/ash/wordpress.rb +17 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDNkNzI1MjBlOWRlMjNjYWM3NTMyM2Q1ZWE5YWYyZGIxNjRiZmQyMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmJiMmU4YjM5OGVkYTdmM2U2MjdkNDJlNjIxZjdmZDU1MzE1YTJlYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDVhYzM5MzVmNTgyNWU3Y2M3YzIzNjZkODNjNGE5NjM2MGNhY2VlZTI3NDIw
|
10
|
+
ODVjYTVkZmQzNzIxMzM5MDI0N2M4YTk4YWNlYzliODkxODBkMDc3NDM5Mzli
|
11
|
+
ZTY0MGJkN2YzODYwOTRkZGJhZGFlOWU2ZGFhYTc4NTA0YWExZmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWJjOTA5Mzc0OWViNjgwM2M5YWI0ODA2NzViNWEwOWE2OWY5ZDkwMTE2N2Y3
|
14
|
+
ZDhmMTFhYjY3NWVhZTVlMzU5ZGJmODM5NmY0Zjk1ZDQ5MDk5NDFiODE1NDY5
|
15
|
+
NTY4NTllOWEzMzNhMjliYTU5MDgwNjc5ZGI2OTgzMzI2MTJlZTI=
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gemspec.homepage = "https://github.com/augustash/capistrano-ash"
|
12
12
|
gemspec.authors = ["August Ash"]
|
13
13
|
# Gem dependencies
|
14
|
-
gemspec.add_dependency('capistrano', '
|
14
|
+
gemspec.add_dependency('capistrano', '~> 2.15.0')
|
15
15
|
gemspec.add_dependency('capistrano-ext')
|
16
16
|
gemspec.add_dependency('railsless-deploy')
|
17
17
|
gemspec.add_dependency('capistrano_colors')
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.7
|
data/capistrano-ash.gemspec
CHANGED
@@ -4,18 +4,16 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
7
|
+
s.name = "capistrano-ash"
|
8
|
+
s.version = "1.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors
|
12
|
-
s.date
|
13
|
-
s.description
|
14
|
-
s.email
|
15
|
-
s.extra_rdoc_files
|
16
|
-
|
17
|
-
]
|
18
|
-
s.files = [
|
11
|
+
s.authors = ["August Ash"]
|
12
|
+
s.date = "2013-07-18"
|
13
|
+
s.description = "August Ash recipes for Capistrano"
|
14
|
+
s.email = "code@augustash.com"
|
15
|
+
s.extra_rdoc_files = ["README.textile"]
|
16
|
+
s.files = [
|
19
17
|
"CHANGELOG.rdoc",
|
20
18
|
"README.textile",
|
21
19
|
"Rakefile",
|
@@ -32,27 +30,27 @@ Gem::Specification.new do |s|
|
|
32
30
|
"lib/ash/zend_doctrine.rb",
|
33
31
|
"lib/ash/zend_doctrine_shared_hosting.rb"
|
34
32
|
]
|
35
|
-
s.homepage
|
36
|
-
s.require_paths
|
37
|
-
s.rubygems_version
|
38
|
-
s.summary
|
33
|
+
s.homepage = "https://github.com/augustash/capistrano-ash"
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = "2.0.3"
|
36
|
+
s.summary = "Useful task libraries for August Ash recipes for Capistrano"
|
39
37
|
|
40
38
|
if s.respond_to? :specification_version then
|
41
39
|
s.specification_version = 4
|
42
40
|
|
43
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_runtime_dependency(%q<capistrano>, ["
|
42
|
+
s.add_runtime_dependency(%q<capistrano>, ["~> 2.15.0"])
|
45
43
|
s.add_runtime_dependency(%q<capistrano-ext>, [">= 0"])
|
46
44
|
s.add_runtime_dependency(%q<railsless-deploy>, [">= 0"])
|
47
45
|
s.add_runtime_dependency(%q<capistrano_colors>, [">= 0"])
|
48
46
|
else
|
49
|
-
s.add_dependency(%q<capistrano>, ["
|
47
|
+
s.add_dependency(%q<capistrano>, ["~> 2.15.0"])
|
50
48
|
s.add_dependency(%q<capistrano-ext>, [">= 0"])
|
51
49
|
s.add_dependency(%q<railsless-deploy>, [">= 0"])
|
52
50
|
s.add_dependency(%q<capistrano_colors>, [">= 0"])
|
53
51
|
end
|
54
52
|
else
|
55
|
-
s.add_dependency(%q<capistrano>, ["
|
53
|
+
s.add_dependency(%q<capistrano>, ["~> 2.15.0"])
|
56
54
|
s.add_dependency(%q<capistrano-ext>, [">= 0"])
|
57
55
|
s.add_dependency(%q<railsless-deploy>, [">= 0"])
|
58
56
|
s.add_dependency(%q<capistrano_colors>, [">= 0"])
|
data/lib/ash/base.rb
CHANGED
@@ -109,8 +109,8 @@ configuration.load do
|
|
109
109
|
task :setup, :except => { :no_release => true } do
|
110
110
|
dirs = [deploy_to, releases_path, shared_path]
|
111
111
|
dirs += shared_children.map { |d| File.join(shared_path, d.split('/').last) }
|
112
|
-
|
113
|
-
|
112
|
+
run "mkdir -p #{dirs.join(' ')}"
|
113
|
+
run "chmod 755 #{dirs.join(' ')}" if fetch(:group_writable, true)
|
114
114
|
end
|
115
115
|
|
116
116
|
desc "Setup shared application directories and permissions after initial setup"
|
@@ -120,7 +120,7 @@ configuration.load do
|
|
120
120
|
|
121
121
|
desc "Setup backup directory for database and web files"
|
122
122
|
task :setup_backup, :except => { :no_release => true } do
|
123
|
-
|
123
|
+
run "mkdir -p #{backups_path} #{tmp_backups_path} && chmod 755 #{backups_path}"
|
124
124
|
end
|
125
125
|
|
126
126
|
desc <<-DESC
|
@@ -164,7 +164,7 @@ configuration.load do
|
|
164
164
|
# adding a chown -R method to fix permissions on the directory
|
165
165
|
# this should help with issues related to permission denied
|
166
166
|
# as in issues #28 and #30
|
167
|
-
run "#{
|
167
|
+
run "#{try_sudo} chown -R #{user}:#{user} #{dir}" if remote_dir_exists?(dir)
|
168
168
|
|
169
169
|
set_perms_dirs(dir)
|
170
170
|
set_perms_files(dir)
|
@@ -174,7 +174,7 @@ configuration.load do
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
-
run "#{
|
177
|
+
run "#{try_sudo} rm -rf #{directories}", :hosts => [channel[:server]]
|
178
178
|
end
|
179
179
|
end
|
180
180
|
end
|
@@ -277,8 +277,8 @@ EOF
|
|
277
277
|
nginx_cmd = fetch(:nginx_init_command, "/etc/init.d/nginx")
|
278
278
|
phpfpm_cmd = fetch(:phpfpm_init_command, "/etc/init.d/php-fpm")
|
279
279
|
|
280
|
-
run "#{
|
281
|
-
run "#{
|
280
|
+
run "#{try_sudo} #{nginx_cmd} #{cmd}"
|
281
|
+
run "#{try_sudo} #{phpfpm_cmd} #{cmd}"
|
282
282
|
end
|
283
283
|
end
|
284
284
|
end
|
@@ -583,11 +583,11 @@ EOF
|
|
583
583
|
if !compass_bin.nil?
|
584
584
|
if watched_dirs.is_a? String
|
585
585
|
logger.debug "Compiling SASS for #{watched_dirs}"
|
586
|
-
system "#{compass_bin} compile --output-style #{compass_output} --environment #{compass_env} ./#{watched_dirs}"
|
586
|
+
system "#{compass_bin} clean ./#{watched_dirs} && #{compass_bin} compile --output-style #{compass_output} --environment #{compass_env} ./#{watched_dirs}"
|
587
587
|
elsif watched_dirs.is_a? Array
|
588
588
|
logger.debug "Compiling SASS for #{watched_dirs.join(', ')}"
|
589
589
|
watched_dirs.each do |dir|
|
590
|
-
system "#{compass_bin} compile --output-style #{compass_output} --environment #{compass_env} ./#{dir}"
|
590
|
+
system "#{compass_bin} clean ./#{dir} && #{compass_bin} compile --output-style #{compass_output} --environment #{compass_env} ./#{dir}"
|
591
591
|
end
|
592
592
|
else
|
593
593
|
logger.debug "Unable to compile SASS because :compass_watched_dirs was neither a String nor an Array"
|
data/lib/ash/common.rb
CHANGED
@@ -44,10 +44,45 @@ end
|
|
44
44
|
|
45
45
|
# set the permissions for files recurisvely from the starting directory (dir_path)
|
46
46
|
def set_perms_files(dir_path, perm = 644)
|
47
|
-
|
47
|
+
begin
|
48
|
+
run "find #{dir_path} -type f -print0 | xargs -0 #{try_sudo} chmod #{perm}" if remote_dir_exists?(dir_path)
|
49
|
+
rescue Exception => e
|
50
|
+
logger.important "FAILED to set permissions of #{perm} on files within #{dir_path}!"
|
51
|
+
logger.important e.message
|
52
|
+
logger.important "Trying to set permissions without using xargs"
|
53
|
+
begin
|
54
|
+
run "find #{dir_path} -type f -exec #{try_sudo} chmod #{perm} {} \\;" if remote_dir_exists?(dir_path)
|
55
|
+
rescue Exception => e
|
56
|
+
logger.important "FAILED second attempt to set permissions of #{perm} on files within #{dir_path}!"
|
57
|
+
logger.important e.message
|
58
|
+
end
|
59
|
+
end
|
48
60
|
end
|
49
61
|
|
50
|
-
# set the permissions for directories
|
62
|
+
# set the permissions for directories recursively from the starting directory (dir_path)
|
51
63
|
def set_perms_dirs(dir_path, perm = 755)
|
52
|
-
|
64
|
+
begin
|
65
|
+
run "find #{dir_path} -type d -print0 | xargs -0 #{try_sudo} chmod #{perm}" if remote_dir_exists?(dir_path)
|
66
|
+
rescue Exception => e
|
67
|
+
logger.important "FAILED to set permissions of #{perm} on directories within #{dir_path}!"
|
68
|
+
logger.important e.message
|
69
|
+
logger.important "Trying to set permissions without using xargs"
|
70
|
+
begin
|
71
|
+
run "find #{dir_path} -type d -exec #{try_sudo} chmod #{perm} {} \\;" if remote_dir_exists?(dir_path)
|
72
|
+
rescue Exception => e
|
73
|
+
logger.important "FAILED second attempt to set permissions of #{perm} on directories within #{dir_path}!"
|
74
|
+
logger.important e.message
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# set permission on specific file or directory path instead of doing
|
80
|
+
# it with a big hammer like set_perms_files or set_perms_dir
|
81
|
+
def set_perms(path, perm = 644)
|
82
|
+
begin
|
83
|
+
try_sudo "chmod #{perm} #{path}" if remote_file_exists?(path) || remote_dir_exists?(path)
|
84
|
+
rescue Exception => e
|
85
|
+
logger.important "FAILED to set permission of #{perm} on #{path}"
|
86
|
+
logger.important e.message
|
87
|
+
end
|
53
88
|
end
|
data/lib/ash/drupal.rb
CHANGED
@@ -17,6 +17,21 @@ configuration.load do
|
|
17
17
|
depend :remote, :command, 'drush'
|
18
18
|
depend :remote, :command, 'rsync'
|
19
19
|
|
20
|
+
# --------------------------------------------
|
21
|
+
# try_sudo configuration
|
22
|
+
# --------------------------------------------
|
23
|
+
set :use_sudo, true # allow try_sudo methods to actually run via sudo
|
24
|
+
# set(:admin_runner) {"#{user}"} # specify the :admin_runner if you need to run it as another user other than root
|
25
|
+
|
26
|
+
# Clear out the default prompt (i.e., `sudo -p 'sudo password: '`) to fall back
|
27
|
+
# to just using `sudo` due to the concatenation in the sudo method.
|
28
|
+
#
|
29
|
+
# This assumes that you have set up your SSH user to have passwordless sudo
|
30
|
+
# setup for common commands (e.g., mv, cp, ln, mkdir, chown, chmod, rm, etc.)
|
31
|
+
#
|
32
|
+
# (see: https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/configuration/actions/invocation.rb#L229-L237)
|
33
|
+
set :sudo_prompt, ''
|
34
|
+
|
20
35
|
# --------------------------------------------
|
21
36
|
# Setting defaults
|
22
37
|
# --------------------------------------------
|
@@ -24,7 +39,6 @@ configuration.load do
|
|
24
39
|
set :drush_bin, "drush"
|
25
40
|
_cset :dump_options, "" # blank options b/c of MYISAM engine (unless anyone knows options that should be included)
|
26
41
|
|
27
|
-
|
28
42
|
# --------------------------------------------
|
29
43
|
# Ubercart Files/Folders
|
30
44
|
# assumes ubercart files are located
|
@@ -70,7 +84,7 @@ configuration.load do
|
|
70
84
|
|
71
85
|
# create shared directories
|
72
86
|
multisites.each_pair do |folder, url|
|
73
|
-
|
87
|
+
run "mkdir -p #{shared_path}/#{url}/files"
|
74
88
|
end
|
75
89
|
|
76
90
|
# set correct permissions
|
@@ -158,7 +172,7 @@ configuration.load do
|
|
158
172
|
# symlinks the appropriate environment's settings.php file
|
159
173
|
symlink_config_file
|
160
174
|
|
161
|
-
|
175
|
+
run "ln -nfs #{shared_path}/#{url}/files #{latest_release}/sites/#{url}/files"
|
162
176
|
run "#{drush_bin} -l #{url} -r #{current_path} vset --yes file_directory_path sites/#{url}/files"
|
163
177
|
end
|
164
178
|
end
|
@@ -202,7 +216,7 @@ configuration.load do
|
|
202
216
|
desc "Protect system files"
|
203
217
|
task :protect, :roles => :web, :except => { :no_release => true } do
|
204
218
|
multisites.each_pair do |folder, url|
|
205
|
-
|
219
|
+
run "chmod 644 #{latest_release}/sites/#{url}/settings.php*"
|
206
220
|
end
|
207
221
|
end
|
208
222
|
|
@@ -234,7 +248,7 @@ configuration.load do
|
|
234
248
|
DESC
|
235
249
|
task :setup_ubercart_shared, :roles => :web, :except => { :no_release => true } do
|
236
250
|
multisites.each_pair do |folder, url|
|
237
|
-
|
251
|
+
run "mkdir -p #{shared_path}/#{url}/#{uc_root}"
|
238
252
|
end
|
239
253
|
end
|
240
254
|
|
@@ -253,13 +267,13 @@ configuration.load do
|
|
253
267
|
task :secure_downloadable_files, :except => { :no_release => true } do
|
254
268
|
# loop through the multisites and move files
|
255
269
|
multisites.each_pair do |folder, url|
|
256
|
-
|
270
|
+
run "mkdir -p #{shared_path}/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
|
257
271
|
|
258
272
|
ubercart_dir = "#{latest_release}/sites/#{url}/files/#{uc_root}/#{uc_downloadable_products_root}"
|
259
273
|
|
260
274
|
case true
|
261
275
|
when remote_dir_exists?("#{ubercart_dir}")
|
262
|
-
|
276
|
+
run "rsync -rltDvzog #{ubercart_dir} #{shared_path}/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
|
263
277
|
else
|
264
278
|
logger.important "Failed to rsync the ubercart downloadable products in #{ubercart_dir} because the directory doesn't exist"
|
265
279
|
end
|
@@ -287,7 +301,7 @@ configuration.load do
|
|
287
301
|
task :secure_encryption_key, :roles => :web, :except => { :no_release => true } do
|
288
302
|
# loop through the multisites and move keys
|
289
303
|
multisites.each_pair do |folder, url|
|
290
|
-
|
304
|
+
run "mkdir -p #{shared_path}/#{url}/#{uc_root}/#{uc_encryption_keys_root}"
|
291
305
|
|
292
306
|
# update the ubercart's database tracking of where the
|
293
307
|
# root file path is for encryption keys. This should
|
data/lib/ash/hosted_magento.rb
CHANGED
@@ -7,6 +7,11 @@ configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
|
7
7
|
Capistrano.configuration(:must_exist)
|
8
8
|
|
9
9
|
configuration.load do
|
10
|
+
|
11
|
+
# shared servers typically don't allow `sudo`,
|
12
|
+
# so this will tell `try_sudo` to run as the `:user` instead
|
13
|
+
set :use_sudo, false
|
14
|
+
|
10
15
|
# --------------------------------------------
|
11
16
|
# Default variables
|
12
17
|
# --------------------------------------------
|
@@ -30,13 +35,14 @@ configuration.load do
|
|
30
35
|
run "mkdir -p #{shared_path}/var"
|
31
36
|
|
32
37
|
# set correct permissions
|
33
|
-
|
38
|
+
set_perms("#{shared_path}/*", 755)
|
34
39
|
end
|
35
40
|
|
36
41
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
37
42
|
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
38
43
|
# synchronize media directory with shared data
|
39
44
|
run "rsync -rltDvzog #{latest_release}/media/ #{shared_path}/media/"
|
45
|
+
set_perms("#{shared_path}/media/", 755)
|
40
46
|
|
41
47
|
# put ".htaccess" in place
|
42
48
|
run "mv #{latest_release}/htaccess.dist #{latest_release}/.htaccess"
|
@@ -49,25 +55,9 @@ configuration.load do
|
|
49
55
|
|
50
56
|
# set the file and directory permissions
|
51
57
|
ash.fixperms
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
namespace :magento do
|
56
|
-
desc "Purge Magento cache directory"
|
57
|
-
task :purge_cache, :roles => :web, :except => { :no_release => true } do
|
58
|
-
run "rm -Rf #{shared_path}/var/cache/*"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# --------------------------------------------
|
63
|
-
# Overloaded Ash tasks
|
64
|
-
# --------------------------------------------
|
65
|
-
namespace :ash do
|
66
|
-
desc "Set standard permissions for Ash servers"
|
67
|
-
task :fixperms, :roles => :web, :except => { :no_release => true } do
|
68
|
-
# chmod the files and directories.
|
69
|
-
run "find #{latest_release} -type d -exec chmod 755 {} \\;"
|
70
|
-
run "find #{latest_release} -type f -exec chmod 644 {} \\;"
|
58
|
+
set_perms("#{latest_release}/pear", 400)
|
59
|
+
set_perms("#{latest_release}/mage", 400)
|
60
|
+
set_perms("#{latest_release}/app/etc", "o+w")
|
71
61
|
end
|
72
62
|
end
|
73
63
|
end
|
data/lib/ash/magento.rb
CHANGED
@@ -17,6 +17,21 @@ configuration.load do
|
|
17
17
|
# --------------------------------------------
|
18
18
|
depend :remote, :command, 'rsync'
|
19
19
|
|
20
|
+
# --------------------------------------------
|
21
|
+
# try_sudo configuration
|
22
|
+
# --------------------------------------------
|
23
|
+
set :use_sudo, true # allow try_sudo methods to actually run via sudo
|
24
|
+
# set(:admin_runner) {"#{user}"} # specify the :admin_runner if you need to run it as another user other than root
|
25
|
+
|
26
|
+
# Clear out the default prompt (i.e., `sudo -p 'sudo password: '`) to fall back
|
27
|
+
# to just using `sudo` due to the concatenation in the sudo method.
|
28
|
+
#
|
29
|
+
# This assumes that you have set up your SSH user to have passwordless sudo
|
30
|
+
# setup for common commands (e.g., mv, cp, ln, mkdir, chown, chmod, rm, etc.)
|
31
|
+
#
|
32
|
+
# (see: https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/configuration/actions/invocation.rb#L229-L237)
|
33
|
+
set :sudo_prompt, ''
|
34
|
+
|
20
35
|
# --------------------------------------------
|
21
36
|
# Magento Variables
|
22
37
|
# --------------------------------------------
|
@@ -57,9 +72,9 @@ configuration.load do
|
|
57
72
|
desc "Setup shared application directories and permissions after initial setup"
|
58
73
|
task :setup_shared do
|
59
74
|
# remove Capistrano specific directories
|
60
|
-
|
61
|
-
|
62
|
-
|
75
|
+
try_sudo "rm -Rf #{shared_path}/log"
|
76
|
+
try_sudo "rm -Rf #{shared_path}/pids"
|
77
|
+
try_sudo "rm -Rf #{shared_path}/system"
|
63
78
|
|
64
79
|
# create shared directories
|
65
80
|
run "mkdir -p #{shared_path}/includes"
|
@@ -68,14 +83,14 @@ configuration.load do
|
|
68
83
|
run "mkdir -p #{shared_path}/var"
|
69
84
|
|
70
85
|
# set correct permissions
|
71
|
-
|
86
|
+
set_perms("#{shared_path}/*", 777)
|
72
87
|
end
|
73
88
|
|
74
89
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
75
90
|
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
76
91
|
# synchronize media directory with shared data
|
77
92
|
run "rsync -rltDvzog #{latest_release}/media/ #{shared_path}/media/"
|
78
|
-
|
93
|
+
set_perms("#{shared_path}/media/", 777)
|
79
94
|
|
80
95
|
# remove directories that will be shared
|
81
96
|
run "rm -Rf #{latest_release}/includes"
|
@@ -85,9 +100,9 @@ configuration.load do
|
|
85
100
|
|
86
101
|
# set the file and directory permissions
|
87
102
|
ash.fixperms
|
88
|
-
|
89
|
-
|
90
|
-
|
103
|
+
set_perms("#{latest_release}/pear", 400)
|
104
|
+
set_perms("#{latest_release}/mage", 400)
|
105
|
+
set_perms("#{latest_release}/app/etc", "o+w")
|
91
106
|
end
|
92
107
|
|
93
108
|
namespace :web do
|
@@ -127,7 +142,8 @@ configuration.load do
|
|
127
142
|
|
128
143
|
desc "Purge Magento cache directory"
|
129
144
|
task :purge_cache, :roles => :web, :except => { :no_release => true } do
|
130
|
-
|
145
|
+
try_sudo "rm -Rf #{shared_path}/var/cache/*"
|
146
|
+
try_sudo "rm -Rf #{shared_path}/var/full_page_cache/*" if remote_dir_exists?("#{shared_path}/var/full_page_cache}")
|
131
147
|
end
|
132
148
|
|
133
149
|
desc "Watch Magento system log"
|
@@ -150,9 +166,8 @@ configuration.load do
|
|
150
166
|
|
151
167
|
desc "Clear the Magento Cache"
|
152
168
|
task :cc, :roles => [:web, :app], :except => { :no_release => true } do
|
153
|
-
|
169
|
+
try_sudo "chown -R #{user}:#{user} #{shared_path}/var/*"
|
154
170
|
magento.purge_cache
|
155
|
-
run "#{sudo} rm -rf #{shared_path}/var/full_page_cache/*"
|
156
171
|
end
|
157
172
|
|
158
173
|
desc "Enable display errors"
|
data/lib/ash/wordpress.rb
CHANGED
@@ -8,6 +8,21 @@ configuration = Capistrano::Configuration.respond_to?(:instance) ?
|
|
8
8
|
|
9
9
|
configuration.load do
|
10
10
|
|
11
|
+
# --------------------------------------------
|
12
|
+
# try_sudo configuration
|
13
|
+
# --------------------------------------------
|
14
|
+
set :use_sudo, true # allow try_sudo methods to actually run via sudo
|
15
|
+
# set(:admin_runner) {"#{user}"} # specify the :admin_runner if you need to run it as another user other than root
|
16
|
+
|
17
|
+
# Clear out the default prompt (i.e., `sudo -p 'sudo password: '`) to fall back
|
18
|
+
# to just using `sudo` due to the concatenation in the sudo method.
|
19
|
+
#
|
20
|
+
# This assumes that you have set up your SSH user to have passwordless sudo
|
21
|
+
# setup for common commands (e.g., mv, cp, ln, mkdir, chown, chmod, rm, etc.)
|
22
|
+
#
|
23
|
+
# (see: https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/configuration/actions/invocation.rb#L229-L237)
|
24
|
+
set :sudo_prompt, ''
|
25
|
+
|
11
26
|
# --------------------------------------------
|
12
27
|
# Setting defaults
|
13
28
|
# --------------------------------------------
|
@@ -43,7 +58,7 @@ configuration.load do
|
|
43
58
|
run "mkdir -p #{shared_path}/cache"
|
44
59
|
|
45
60
|
# set correct permissions
|
46
|
-
run "chmod -R 777 #{shared_path}/*"
|
61
|
+
run "#{try_sudo} chmod -R 777 #{shared_path}/*"
|
47
62
|
end
|
48
63
|
|
49
64
|
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
|
@@ -96,7 +111,7 @@ configuration.load do
|
|
96
111
|
|
97
112
|
desc "Protect system files"
|
98
113
|
task :protect, :except => { :no_release => true } do
|
99
|
-
run "chmod 440 #{latest_release}/wp-config.php*"
|
114
|
+
run "#{try_sudo} chmod 440 #{latest_release}/wp-config.php*"
|
100
115
|
end
|
101
116
|
end
|
102
117
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- August Ash
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.15.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano-ext
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|