Permalink
Browse files

Refactor to allow the dump task to be run alone without the import

  • Loading branch information...
1 parent d758acc commit 0571a4e45ffaa016481598bcc428d696ec23712f @samsonasu committed Nov 29, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/capistrano/mysqldump.rb
@@ -1,6 +1,11 @@
Capistrano::Configuration.instance.load do
namespace :mysqldump do
task :default, :roles => :db do
+ dump
+ import
+ end
+
+ task :setup do
set :mysqldump_config, YAML.load_file("config/database.yml")[rails_env.to_s]
host = mysqldump_config["host"]
@@ -16,12 +21,10 @@
set :mysqldump_remote_filename, File.join( mysqldump_remote_tmp_dir, mysqldump_filename_gz )
set :mysqldump_local_filename, File.join( mysqldump_local_tmp_dir, mysqldump_filename )
set :mysqldump_local_filename_gz, File.join( mysqldump_local_tmp_dir, mysqldump_filename_gz )
-
- dump
- import
end
task :dump, :roles => :db do
+ setup
username, password, database, host = mysqldump_config.values_at *%w( username password database host )
case mysqldump_location

0 comments on commit 0571a4e

Please sign in to comment.