Platinum Partner

Capistrano : Apply Local Patches When Deploying From An External Source Code Repository

I've submitted patches to a couple rails apps, and want to run off of their SCM's trunk code, but with my local patches applied. These Capistrano tasks will take any files matching 
patches/*.diff
in your local directory, and apply them before restarting your app. task :after_setup do patches_setup end task :after_update_code do send_and_apply_patches end task :patches_setup do run "mkdir -p #{deploy_to}/#{shared_dir}/patches" end task :send_and_apply_patches do Dir[File.join(File.dirname(__FILE__), '../patches/*.diff')].sort.each do |patch| puts "sending #{File.basename(patch)}" put(File.read(patch), "#{deploy_to}/#{shared_dir}/patches/#{File.basename(patch)}", :mode => 0777) puts "applying #{File.basename(patch)}" run "cd #{release_path}; patch -p0 < #{deploy_to}/#{shared_dir}/patches/#{File.basename(patch)}" end end
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}