If the files are not present, Rails will create them. You could scp the old cached assets into the new directory before starting your Rails code, however I don't believe capistrano is smart about which files have changed so you won't know when to do this.
If you want exactly what you describe, I would maybe md5sum the old and new js/css directories and look for a difference. If there is one, you need to build from scratch, if there is not one, you can scp the old files over.
Alternatively, if all you care about is the memory you can build the assets before starting the servers. Something like:
class AssetCache
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
APPLICATION_JAVASCRIPTS = %w{ mootools mycustom admin }
def pre_cache
javascript_include_tag JAVASCRIPT_ASSETS,
:cache => 'cache/app.js'
end
end
And in cap before you start Rails daemons run script/runner -e production AssetCache.new.pre_cache
to populate the files. In your layouts, just use AssetCache::APPLICATION_JAVASCRIPTS
instead of your inline list of files. Rinse, repeat and wash for stylesheets. The Rails daemons will see the existing caches and not hog your memory.
If you're on multiple servers you will probably need to replicate the assets across without changing their timestamps.
Good luck!