Sha256: da08b60e7c1ebc9812229a08da15909eee77819e32d828827fe21d2c805d69d3

Contents?: true

Size: 522 Bytes

Versions: 4

Compression:

Stored size: 522 Bytes

Contents

namespace :exceptionally_beautiful do
  desc "Cache all Exceptionally Beautiful error pages in your application's public folder"
  task :cache => :environment do
    app = ActionDispatch::Integration::Session.new(Rails.application)
    app.https!

    ExceptionallyBeautiful.errors.each do |error_code|
      app.get "/#{error_code}"

      file_path = Rails.root.join('public')
      file_name = "/#{error_code}.html"

      File.open([file_path, file_name].join, 'w') { |f| f.write(app.response.body) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exceptionally_beautiful-0.1.5 lib/exceptionally_beautiful/tasks/exceptionally_beautiful.rake
exceptionally_beautiful-0.1.4 lib/exceptionally_beautiful/tasks/exceptionally_beautiful.rake
exceptionally_beautiful-0.1.3 lib/exceptionally_beautiful/tasks/exceptionally_beautiful.rake
exceptionally_beautiful-0.1.2 lib/exceptionally_beautiful/tasks/exceptionally_beautiful.rake