vanutsteen.nl => nerds only A blog on rails, php, computing, my bass guitar and stuff

Asset directories and capistrano

on in Ruby

I have this public/images/cars directory but it gets overwritten everytime I use “cap deploy”. So in order to have my images/cars directory saved every time, I used this addon for capistrano:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
set :assets, ['images/cars']

namespace :deploy do
  task :after_deploy do
    copy_assets
  end
end

namespace :deploy do
  desc "Link in the production database.yml"
  task :copy_assets do
  self.assets ||= []
    assets.each do |asset|
      run "cp -r #{previous_release}/public/#{asset} #{release_path}/public/#{asset}"
    end
  end
end

Worked like a charm for me!

Comments