capistrano-database 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = 'capistrano-database'
15
15
  gem.require_paths = ['lib']
16
- gem.version = '0.0.6'
16
+ gem.version = '0.0.7'
17
17
 
18
18
  # Runtime dependencies
19
19
  gem.add_dependency 'rake'
@@ -20,7 +20,9 @@ Capistrano::Configuration.instance(:must_exist).load do
20
20
  desc 'Backup the database'
21
21
  task :backup, :roles => :db do
22
22
  set :latest_backup,
23
- "#{fetch :backup_path}/#{fetch :db_database_name}_#{Time.now.strftime('%d-%m-%Y_%H-%M-%S')}.sql"
23
+ "#{fetch :backup_path}/#{fetch :db_database_name}_#{Time.now.strftime('%d-%m-%Y_%H-%M-%S')}.sql.bz2"
24
+ on_rollback { run "rm -f #{latest_backup.chomp '.bz2'} #{latest_backup}" }
25
+
24
26
  transaction do
25
27
  find_and_execute_db_task :backup
26
28
  end
@@ -120,7 +122,7 @@ Capistrano::Configuration.instance(:must_exist).load do
120
122
  task :download_backup, :roles => :db do
121
123
  fn = "#{arguments(false).first || random_tmp_file}.bz2"
122
124
  on_rollback { `rm -f #{fn}` }
123
- download "#{fetch :latest_backup}.bz2", fn
125
+ download "#{fetch :latest_backup}", fn
124
126
  logger.important "The backup has been downloaded to #{fn}"
125
127
  end
126
128
 
@@ -51,7 +51,6 @@ Capistrano::Configuration.instance(:must_exist).load do
51
51
  desc '[internal] Backup mysql database'
52
52
  task :backup, :roles => :db do
53
53
  latest_backup = fetch :latest_backup
54
- on_rollback { run "rm -f #{latest_backup}" }
55
54
  auth = fetch :db_credentials
56
55
 
57
56
  begin
@@ -62,8 +61,8 @@ Capistrano::Configuration.instance(:must_exist).load do
62
61
  --password='#{auth[:password]}' \
63
62
  --default-character-set=utf8 \
64
63
  '#{fetch :db_database_name}' > \
65
- '#{latest_backup}' &&
66
- #{try_sudo} bzip2 -9 '#{latest_backup}'
64
+ '#{latest_backup.chomp '.bz2'}' &&
65
+ #{try_sudo} bzip2 -9 '#{latest_backup.chomp '.bz2'}'
67
66
  CMD
68
67
  rescue Capistrano::CommandError
69
68
  abort 'Not able to backup the database'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-database
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -421178969461404157
81
+ hash: -2396939127496502971
82
82
  requirements: []
83
83
  rubyforge_project:
84
84
  rubygems_version: 1.8.23