11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/capistrano/local_config.rb', line 11
def self.load(capistrano_config)
capistrano_config.load do
set :local_config, Blue.config.local_config
namespace :local_config do
desc "Uploads local configuration files to the application's shared directory for \\\nlater symlinking (if necessary). Called if local_config is set.\n DESC\n task :upload do\n Blue.config.local_config.each do |file|\n filename = File.basename(file)\n path = File.dirname(file)\n if File.exist?(file)\n run \"mkdir -p '\#{shared_path}/\#{path}'\" unless path.empty?\n parent.upload(file, \"\#{shared_path}/\#{path}/\#{filename}\")\n end\n end\n end\n\n desc <<-DESC\nSymlinks uploaded local configurations into the release directory.\n DESC\n task :symlink do\n Blue.config.local_config.each do |file|\n filename = File.basename(file)\n path = File.dirname(file)\n run \"mkdir -p '\#{latest_release}/\#{path}'\" unless path.empty?\n run \"ls \#{latest_release}/\#{file} 2> /dev/null || ln -nfs \#{shared_path}/\#{path}/\#{filename} \#{latest_release}/\#{file}\"\n end\n end\n\n desc \"Uplaod and symlink\"\n task :upload_and_symlink do\n upload\n symlink\n end\n end\n\n after 'bundle:install', 'local_config:upload_and_symlink'\n end\nend\n"
|