Sha256: ae61dee025eeee1f995d1d04b77863cced744bc304a6d4c7ffbd56f4d49829c6

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

namespace :cloudflare do
  namespace :cache do
    desc "Purge the CloudFlare cache"
    task :purge do
      on roles(:all) do
        raise 'Missing CloudFlare configuration.' unless fetch(:cloudflare_options).respond_to?(:[])
        response = Capistrano::CloudFlare.send_request(fetch(:cloudflare_options))
        if response['result'] == 'success'
          info "Purged CloudFlare cache for #{fetch(:cloudflare_options)[:domain]}"
        else
          error "CloudFlare cache purge failed. Reason: #{response['msg'] || 'unknown.'}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-cloudflare-1.0.0 lib/capistrano/tasks/cloudflare.rake