Skip to content

Instantly share code, notes, and snippets.

@RohanM
Created July 23, 2011 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RohanM/1100915 to your computer and use it in GitHub Desktop.
Save RohanM/1100915 to your computer and use it in GitHub Desktop.
A half-finished rake task to output static error pages from dynamic pages
desc "Generate static error page HTML"
task :generate_error_pages => :environment do
av = ActionView::Base.new(Rails::Configuration.new.view_path)
av.class_eval do
include Rails.application.routes.url_helpers # brings ActionDispatch::Routing::UrlFor
include ActionView::Helpers::TagHelper
include LayoutHelper
def cache(name = {}, options = nil, &block)
yield
end
def protect_against_forgery?
false
end
#def config
# Class.new do
# def assets_dir
# # /home/rohan/dev/greatvenue_website/public
# '/home/rohan/dev/greatvenue_website/public'
# end
# def asset_path
# ''
# end
# def asset_host
# ''
# end
#
# def perform_caching
# false
# end
# end.new
#end
end
# Copied from ApplicationController::load_globals
av.assign({:list_signup_simple => ListSignup.new(:interests => Gibbon::FRIENDS_GROUPS_INTEREST_GROUPS[1])})
f = File.new("public/500.html", 'w')
f.puts(av.render(:template => "errors/500.html.haml", :layout => 'layouts/one_col'))
f.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment