capistrano-ash 1.1.17 → 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,19 @@
1
+ == 1.1.18
2
+ * FIXED: deploy:setup_backup now also attempts to create the :tmp_backups_path directory
3
+ * added deploy:setup_backup to the backup:default stack so it's always called first (no more messy task chains!)
4
+ * altered Magento's backup:default task to only do a database dump to the backups directory. File level backup will come at a later date.
5
+ * altered Drupal's default for :dump_options which are now empty (equivalent to a run-of-the-mill mysqldump command) due to MYISAM vs INNODB concerns
6
+
7
+
8
+ == 1.1.17
9
+ * FIXED: deploy:setup now creates directories with 755 permissions (instead of g+w)
10
+ * abstracted the ash:fixperms functionality into 2 methods (set_perms_files and set_perms_dirs) in common.rb that take 2 arguments: the file path to the desired directory and the desired permissions
11
+ * changed default location for storing temporary backups from the server's /tmp directory to the :deploy_to/backups/tmp directory
12
+ * added the cleanup task to the backup:default task so the chain of tasks no longer need after "backup", "backup:cleanup"
13
+ * automatically fix permissions of archives before trying to delete old backup files
14
+ * allow user to set the path to the mysqldump command
15
+ * set default mysqldump options to be "--single-transaction --create-options --quick" which will work for INNODB tables but not for MYISAM tables
16
+
1
17
  == 1.1.16
2
18
  * FIXED: added missing function to make "db" migration tasks work correctly
3
19
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.17
1
+ 1.1.18
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-ash"
8
- s.version = "1.1.17"
8
+ s.version = "1.1.18"
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-04-06"
12
+ s.date = "2012-04-11"
13
13
  s.description = "August Ash recipes for Capistrano"
14
14
  s.email = "code@augustash.com"
