h1. Porter Gem The Porter gem is comprised of Capistrano and Rake tasks that make cloning your production and/or staging server data down to your development environment a cinch. h2. Overview * A mysqldump command is remotely issued (via Capistrano) to the remote server (production or staging environment), saving the result as a compressed (gz) file * The database backup file from the server is retrieved (via scp) and decompressed * The development database is dropped, recreated, and restored from the backup * Assets stored in shared/public are rysnc'd down to your local public directory (exclusions are accepted!) * Separate rake tasks are included for restoring the db and re-syncing the assets without re-dumping the remote db h2. Dependencies * Capistrano (and a config/deploy.rb file) * Rake * A Rails App * rsync (locally and remotely) h2. Installation * Add config.gem 'porter' to your Gemfile * Run: bundle install * Run: rails g porter * Add require 'porter' to your config/deploy.rb * See the generated config/porter_config.yml - it's pretty straight-forward h2. Usage * cap porter:[stage] (creates the remote db backup file then calls the two rake tasks below) * rake porter:[stage]:db (if you've already got a db backup on the remote server and want to restore from it again) * rake porter:[stage]:assets (rsync the assets down from the remote server again) Note: [stage] is most likely going to be 'production' unless your app has a staging or demo environment and you want to pull from there instead. h2. License The MIT License Copyright (c) 2010-2011 Kenny Johnston Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.