lib/pave/database.rb in pave-0.6.0 vs lib/pave/database.rb in pave-0.6.1

- old
+ new

@@ -17,10 +17,15 @@ def setup sh "mysql -uroot -e 'CREATE DATABASE #{name}'" end + def drop + destroy = agree("Are you sure you want to drop #{name}? All data will be lost.") + sh "mysql -uroot -e 'DROP DATABASE #{name}'" if destroy + end + def remote_db require 'json' live_domain = shell("php -r \"error_reporting(0);require('./config/site.php');echo LIVE_DOMAIN;\"").output db_json = shell("php -r \"error_reporting(0);"\ "\\$_SERVER = array('HTTP_HOST' => '#{live_domain}');"\ @@ -66,9 +71,10 @@ end def execute_remote(remote="live") server = Pave::Remote.server(remote) directory = Pave::Remote.directory(remote) + db = remote_db say "Remotely executing #{dump_file} on live #{db['name']}" sh "ssh #{server} \"cd #{directory}/db; gzip -dc #{dump_file} | mysql -u#{db['user']} -p#{db['pass']} #{db['name']}\"" end def upload(remote="live")