Permalink
Browse files

Replace the default styling of the static error pages with something …

…which will start to inherit the app styles as they are built
  • Loading branch information...
1 parent 461151d commit 3ebdbb73683c481f85a5ac5f1ac6f6739705bc38 @mjankowski mjankowski committed Jun 20, 2012
Showing with 21 additions and 0 deletions.
  1. +15 −0 lib/suspenders/app_builder.rb
  2. +6 −0 lib/suspenders/generators/app_generator.rb
@@ -158,6 +158,21 @@ def copy_miscellaneous_files
copy_file "Procfile"
end
+ def customize_error_pages
+ meta_tags =<<-EOS
+ <meta charset="utf-8" />
+ <meta name="ROBOTS" content="NOODP" />
+ EOS
+ style_tags =<<-EOS
+<link href="/assets/application.css" media="all" rel="stylesheet" type="text/css" />
+ EOS
+ %w(500 404 422).each do |page|
+ inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
+ replace_in_file "public/#{page}.html", /<style.+>.+<\/style>/mi, style_tags.strip
+ replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
+ end
+ end
+
def setup_root_route
route "root :to => 'Clearance::Sessions#new'"
end
@@ -33,6 +33,7 @@ def suspenders_customization
invoke :configure_app
invoke :setup_stylesheets
invoke :copy_miscellaneous_files
+ invoke :customize_error_pages
invoke :setup_root_route
invoke :setup_git
invoke :create_heroku_apps
@@ -143,6 +144,11 @@ def copy_miscellaneous_files
build(:copy_miscellaneous_files)
end
+ def customize_error_pages
+ say "Customizing the 500/404/422 pages"
+ build(:customize_error_pages)
+ end
+
def setup_root_route
if options[:clearance]
say "Setting up a root route"

0 comments on commit 3ebdbb7

Please sign in to comment.