namespace :patcher do

desc 'Patch your rails app to protect from the CSRF vulnerability' do
  task :install do
    source = File.join(Gem.loaded_specs['rails3_csrf_patcher'].full_gem_path, 'lib/rail3_csrf_patcher/patch.rb')
    target = File.join(Rails.root, 'config/initializers/')

    FileUtils.cp source, target
  end
end

desc 'Unpatch your rails app from the CSRF vulnerability protection' do
  task :uninstall do
    patch_file = File.join(Gem.loaded_specs['rails3_csrf_patcher'].full_gem_path, 'lib/rail3_csrf_patcher/patch.rb')

    FileUtils.rm patch_file if patch_file.present?
  end
end

end