capistrano-ash 1.1.11 → 1.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -0
- data/README.textile +3 -89
- data/VERSION +1 -1
- data/capistrano-ash.gemspec +5 -5
- data/lib/ash/base.rb +22 -0
- data/lib/ash/common.rb +11 -1
- data/lib/ash/drupal.rb +114 -11
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.1.12
|
2
|
+
* Applied dficker's proposed patch for issue #11
|
3
|
+
* Added the `remote_dir_exists?` method to the `lib/ash/common.rb`
|
4
|
+
** TODO: better tasks to test if a remote directory exists
|
5
|
+
* Added some Drupal Ubercart methods to help secure Ubercart encryption keys and downloadable products
|
6
|
+
|
7
|
+
== 1.1.11
|
8
|
+
* Added functionality to help fascilitate migrating local databases to remote and back
|
9
|
+
|
1
10
|
== 1.1.7
|
2
11
|
* Updated naming convention for Magento configuration files
|
3
12
|
|
data/README.textile
CHANGED
@@ -39,95 +39,9 @@ The capistrano/ash/drupal library takes a hash of Drupal multisites in the follo
|
|
39
39
|
|
40
40
|
where each key is a folder in your @sites@ directory and each value is the URL of the multisite. If you are not using multisites, just exclude the @:multisites@ variable definition.
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
<pre>
|
46
|
-
<code>
|
47
|
-
# Capfile
|
48
|
-
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
49
|
-
|
50
|
-
# --------------------------------------------
|
51
|
-
# :application HAS TO BE DEFINED BEFORE
|
52
|
-
# REQUIRING 'ash/drupal' LIBRARY
|
53
|
-
# --------------------------------------------
|
54
|
-
set :application, "bestappever.com"
|
55
|
-
set :stages, %w(staging production)
|
56
|
-
|
57
|
-
# --------------------------------------------
|
58
|
-
# Define required Gems/libraries
|
59
|
-
# --------------------------------------------
|
60
|
-
require 'ash/drupal'
|
61
|
-
|
62
|
-
# --------------------------------------------
|
63
|
-
# Setting defaults
|
64
|
-
# --------------------------------------------
|
65
|
-
# IP-address or host's servername
|
66
|
-
role :app, "bestappever.com"
|
67
|
-
role :web, "bestappever.com"
|
68
|
-
role :db, "bestappever.com", :primary => true
|
69
|
-
|
70
|
-
# VCS information.
|
71
|
-
set :repository, "https://svn.example.com/REPO/trunk"
|
72
|
-
set :scm_username, "SVN_USER"
|
73
|
-
set :scm_password, proc{Capistrano::CLI.password_prompt("Subversion password for '#{scm_username}':")}
|
74
|
-
|
75
|
-
# SSH login credentials
|
76
|
-
set :user, "SSH_USER"
|
77
|
-
set :password, proc{Capistrano::CLI.password_prompt("SSH password for '#{user}':")}
|
78
|
-
|
79
|
-
# Deploy to file path
|
80
|
-
set(:deploy_to) { "/var/www/#{application}/#{stage}" }
|
81
|
-
|
82
|
-
# Database credentials
|
83
|
-
set :dbuser, "DB_USER_NAME"
|
84
|
-
|
85
|
-
# Define which files or directories you want to exclude from being backed up
|
86
|
-
set(:backup_exclude) { [ "var/" ] }
|
87
|
-
|
88
|
-
|
89
|
-
# --------------------------------------------
|
90
|
-
# Drupal Multi-Sites
|
91
|
-
# --------------------------------------------
|
92
|
-
# Setting which folder in the sites directory to use
|
93
|
-
set :multisites, {
|
94
|
-
'bestapp' => 'bestappever.com',
|
95
|
-
}
|
96
|
-
|
97
|
-
|
98
|
-
# --------------------------------------------
|
99
|
-
# Callbacks - Set Before/After Precedence
|
100
|
-
# --------------------------------------------
|
101
|
-
before "deploy:update_code", "deploy:setup_backup"
|
102
|
-
after "deploy:setup_backup", "backup"
|
103
|
-
</code>
|
104
|
-
</pre>
|
105
|
-
|
106
|
-
h3. config/deploy/staging.rb
|
107
|
-
|
108
|
-
<pre>
|
109
|
-
<code>
|
110
|
-
# config/deploy/staging.rb
|
111
|
-
# Database Name
|
112
|
-
set :dbname, "DB_NAME"
|
113
|
-
|
114
|
-
# Backups Path (/var/www/#{application}/staging/backups)
|
115
|
-
set :backups_path, "#{deploy_to}/backups"
|
116
|
-
</code>
|
117
|
-
</pre>
|
118
|
-
|
119
|
-
h3. config/deploy/production.rb
|
120
|
-
|
121
|
-
<pre>
|
122
|
-
<code>
|
123
|
-
# config/deploy/production.rb
|
124
|
-
# Database Name
|
125
|
-
set :dbname, "DB_NAME"
|
126
|
-
|
127
|
-
# Backups Path (/var/www/#{application}/production/backups)
|
128
|
-
set :backups_path, "#{deploy_to}/backups"
|
129
|
-
</code>
|
130
|
-
</pre>
|
42
|
+
Check the "Wiki":https://github.com/augustash/capistrano-ash/wiki for detailed configuration instructions.
|
43
|
+
"Drupal on virtual or dedicated servers":https://github.com/augustash/capistrano-ash/wiki/Drupal-Private-Server-Example
|
44
|
+
"Drupal on shared hosting":https://github.com/augustash/capistrano-ash/wiki/Drupal-Shared-Hosting-Example
|
131
45
|
|
132
46
|
|
133
47
|
h2. Deploying Zend or Zend/Doctrine example
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.12
|
data/capistrano-ash.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{capistrano-ash}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.12"
|
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 = %q{2011-
|
11
|
+
s.authors = [%q{August Ash}]
|
12
|
+
s.date = %q{2011-09-26}
|
13
13
|
s.description = %q{August Ash recipes for Capistrano}
|
14
14
|
s.email = %q{code@augustash.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,8 +33,8 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/ash/zend_doctrine_shared_hosting.rb"
|
34
34
|
]
|
35
35
|
s.homepage = %q{https://github.com/augustash/capistrano-ash}
|
36
|
-
s.require_paths = [
|
37
|
-
s.rubygems_version = %q{1.6
|
36
|
+
s.require_paths = [%q{lib}]
|
37
|
+
s.rubygems_version = %q{1.8.6}
|
38
38
|
s.summary = %q{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
@@ -358,6 +358,28 @@ configuration.load do
|
|
358
358
|
end
|
359
359
|
end
|
360
360
|
end
|
361
|
+
|
362
|
+
namespace :dir do
|
363
|
+
desc "Test: Task to test existence of missing dir"
|
364
|
+
task :missing do
|
365
|
+
if remote_dir_exists?('/etc/fake_dir')
|
366
|
+
logger.info "FAIL - Why does the '/etc/fake_dir' dir exist???"
|
367
|
+
else
|
368
|
+
logger.info "GOOD - Verified the '/etc/fake_dir' dir does not exist!"
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
desc "Test: Task used to test existence of an existing directory"
|
373
|
+
task :exists do
|
374
|
+
if remote_dir_exists?('/etc')
|
375
|
+
logger.info "GOOD - Verified the '/etc' dir exists!"
|
376
|
+
else
|
377
|
+
logger.info "FAIL - WHAT happened to the '/etc' dir???"
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
end
|
382
|
+
|
361
383
|
end
|
362
384
|
|
363
385
|
end
|
data/lib/ash/common.rb
CHANGED
@@ -20,4 +20,14 @@ end
|
|
20
20
|
# the full path to the expected file location
|
21
21
|
def remote_file_exists?(full_path)
|
22
22
|
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
|
23
|
-
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Test to see if a directory exists on a remote
|
26
|
+
# server by providing the full path to the expected
|
27
|
+
# directory
|
28
|
+
#
|
29
|
+
# Params:
|
30
|
+
# +dir_path+
|
31
|
+
def remote_dir_exists?(dir_path)
|
32
|
+
'true' == capture("if [[ -d #{dir_path} ]]; then echo 'true'; fi").strip
|
33
|
+
end
|
data/lib/ash/drupal.rb
CHANGED
@@ -13,6 +13,16 @@ configuration.load do
|
|
13
13
|
# --------------------------------------------
|
14
14
|
proc{_cset( :multisites, {"#{application}" => "#{application}"} )}
|
15
15
|
set :drush_bin, "drush"
|
16
|
+
|
17
|
+
# --------------------------------------------
|
18
|
+
# Ubercart Files/Folders
|
19
|
+
# assumes ubercart files are located
|
20
|
+
# within a files/ubercart directory
|
21
|
+
# for each multisite
|
22
|
+
# --------------------------------------------
|
23
|
+
set :uc_root, "ubercart"
|
24
|
+
set :uc_downloadable_products_root, "downloadable_products"
|
25
|
+
set :uc_encryption_keys_root, "keys"
|
16
26
|
|
17
27
|
# --------------------------------------------
|
18
28
|
# Calling our Methods
|
@@ -54,7 +64,9 @@ configuration.load do
|
|
54
64
|
task :finalize_update, :roles => :web, :except => { :no_release => true } do
|
55
65
|
# remove shared directories
|
56
66
|
multisites.each_pair do |folder, url|
|
57
|
-
|
67
|
+
if folder != url
|
68
|
+
run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
|
69
|
+
end
|
58
70
|
run "rm -Rf #{latest_release}/sites/#{url}/files"
|
59
71
|
end
|
60
72
|
end
|
@@ -97,8 +109,8 @@ configuration.load do
|
|
97
109
|
# Drupal-specific methods
|
98
110
|
# --------------------------------------------
|
99
111
|
namespace :drupal do
|
100
|
-
|
101
|
-
|
112
|
+
desc "Symlink shared directories"
|
113
|
+
task :symlink, :roles => :web, :except => { :no_release => true } do
|
102
114
|
multisites.each_pair do |folder, url|
|
103
115
|
# symlinks the appropriate environment's settings.php file
|
104
116
|
symlink_config_file
|
@@ -108,14 +120,14 @@ configuration.load do
|
|
108
120
|
end
|
109
121
|
end
|
110
122
|
|
111
|
-
|
112
|
-
|
123
|
+
desc <<-DESC
|
124
|
+
Symlinks the appropriate environment's settings file within the proper sites directory
|
113
125
|
|
114
|
-
|
126
|
+
Assumes the environment's settings file will be in one of two formats:
|
115
127
|
settings.<environment>.php => new default
|
116
128
|
settings.php.<environment> => deprecated
|
117
|
-
|
118
|
-
|
129
|
+
DESC
|
130
|
+
task :symlink_config_file, :roles => :web, :except => { :no_release => true} do
|
119
131
|
multisites.each_pair do |folder, url|
|
120
132
|
drupal_app_site_dir = " #{latest_release}/sites/#{url}"
|
121
133
|
|
@@ -130,8 +142,8 @@ configuration.load do
|
|
130
142
|
end
|
131
143
|
end
|
132
144
|
|
133
|
-
|
134
|
-
|
145
|
+
desc "Replace local database paths with remote paths"
|
146
|
+
task :updatedb, :roles => :web, :except => { :no_release => true } do
|
135
147
|
multisites.each_pair do |folder, url|
|
136
148
|
run "#{drush_bin} -l #{url} -r #{current_path} sqlq \"UPDATE {files} SET filepath = REPLACE(filepath,'sites/#{folder}/files','sites/#{url}/files');\""
|
137
149
|
end
|
@@ -140,7 +152,7 @@ configuration.load do
|
|
140
152
|
desc "Clear all Drupal cache"
|
141
153
|
task :clearcache, :roles => :web, :except => { :no_release => true } do
|
142
154
|
multisites.each_pair do |folder, url|
|
143
|
-
|
155
|
+
run "#{drush_bin} -l #{url} -r #{current_path} cache-clear all"
|
144
156
|
end
|
145
157
|
end
|
146
158
|
|
@@ -150,5 +162,96 @@ configuration.load do
|
|
150
162
|
run "chmod 644 #{latest_release}/sites/#{url}/settings.php*"
|
151
163
|
end
|
152
164
|
end
|
165
|
+
|
166
|
+
desc <<-DESC
|
167
|
+
Secures the ubercart sensitive information (credit card encryption keys)
|
168
|
+
and downloadable files by moving them from the sites file structure in
|
169
|
+
the Drupal root (public) and moving them to the shared directory
|
170
|
+
DESC
|
171
|
+
namespace :ubercart do
|
172
|
+
task :default, :roles => :web, :except => { :no_release => true } do
|
173
|
+
# setup necessary directories within our shared directory
|
174
|
+
setup_ubercart_shared
|
175
|
+
|
176
|
+
# move the sites/*/files/downloadable_products
|
177
|
+
# to the shared directory via rsync
|
178
|
+
secure_downloadable_files
|
179
|
+
|
180
|
+
# move the sites/*/files/keys
|
181
|
+
# to the shared directory
|
182
|
+
secure_encryption_key
|
183
|
+
end
|
184
|
+
|
185
|
+
desc <<-DESC
|
186
|
+
Creates the ubercart directory within each multisites shared directory structure.
|
187
|
+
|
188
|
+
Example:
|
189
|
+
shared/abc/ubercart
|
190
|
+
shared/xyz/ubercart
|
191
|
+
DESC
|
192
|
+
task :setup_ubercart_shared, :roles => :web, :except => { :no_release => true } do
|
193
|
+
multisites.each_pair do |folder, url|
|
194
|
+
run "mkdir -p #{shared_path}/#{url}/#{uc_root}"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
desc <<-DESC
|
199
|
+
Stubbed: Moves downloadable files from the public directory (Drupal root)
|
200
|
+
to the shared directories
|
201
|
+
|
202
|
+
Example:
|
203
|
+
sites/abc/files/ubercart/products
|
204
|
+
sites/xyz/files/ubercart/downloadable_products
|
205
|
+
|
206
|
+
are moved to:
|
207
|
+
shared/abc/ubercart/products
|
208
|
+
shared/xyz/ubercart/downloadable_products
|
209
|
+
DESC
|
210
|
+
task :secure_downloadable_files, :except => { :no_release => true } do
|
211
|
+
# loop through the multisites and move files
|
212
|
+
multisites.each_pair do |folder, url|
|
213
|
+
run "mkdir -p #{shared_path}/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
|
214
|
+
|
215
|
+
ubercart_dir = "#{latest_release}/sites/#{url}/files/#{uc_root}/#{uc_downloadable_products_root}"
|
216
|
+
|
217
|
+
case true
|
218
|
+
when remote_dir_exists?("#{ubercart_dir}")
|
219
|
+
run "rsync -rltDvzog #{ubercart_dir} #{shared_path}/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
|
220
|
+
else
|
221
|
+
logger.important "Failed to rsync the ubercart downloadable products in #{ubercart_dir} because the directory doesn't exist"
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
# update the ubercart's database tracking of where the
|
226
|
+
# root file path is for downloadable products. This should
|
227
|
+
# be set as relative to the root of the drupal directory
|
228
|
+
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes uc_file_base_dir ../../shared/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
desc <<-DESC
|
233
|
+
Stubbed: Moves encryption key files from the public directory (Drupal root)
|
234
|
+
to the shared directories
|
235
|
+
|
236
|
+
Example:
|
237
|
+
sites/abc/files/ubercart/keys
|
238
|
+
sites/xyz/files/ubercart/keys
|
239
|
+
|
240
|
+
are moved to:
|
241
|
+
shared/abc/ubercart/keys
|
242
|
+
shared/xyz/ubercart/keys
|
243
|
+
DESC
|
244
|
+
task :secure_encryption_key, :roles => :web, :except => { :no_release => true } do
|
245
|
+
# loop through the multisites and move keys
|
246
|
+
multisites.each_pair do |folder, url|
|
247
|
+
run "mkdir -p #{shared_path}/#{url}/#{uc_root}/#{uc_encryption_keys_root}"
|
248
|
+
|
249
|
+
# update the ubercart's database tracking of where the
|
250
|
+
# root file path is for encryption keys. This should
|
251
|
+
# be set as relative to the root of the drupal directory
|
252
|
+
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes uc_credit_encryption_path ../../shared/#{url}/#{uc_root}/#{uc_encryption_keys_root}"
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
153
256
|
end
|
154
257
|
end
|
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.1.
|
4
|
+
version: 1.1.12
|
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: 2011-09-
|
12
|
+
date: 2011-09-27 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: August Ash recipes for Capistrano
|
15
15
|
email: code@augustash.com
|