engineyard-eycap 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/eycap/recipes/database.rb +4 -4
  2. metadata +1 -1
@@ -12,8 +12,8 @@ Capistrano::Configuration.instance(:must_exist).load do
12
12
  task :clone_prod_to_staging, :roles => :db, :only => { :primary => true } do
13
13
  backup_name
14
14
  on_rollback { run "rm -f #{backup_file}" }
15
- prod_info = YAML.load_file("config/database.yml")["production"]
16
- if prod_info['adapter'] == 'mysql'
15
+ run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
16
+ if @environment_info['adapter'] == 'mysql'
17
17
  run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{production_database} > #{backup_file}"
18
18
  run "mysql -u #{dbuser} -p#{dbpass} -h #{staging_dbhost} #{staging_database} < #{backup_file}"
19
19
  else
@@ -26,8 +26,8 @@ Capistrano::Configuration.instance(:must_exist).load do
26
26
  desc "Backup your MySQL or PostgreSQL database to shared_path+/db_backups"
27
27
  task :dump, :roles => :db, :only => {:primary => true} do
28
28
  backup_name
29
- environment_info = YAML.load_file("config/database.yml")[rails_env]
30
- if environment_info['adapter'] == 'mysql'
29
+ run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
30
+ if @environment_info['adapter'] == 'mysql'
31
31
  run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
32
32
  else
33
33
  run "PGPASSWORD=#{dbpass} pg_dump -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-eycap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Engine Yard