Skip to content

Instantly share code, notes, and snippets.

@robinboening
Created October 19, 2013 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinboening/7061638 to your computer and use it in GitHub Desktop.
Save robinboening/7061638 to your computer and use it in GitHub Desktop.
Capistrano and rake tasks to sync database, picture and attachment data of alchemy_cms between i.e. staging and production systems.
# Example usage:
# cap staging sync_with:production
# File: config/deploy/staging.rb
namespace :sync_with do
desc "Sync with production system."
task :production do
run "cd #{current_path} && RAILS_ENV=#{rails_env} #{rake} sync_with:production"
end
end
# File: lib/tasks/sync.rake
namespace :sync_with do
desc "Populates the current server with production server data."
task :production => [:environment] do
system "bundle exec cap production alchemy:import:all"
Rails.cache.clear # clean the complete cache, so the new data will appear.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment