Created
May 15, 2012 23:09
-
-
Save mhayes/2705867 to your computer and use it in GitHub Desktop.
Scan config/*.yml.samples to determine which files need to be symlinked on production
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
RAILS_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__))) | |
after "deploy:update_code", "deploy:link_config_files" | |
before "deploy:assets:precompile", "deploy:link_config_files" | |
namespace :deploy do | |
desc "Symlink production config files" | |
task :link_config_files do | |
config_files = Dir.glob(Pathname.new(RAILS_ROOT).join("config", "*.yml.sample")) | |
config_files.each do |file| | |
f = File.basename(file, ".yml.sample") | |
run "ln -nfs #{shared_path}/config/#{f}.yml #{release_path}/config/#{f}.yml" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now if you have
config/database.yml
,config/faye.yml
, etc these files will automatically be symlinked into your production environment. That way you can keep this sensitive information out of your repository but at the same time not have to worry about forgetting to symlink something on production.Future ideas:
config/*.yml.sample
files have correspondingconfig/*.yml
in production PRIOR to deployment.