Sha256: 510cb47a69850132eae18bd57c7df6b4c0140003cde8722eb39f90295a638996
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require File.expand_path("#{File.dirname(__FILE__)}/connexion") class Database def initialize(config_file = fetch(:filename) || 'config/database.yml') @config_file = config_file end def dump #dump_file = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H-%M-%S'}.sql" #username, password, database, host = database_config('development') #system "mysqldump -u #{username} --password=#{password} #{database} > #{dump_file}" end def sync_dir execute :mkdir, "-p #{shared_path}/sync" end end # # The remote database # class Remote < Database #def initialize # puts "yyy" #Connexion.new(config_file, 'stage') #end # Download the dump file to the local directory def download local_file = "#{shared_path}/sync/#{dump_file}" download! dump_file, local_file end end # # The local database # class Locale < Database # Upload the dump file to the shared directory def upload remote_file = "#{shared_path}/sync/#{dump_file}" upload! dump_file, remote_file end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
capistrano-db-sync-0.0.15 | lib/capistrano/tasks/database.rb |
capistrano-db-sync-0.0.14 | lib/capistrano/tasks/database.rb |
capistrano-db-sync-0.0.13 | lib/capistrano/tasks/database.rb |