Created
February 12, 2012 13:18
-
-
Save voldy/1808418 to your computer and use it in GitHub Desktop.
Capistrano Mongoid recipes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the config/mongoid/#{rails_env}.yml file for mongoid config | |
namespace :mongoid do | |
desc "Copy mongoid config" | |
task :copy do | |
upload "config/mongoid/#{rails_env}.yml", "#{shared_path}/mongoid.yml", :via => :scp | |
end | |
desc "Link the mongoid config in the release_path" | |
task :symlink do | |
run "test -f #{release_path}/config/mongoid.yml || ln -s #{shared_path}/mongoid.yml #{release_path}/config/mongoid.yml" | |
end | |
desc "Create MongoDB indexes" | |
task :index do | |
run "cd #{current_path} && #{bundle_cmd} exec rake db:mongoid:create_indexes", :once => true | |
end | |
end | |
after "deploy:update_code", "mongoid:copy" | |
after "deploy:update_code", "mongoid:symlink" | |
after "deploy:update", "mongoid:index" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @voldy! Could you please help me a bit with this code?
What does it exactly mean
:once => true
? As we actually need to create indexes on each deploy (it's like a migration).Also is
#{bundle_cmd}
still relevant? Does it have a RAILS_ENV variable setting inside of it?