# Application template recipe for the rails_apps_composer. Check for a newer version here: # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/html5.rb if config['html5'] if recipes.include? 'rails 3.1' gem 'frontend-helpers' after_bundler do say_wizard "HTML5 Boilerplate recipe running 'after bundler'" # Download HTML5 Boilerplate JavaScripts get "https://raw.github.com/paulirish/html5-boilerplate/master/js/libs/modernizr-2.0.6.min.js", "app/assets/javascripts/modernizr.js" # Download stylesheet to normalize or reset CSS case config['css_option'] when 'skeleton' get "https://raw.github.com/necolas/normalize.css/master/normalize.css", "app/assets/stylesheets/normalize.css.scss" get "https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css", "app/assets/stylesheets/base.css.scss" get "https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css", "app/assets/stylesheets/layout.css.scss" get "https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css", "app/assets/stylesheets/skeleton.css.scss" get "https://raw.github.com/dhgamache/Skeleton/master/javascripts/app.js", "app/assets/javascripts/tabs.js" when 'normalize' get "https://raw.github.com/necolas/normalize.css/master/normalize.css", "app/assets/stylesheets/normalize.css.scss" when 'reset' get "https://raw.github.com/paulirish/html5-boilerplate/master/css/style.css", "app/assets/stylesheets/reset.css.scss" end # Download HTML5 Boilerplate Site Root Assets get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-114x114-precomposed.png", "public/apple-touch-icon-114x114-precomposed.png" get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-57x57-precomposed.png", "public/apple-touch-icon-57x57-precomposed.png" get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-72x72-precomposed.png", "public/apple-touch-icon-72x72-precomposed.png" get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-precomposed.png", "public/apple-touch-icon-precomposed.png" get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon.png", "public/apple-touch-icon.png" get "https://raw.github.com/paulirish/html5-boilerplate/master/crossdomain.xml", "public/crossdomain.xml" get "https://raw.github.com/paulirish/html5-boilerplate/master/humans.txt", "public/humans.txt" # Set up the default application layout if recipes.include? 'haml' # create some Haml helpers # We have to use single-quote-style-heredoc to avoid interpolation. inject_into_file 'app/controllers/application_controller.rb', :after => "protect_from_forgery\n" do <<-'RUBY' include FrontendHelpers::Html5Helper RUBY end # Haml version of default application layout remove_file 'app/views/layouts/application.html.erb' remove_file 'app/views/layouts/application.html.haml' # There is Haml code in this script. Changing the indentation is perilous between HAMLs. create_file 'app/views/layouts/application.html.haml' do <<-HAML - html_tag class: 'no-js' do %head %title #{app_name} %meta{:charset => "utf-8"} %meta{"http-equiv" => "X-UA-Compatible", :content => "IE=edge,chrome=1"} %meta{:name => "viewport", :content => "width=device-width, initial-scale=1, maximum-scale=1"} = stylesheet_link_tag :application = javascript_include_tag :application = csrf_meta_tags %body{:class => params[:controller]} #container.container %header - flash.each do |name, msg| = content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String) #main{:role => "main"} = yield %footer HAML end else # ERB version of default application layout remove_file 'app/views/layouts/application.html.erb' remove_file 'app/views/layouts/application.html.haml' create_file 'app/views/layouts/application.html.erb' do <<-ERB