/html5boilerplate.rb

https://github.com/grigio/rails-3-templates · Ruby · 120 lines · 88 code · 26 blank · 6 comment · 7 complexity · 146fe7a42dcbaf81c436479b3208320a MD5 · raw file

  1. # Rails 3 simple template
  2. # USE ONLY ON EMPTY APPS - USAGE:rails new app_name -m rails3-templates/base.rb
  3. # Remove Default
  4. run 'mv public/index.html public/test-rails3.html'
  5. # Install JQuery
  6. inside "public/javascripts" do
  7. FileUtils.rm_rf %w(controls.js dragdrop.js effects.js prototype.js rails.js)
  8. run "wget https://github.com/rails/jquery-ujs/raw/master/src/rails.js --no-check-certificate"
  9. end
  10. # Install HTML5-Boilerplate
  11. inside "public" do
  12. run "git clone http://github.com/paulirish/html5-boilerplate.git"
  13. run 'cp html5-boilerplate/* . -R'
  14. run 'mv js/* javascripts/'
  15. run 'mv javascripts/libs/* javascripts/'
  16. run 'mv css/* stylesheets/'
  17. run 'rm -Rf js css html5-boilerplate'
  18. run 'mv index.html example-html5b.html'
  19. inside "javascripts" do
  20. run "mv jquery-*.min.js jquery.js"
  21. run "mv modernizr-* modernizr.js"
  22. end
  23. end
  24. run 'rm app/views/layouts/application.html.erb'
  25. # Layout
  26. file 'app/views/layouts/application.html.erb', <<-FILE
  27. <!doctype html>
  28. <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
  29. <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
  30. <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
  31. <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
  32. <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
  33. <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
  34. <head>
  35. <meta charset="utf-8">
  36. <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
  37. Remove this if you use the .htaccess -->
  38. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  39. <title></title>
  40. <meta name="description" content="">
  41. <meta name="author" content="">
  42. <!-- Mobile viewport optimized: j.mp/bplateviewport -->
  43. <meta name="viewport" content="width=device-width; initial-scale=1.0">
  44. <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
  45. <link rel="shortcut icon" href="/favicon.ico">
  46. <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  47. <%= stylesheet_link_tag :all %>
  48. <%= javascript_include_tag 'jquery', 'rails', 'modernizr' %>
  49. <%= csrf_meta_tag %>
  50. </head>
  51. <body>
  52. <div id="container">
  53. <header>
  54. </header>
  55. <div id="main">
  56. <%= yield %>
  57. </div>
  58. <footer>
  59. </footer>
  60. </div>
  61. <!-- end of #container -->
  62. <!-- Javascript at the bottom for fast page loading -->
  63. <script src="/javascripts/plugins.js?v=1"></script>
  64. <script src="/javascripts/script.js?v=1"></script>
  65. <!--[if lt IE 7 ]>
  66. <script src="/javascripts/dd_belatedpng.js?"></script>
  67. <script>
  68. DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images
  69. </script>
  70. <![endif]-->
  71. <% if Rails.env == 'development' %>
  72. <!-- yui profiler and profileviewer - remove for production -->
  73. <script src="/javascripts/profiling/yahoo-profiling.min.js"></script>
  74. <script src="/javascripts/profiling/config.js?v=1"></script>
  75. <!-- end profiling code -->
  76. <% end %>
  77. <% if Rails.env == 'production' %>
  78. <!-- asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
  79. change the UA-XXXXX-X to be your site's ID -->
  80. <script>
  81. var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
  82. (function(d, t) {
  83. var g = d.createElement(t),
  84. s = d.getElementsByTagName(t)[0];
  85. g.async = true;
  86. g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  87. s.parentNode.insertBefore(g, s);
  88. })(document, 'script');
  89. </script>
  90. <% end %>
  91. </body>
  92. </html>
  93. FILE