forked from mdespuits/capistrano-recipes
-
Notifications
You must be signed in to change notification settings - Fork 3
/
application_yml_file.rb
28 lines (23 loc) · 1006 Bytes
/
application_yml_file.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# Manage config/application.yml file: concatenate example and secrets
# files.
namespace :application_yml do
desc "Setup application.yml file"
task :setup do
run "cd #{shared_path} && rake --rakefile #{release_path}/Rakefile setup:config:config/application.yml"
end
after "bundle:install", "application_yml:setup"
before "application_yml:setup", "application_yml:upload_yml"
desc "Upload application.*.yml files"
task :upload_yml do
%w{ secrets example}.each do |file|
run_locally "test -f #{%x{pwd}.chomp}/config/application.#{file}.yml || touch #{%x{pwd}.chomp}/config/application.#{file}.yml"
upload "#{%x{pwd}.chomp}/config/application.#{file}.yml", "#{shared_path}/config/application.#{file}.yml"
end
end
desc "Symlink the application.yml file into latest release"
task :symlink do
run "ln -nfs #{shared_path}/config/application.yml #{release_path}/config/application.yml"
end
after "deploy:finalize_update", "application_yml:symlink"
end