== blavosync INSTALLATION: Add this line BELOW load 'config/deploy' in your Capfile require 'blavosync' USAGE: adds the following tasks to projects using capistrano ------------------------------------------------------------ cap local:backup_content ------------------------------------------------------------ Downloads a tarball of shared content (identified by the :shared_content and :content_directories properties) from a deployable environment (RAILS_ENV) to the local filesystem. ------------------------------------------------------------ cap local:backup_db ------------------------------------------------------------ Backs up deployable environment's database (idgit loentified by the RAILS_ENV environment variable, which defaults to 'production') and copies it to the local machine ------------------------------------------------------------ cap local:force_backup_content ------------------------------------------------------------ Regenerate files. ------------------------------------------------------------ cap local:force_backup_db ------------------------------------------------------------ Regenerate files. ------------------------------------------------------------ cap local:restore_content ------------------------------------------------------------ Restores the backed up content (env var FROM specifies which environment was backed up, defaults to RAILS_ENV) to the local development environment app ------------------------------------------------------------ cap local:restore_db ------------------------------------------------------------ Untars the backup file downloaded from local:backup_db (specified via the FROM env variable, which defalts to RAILS_ENV), and imports (via mysql command line tool) it back into the database defined in the RESTORE_ENV env variable (defaults to development). ------------------------------------------------------------ cap local:resync_db ------------------------------------------------------------ Ensure that a fresh remote data dump is retrieved before syncing to the local environment ------------------------------------------------------------ cap local:sync ------------------------------------------------------------ Wrapper for local:sync_db and local:sync_content $> cap local:sync RAILS_ENV=production RESTORE_ENV=development ------------------------------------------------------------ cap local:sync_content ------------------------------------------------------------ Wrapper for local:backup_content and local:restore_content $> cap local:sync_content RAILS_ENV=production RESTORE_ENV=development ------------------------------------------------------------ cap local:sync_db ------------------------------------------------------------ Wrapper for local:backup_db and local:restore_db. $> cap local:sync_db RAILS_ENV=production RESTORE_ENV=development ------------------------------------------------------------ cap local:sync_init ------------------------------------------------------------ Wrapper for local:force_backup_db, local:force_backup_content, and the local:sync to get a completely fresh set of data from the server $> cap local:sync RAILS_ENV=production RESTORE_ENV=development CONFIGURATION: the following variables (with defaults shown) are available in your deploy.rb set :blavosync_local_root, Pathname.new('.').realpath set :blavosync_content_directories, content_directories ||= "system" set :blavosync_content_path, File.join(shared_path, content_dir) set :blavosync_public_path, File.join(latest_release, 'public') set :blavosync_remote_backup_expires, 100000 set :blavosync_zip_command, "gzip" set :blavosync_unzip_command, "gunzip" set :blavosync_compressed_extension, "gz" set :blavosync_tmp_dir, "tmp" set :blavosync_content_sync_method, 'rsync' set :blavosync_from_env, (ENV['FROM_ENV'].nil? ? 'production' : ENV['RAILS_ENV']) set :blavosync_to_env, (ENV['TO_ENV'].nil? ? 'development' : ENV['TO_ENV']) set :blavosync_rsync_content_backup_file, "#{shared_path}/system" set :blavosync_tar_content_backup_file, "#{shared_path}/backup_#{from_env}_content.tar.#{zip_ext}" set :blavosync_db_backup_file, "#{shared_path}/backup_#{from_env}_db.sql" set :blavosync_db_backup_zip_file, "#{db_backup_file}.#{zip_ext}" == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2009 jayronc. See LICENSE for details.