15
15
  s.extra_rdoc_files = [
data/lib/ash/base.rb CHANGED
@@ -115,7 +115,7 @@ configuration.load do
115
115
 
116
116
  desc "Setup backup directory for database and web files"
117
117
  task :setup_backup, :except => { :no_release => true } do
118
- run "#{try_sudo} mkdir -p #{backups_path} && #{try_sudo} chmod 755 #{backups_path}"
118
+ run "#{try_sudo} mkdir -p #{backups_path} #{tmp_backups_path} && #{try_sudo} chmod 755 #{backups_path}"
119
119
  end
120
120
  end
121
121
 
@@ -169,21 +169,21 @@ configuration.load do
169
169
  # --------------------------------------------
170
170
  namespace :db do
171
171
  desc "Migrate remote application database to local server"
172
- task :to_local do
172
+ task :to_local, :roles => :db, :except => { :no_release => true } do
173
173
  remote_export
174
174
  remote_download
175
175
  local_import
176
176
  end
177
177
 
178
178
  desc "Migrate local application database to remote server"
179
- task :to_remote do
179
+ task :to_remote, :roles => :db, :except => { :no_release => true } do
180
180
  local_export
181
181
  local_upload
182
182
  remote_import
183
183
  end
184
184
 
185
185
  desc "Handles importing a MySQL database dump file. Uncompresses the file, does regex replacements, and imports."
186
- task :local_import do
186
+ task :local_import, :roles => :db do
187
187
  # check for compressed file and decompress
188
188
  if local_file_exists?("#{db_remote_name}.sql.gz")
189
189
  system "gunzip -f #{db_remote_name}.sql.gz"
@@ -210,7 +210,7 @@ configuration.load do
210
210
  end
211
211
 
212
212
  desc "Upload locally created MySQL dumpfile to remote server via SCP"
213
- task :local_upload do
213
+ task :local_upload, :roles => :db do
214
214
  upload "#{db_local_name}.sql.gz", "#{deploy_to}/#{db_local_name}.sql.gz", :via => :scp
215
215
  end
216
216
 
@@ -243,7 +243,7 @@ configuration.load do
243
243
  end
244
244
 
245
245
  desc "Download remotely created MySQL dumpfile to local machine via SCP"
246
- task :remote_download do
246
+ task :remote_download, :roles => :db do
247
247
  download "#{deploy_to}/#{db_remote_name}.sql.gz", "#{db_remote_name}.sql.gz", :via => :scp
248
248
  end
249
249
  end
@@ -279,6 +279,7 @@ configuration.load do
279
279
  namespace :backup do
280
280
  desc "Perform a backup of web and database files"
281
281
  task :default do
282
+ deploy.setup_backup
282
283
  db
283
284
  web
284
285
  cleanup
data/lib/ash/drupal.rb CHANGED
@@ -13,6 +13,8 @@ configuration.load do
13
13
  # --------------------------------------------
14
14
  proc{_cset( :multisites, {"#{application}" => "#{application}"} )}
15
15
  set :drush_bin, "drush"
16
+ _cset :dump_options, "" # blank options b/c of MYISAM engine (unless anyone knows options that should be included)
17
+
16
18
 
17
19
  # --------------------------------------------
18
20
  # Ubercart Files/Folders
@@ -87,6 +89,27 @@ configuration.load do
87
89
  end
88
90
  end
89
91
  end
92
+
93
+ # --------------------------------------------
94
+ # Remote/Local database migration tasks
95
+ # --------------------------------------------
96
+ namespace :db do
97
+ task :local_export do
98
+ mysqldump = fetch(:mysqldump, "mysqldump")
99
+ dump_options = fetch(:dump_options, "")
100
+
101
+ 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
+ end
103
+
104
+ desc "Create a compressed MySQL dumpfile of the remote database"
105
+ task :remote_export, :roles => :db do
106
+ mysqldump = fetch(:mysqldump, "mysqldump")
107
+ dump_options = fetch(:dump_options, "")
108
+
109
+ 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
+ end
111
+
112
+ end
90
113
 
91
114
  namespace :backup do
92
115
  desc "Perform a backup of database files"
data/lib/ash/magento.rb CHANGED
@@ -123,5 +123,34 @@ configuration.load do
123
123
  end
124
124
  end
125
125
  end
126
+
127
+ # --------------------------------------------
128
+ # Override the base.rb backup tasks
129
+ # --------------------------------------------
130
+ namespace :backup do
131
+ desc "Perform a backup of ONLY database SQL files"
132
+ task :default do
133
+ deploy.setup_backup
134
+ db
135
+ cleanup
136
+ end
137
+
138
+ desc "Perform a backup of database files"
139
+ task :db, :roles => :db do
140
+ if previous_release
141
+ puts "Backing up the database now and putting dump file in the #{stage}/backups directory"
142
+
143
+ # define the filename (dump the SQL file directly to the backups directory)
144
+ filename = "#{backups_path}/#{dbname}_dump-#{Time.now.to_s.gsub(/ /, "_")}.sql.gz"
145
+
146
+ # dump the database for the proper environment
147
+ run "#{mysqldump} #{dump_options} -u #{dbuser} -p #{dbname} | gzip -c --best > #{filename}" do |ch, stream, out|
148
+ ch.send_data "#{dbpass}\n" if out =~ /^Enter password:/
149
+ end
150
+ else
151
+ logger.important "no previous release to backup to; backup of database skipped"
152
+ end
153
+ end
154
+ end
126
155
 
127
156
  end
metadata CHANGED
@@ -1,23 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capistrano-ash
3
- version: !ruby/object:Gem::Version
4
- version: 1.1.17
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 1.1.18
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - August Ash
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-06 00:00:00.000000000 Z
12
+
13
+ date: 2012-04-11 00:00:00 Z
13
14
  dependencies: []
15
+
14
16
  description: August Ash recipes for Capistrano
15
17
  email: code@augustash.com
16
18
  executables: []
19
+
17
20
  extensions: []
18
- extra_rdoc_files:
21
+
22
+ extra_rdoc_files:
19
23
  - README.textile
20
- files:
24
+ files:
21
25
  - CHANGELOG.rdoc
22
26
  - README.textile
23
27
  - Rakefile
@@ -35,26 +39,30 @@ files:
35
39
  - lib/ash/zend_doctrine_shared_hosting.rb
36
40
  homepage: https://github.com/augustash/capistrano-ash
37
41
  licenses: []
42
+
38
43
  post_install_message:
39
44
  rdoc_options: []
40
- require_paths:
45
+
46
+ require_paths:
41
47
  - lib
42
- required_ruby_version: !ruby/object:Gem::Requirement
48
+ required_ruby_version: !ruby/object:Gem::Requirement
43
49
  none: false
44
- requirements:
45
- - - ! '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
55
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
54
60
  requirements: []
61
+
55
62
  rubyforge_project:
56
63
  rubygems_version: 1.8.21
57
64
  signing_key:
58
65
  specification_version: 3
59
66
  summary: Useful task libraries for August Ash recipes for Capistrano
60
67
  test_files: []
68
+