Created
March 17, 2012 12:25
-
-
Save corny/2058358 to your computer and use it in GitHub Desktop.
Capistrano recipe to move and replace the secret-token on deployment if missing in shared directory
This file contains 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
namespace :deploy do | |
desc "Moves and replaces the secret-token if missing in shared directory" | |
task :symlink_secret, :roles => :app, :except => { :no_release => true } do | |
filename = 'secret_token.rb' | |
release_secret = "#{release_path}/config/initializers/#{filename}" | |
shared_secret = "#{shared_path}/config/#{filename}" | |
if capture("[ -f #{shared_secret} ] || echo missing").start_with?('missing') | |
rake_command "secret:replace" | |
run "mv #{release_secret} #{shared_secret}" | |
end | |
# symlink secret token | |
run "ln -nfs #{shared_secret} #{release_secret}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is
rake_command
?