Report abuse

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
29
namespace :app do
  namespace :symlinks do

    set :app_symlinks, {}

    def new_symlink_style
      set :app_symlinks, { :public => app_symlinks } if app_symlinks.is_a?(Array)
    end
    
    desc "Setup application symlinks in the public"
    task :setup, :roles => [:app, :web] do
      new_symlink_style
      app_symlinks.each do |key, value|
        dir=(key==:root) ? "" : key+"/"
        value.each { |link| run "mkdir -p #{shared_path}/#{dir}#{link}" }
      end
    end

    desc "Link public directories to shared location."
    task :update, :roles => [:app, :web] do
      new_symlink_style
      app_symlinks.each do |key, value|
        dir=(key==:root) ? "" : key+"/"
        value.each { |link| run "ln -nfs #{shared_path}/#{dir}#{link} #{current_path}/#{dir}#{link}" }
      end
    end

  end
end