Created
July 23, 2011 03:09
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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