├── .gitignore ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── app ├── assets │ └── javascripts │ │ ├── application.js │ │ └── polyfills.js └── views │ ├── application │ ├── _chromeframe.html.erb │ ├── _flashes.html.erb │ ├── _footer.html.erb │ ├── _head.html.erb │ ├── _header.html.erb │ ├── _javascripts.html.erb │ └── _stylesheets.html.erb │ └── layouts │ └── application.html.erb ├── html5-rails.gemspec ├── lib ├── generators │ └── html5 │ │ ├── assets │ │ ├── USAGE │ │ ├── assets_generator.rb │ │ └── templates │ │ │ ├── javascripts │ │ │ ├── application.js │ │ │ └── polyfills.js │ │ │ └── stylesheets │ │ │ └── application │ │ │ ├── index.css.scss │ │ │ ├── layout.css.scss │ │ │ ├── media_queries.css.scss │ │ │ └── variables.css.scss │ │ ├── generator_helpers.rb │ │ ├── install │ │ ├── USAGE │ │ ├── install_generator.rb │ │ └── templates │ │ │ ├── README │ │ │ └── config │ │ │ ├── compass.rb │ │ │ └── html5_rails.yml │ │ ├── layout │ │ ├── USAGE │ │ ├── layout_generator.rb │ │ └── templates │ │ │ ├── application.html.erb │ │ │ ├── application.html.haml │ │ │ └── application.html.slim │ │ └── partial │ │ ├── USAGE │ │ ├── partial_generator.rb │ │ └── templates │ │ ├── _chromeframe.html.erb │ │ ├── _chromeframe.html.haml │ │ ├── _chromeframe.html.slim │ │ ├── _flashes.html.erb │ │ ├── _flashes.html.haml │ │ ├── _flashes.html.slim │ │ ├── _footer.html.erb │ │ ├── _footer.html.haml │ │ ├── _footer.html.slim │ │ ├── _head.html.erb │ │ ├── _head.html.haml │ │ ├── _head.html.slim │ │ ├── _header.html.erb │ │ ├── _header.html.haml │ │ ├── _header.html.slim │ │ ├── _javascripts.html.erb │ │ ├── _javascripts.html.haml │ │ ├── _javascripts.html.slim │ │ ├── _stylesheets.html.erb │ │ ├── _stylesheets.html.haml │ │ └── _stylesheets.html.slim ├── html5-rails.rb └── html5 │ ├── rails.rb │ └── rails │ ├── engine.rb │ ├── helpers.rb │ └── version.rb ├── test ├── dummy │ ├── .gitignore │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── images │ │ │ │ └── rails.png │ │ │ ├── javascripts │ │ │ │ ├── application.js │ │ │ │ └── pages.js.coffee │ │ │ └── stylesheets │ │ │ │ └── application.css │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ └── pages_controller.rb │ │ ├── helpers │ │ │ ├── application_helper.rb │ │ │ └── pages_helper.rb │ │ ├── mailers │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ └── views │ │ │ ├── layouts │ │ │ └── application.html.erb │ │ │ └── pages │ │ │ └── home.html.erb │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── backtrace_silencers.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── secret_token.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ └── routes.rb │ ├── db │ │ └── seeds.rb │ ├── doc │ │ └── README_FOR_APP │ ├── lib │ │ ├── assets │ │ │ └── .gitkeep │ │ └── tasks │ │ │ └── .gitkeep │ ├── log │ │ └── .gitkeep │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── favicon.ico │ │ └── robots.txt │ ├── script │ │ └── rails │ └── vendor │ │ ├── assets │ │ ├── javascripts │ │ │ └── .gitkeep │ │ └── stylesheets │ │ │ └── .gitkeep │ │ └── plugins │ │ └── .gitkeep ├── generators │ ├── assets_generator_test.rb │ ├── install_generator_test.rb │ ├── layout_generator_test.rb │ └── partial_generator_test.rb ├── html5_rails_test.rb ├── integration │ └── navigation_test.rb ├── support │ ├── generator_test_helper.rb │ └── integration_case.rb └── test_helper.rb └── vendor └── assets └── javascripts ├── h5bp.js └── modernizr.min.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | .bundle 3 | Gemfile.lock 4 | pkg/* 5 | test/tmp 6 | vendor/bundle 7 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gemspec 4 | 5 | gem 'rails', '3.2.13' 6 | 7 | # Bundle edge Rails instead: 8 | # gem 'rails', :git => 'git://github.com/rails/rails.git' 9 | 10 | gem 'sqlite3' 11 | 12 | 13 | # Gems used only for assets and not required 14 | # in production environments by default. 15 | group :assets do 16 | gem 'sass-rails', '~> 3.2.3' 17 | gem 'coffee-rails', '~> 3.2.1' 18 | gem 'uglifier', '>= 1.0.3' 19 | gem 'compass-rails' 20 | gem 'compass-h5bp', :path => '../compass-h5bp' 21 | end 22 | 23 | gem 'jquery-rails' 24 | gem 'haml-rails' 25 | gem 'slim-rails' 26 | 27 | # To use debugger 28 | # gem 'ruby-debug19', :require => 'ruby-debug' 29 | 30 | group :test do 31 | # Pretty printed test output 32 | gem 'turn', :require => false 33 | gem 'capybara' 34 | end 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Peter Gumeson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Html5 for Rails 2 | ========================= 3 | 4 | Html5 for Rails projects based on [Html5 Boilerplate](http://html5boilerplate.com) 5 | by Paul Irish, Divya Manian and many other [fine folks](https://github.com/h5bp/html5-boilerplate/contributors). 6 | 7 | Installation 8 | ========================= 9 | 10 | ##### 1. In your Gemfile 11 | 12 | ```ruby 13 | group :assets do 14 | gem 'sass-rails' 15 | gem 'coffee-rails' 16 | gem 'uglifier' 17 | 18 | gem 'compass-h5bp' 19 | end 20 | 21 | gem 'jquery-rails' 22 | gem 'html5-rails' 23 | 24 | # Optional: to generate haml 25 | # gem 'haml-rails' 26 | 27 | # Optional: to generate slim 28 | # gem 'slim-rails' 29 | ``` 30 | 31 | ##### 2. Install your bundle 32 | 33 | ``` 34 | $ bundle install 35 | ``` 36 | 37 | ##### 3. Run the generator 38 | 39 | ``` 40 | $ rails generate html5:install 41 | ``` 42 | 43 | ##### (Here's what it does) 44 | 45 | create config/compass.rb 46 | create config/html5_rails.yml 47 | create app/views/layouts/application.html.(erb|haml|slim) 48 | create app/views/application 49 | create app/views/application/_footer.html.(erb|haml|slim) 50 | create app/views/application/_head.html.(erb|haml|slim) 51 | create app/views/application/_header.html.(erb|haml|slim) 52 | create app/views/application/_chromeframe.html.(erb|haml|slim) 53 | exist app/assets/javascripts 54 | insert app/assets/javascripts/application.js 55 | gsub app/assets/javascripts/application.js 56 | create app/assets/javascripts/polyfills.js 57 | remove app/assets/stylesheets/application.css 58 | create app/assets/stylesheets/application 59 | create app/assets/stylesheets/application/index.css.scss 60 | create app/assets/stylesheets/application/variables.css.scss 61 | create app/assets/stylesheets/application/layout.css.scss 62 | create app/assets/stylesheets/application/media_queries.css.scss 63 | 64 | ##### 4. And you're done! 65 | 66 | rails server 67 | 68 | 69 | Options 70 | ========================= 71 | 72 | To see other generators available run: 73 | 74 | ``` 75 | $ rails generate html5:layout --help 76 | $ rails generate html5:partial --help 77 | $ rails generate html5:assets --help 78 | ``` 79 | 80 | Google Analytics 81 | ========================= 82 | 83 | By default your Google Analytics code snippet will be hidden until you set your Google Account ID. 84 | You can do this by either setting `ENV['GOOGLE_ACCOUNT_ID']` or `google_account_id` in config/html5_rails.yml. 85 | 86 | Notes 87 | ========== 88 | 89 | [1] The `compass-h5bp` gem is not a runtime dependency, but it does need to be 90 | included in your assets group for development and asset precompiling to work. 91 | 92 | [2] If you use `--template-engine=haml` (or `haml-rails` gem), the install 93 | generator will prompt to remove your application.html.erb layout so that 94 | application.html.haml will be used instead. 95 | 96 | [3] For the time being, you will want to add the following line to 97 | config/production.rb so that polyfills are precompiled on deploy: 98 | 99 | `config.assets.precompile += %w( polyfills.js )` 100 | 101 | 102 | License 103 | ======== 104 | 105 | Copyright (c) 2010-2013 Peter Gumeson. 106 | See [LICENSE](https://github.com/sporkd/html5-rails/blob/master/LICENSE) for full license. 107 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' 2 | require 'rake/testtask' 3 | 4 | Rake::TestTask.new(:test) do |t| 5 | t.libs << 'lib' 6 | t.libs << 'test' 7 | t.pattern = 'test/**/*_test.rb' 8 | t.verbose = true 9 | end 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into including all the files listed below. 2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 3 | // be included in the compiled file accessible from http://example.com/assets/application.js 4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 5 | // the compiled file. 6 | // 7 | //= require jquery 8 | //= require jquery_ujs 9 | //= require h5bp 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/polyfills.js: -------------------------------------------------------------------------------- 1 | // This is a manifest for javascript polyfills that will be included 2 | // in the head section of your layouts. 3 | // 4 | // polyfill (n): a JavaScript shim that replicates the standard API for older browsers. 5 | // 6 | //= require modernizr.min 7 | -------------------------------------------------------------------------------- /app/views/application/_chromeframe.html.erb: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /app/views/application/_flashes.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% flash.each do |key, value| %> 3 |
4 |

<%= value %>

5 |
6 | <% end %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/application/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /app/views/application/_head.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= "#{ controller.controller_name.titleize } - #{ controller.action_name.titleize }" %> 6 | 7 | 8 | 9 | 10 | <%= render "stylesheets" %> 11 | <%= javascript_include_tag "polyfills" %> 12 | 13 | <%= csrf_meta_tag %> 14 | 15 | -------------------------------------------------------------------------------- /app/views/application/_header.html.erb: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /app/views/application/_javascripts.html.erb: -------------------------------------------------------------------------------- 1 | <%= javascript_include_tag "application" %> 2 | 3 | <%# Append your own using content_for :javascripts %> 4 | <%= yield :javascripts %> 5 | 6 | <%# Google Analytics %> 7 | <%# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml %> 8 | <% if !google_account_id.blank? %> 9 | 17 | <% end %> 18 | -------------------------------------------------------------------------------- /app/views/application/_stylesheets.html.erb: -------------------------------------------------------------------------------- 1 | <%= stylesheet_link_tag 'application', :media => nil %> 2 | 3 | <%# Append your own using content_for :stylesheets %> 4 | <%= yield :stylesheets %> 5 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= html_tag :class => "no-js" %> 3 | <%= render "head" %> 4 | 5 | 6 | <%= render "chromeframe" %> 7 | <%= render "header" %> 8 | <%= render "flashes" %> 9 | 10 | <%= yield %> 11 | 12 | <%= render "footer" %> 13 | 14 | <%# Javascript at the bottom for fast page loading %> 15 | <%= render "javascripts" %> 16 | 17 | 18 | -------------------------------------------------------------------------------- /html5-rails.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require "html5/rails/version" 4 | 5 | Gem::Specification.new do |s| 6 | s.name = "html5-rails" 7 | s.version = Html5::Rails::VERSION 8 | s.platform = Gem::Platform::RUBY 9 | s.authors = ["Peter Gumeson"] 10 | s.email = ["gumeson@gmail.com"] 11 | s.homepage = "http://rubygems.org/gems/html5-rails" 12 | s.summary = %q{ Rails support for the compass-h5bp gem } 13 | s.description = %q{} 14 | 15 | s.rubyforge_project = "html5-rails" 16 | 17 | s.add_dependency "jquery-rails", ">= 2.0" 18 | s.add_dependency "railties", ">= 3.2" 19 | s.add_dependency "thor", "~> 0.14" 20 | 21 | s.add_development_dependency "compass-h5bp", "~> 0.1.0" 22 | 23 | s.files = `git ls-files`.split("\n") 24 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 25 | s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } 26 | s.require_paths = ["lib"] 27 | end 28 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Generates javascript and stylesheet assets for a named resource. 3 | 4 | Example: 5 | rails generate html5:assets admin 6 | 7 | This will create: 8 | app/assets/javascripts/admin.js 9 | app/assets/javascripts/polyfills.js 10 | app/assets/stylesheets/admin 11 | app/assets/stylesheets/admin/index.css.scss 12 | app/assets/stylesheets/admin/variables.css.scss 13 | app/assets/stylesheets/admin/layout.css.scss 14 | app/assets/stylesheets/admin/media_queries.css.scss 15 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/assets_generator.rb: -------------------------------------------------------------------------------- 1 | require "generators/html5/generator_helpers" 2 | 3 | module Html5 4 | module Generators 5 | class AssetsGenerator < ::Rails::Generators::NamedBase 6 | include Html5::Generators::GeneratorHelpers 7 | 8 | source_root File.expand_path('../templates', __FILE__) 9 | 10 | argument :name, :type => :string, 11 | :required => false, 12 | :default => 'application' 13 | 14 | def generate_javascripts 15 | prefix = File.join('app', 'assets', 'javascripts') 16 | manifest = File.join(prefix, File.basename(asset_path) + '.js') 17 | 18 | empty_directory File.join(prefix, File.dirname(asset_path)) 19 | 20 | if File.exist?(manifest) && File.read(manifest) =~ /require jquery_ujs$/ 21 | inject_into_file manifest, :after => "require jquery_ujs" do 22 | "\n//= require h5bp" 23 | end 24 | gsub_file manifest, /^\/\/= require_tree \.(\\n)?/, '' 25 | else 26 | template "javascripts/application.js", manifest 27 | end 28 | 29 | template "javascripts/polyfills.js", File.join(prefix, 'polyfills.js') 30 | end 31 | 32 | def generate_stylesheets 33 | prefix = File.join('app', 'assets', 'stylesheets') 34 | 35 | if file_path == 'application' 36 | remove_file File.join(prefix, 'application.css') 37 | end 38 | 39 | if stylesheets.any? 40 | empty_directory File.join(prefix, asset_path) 41 | end 42 | 43 | stylesheets.each do |stylesheet| 44 | file_name = stylesheet + ".css.scss" 45 | template "stylesheets/application/#{ file_name }", File.join(prefix, asset_path, file_name) 46 | end 47 | end 48 | 49 | # TODO 50 | # def add_precompiles 51 | # end 52 | 53 | protected 54 | 55 | def asset_path 56 | File.join(class_path + [file_name]) 57 | end 58 | 59 | def stylesheets 60 | %w(index variables layout media_queries) 61 | end 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/templates/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into including all the files listed below. 2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 3 | // be included in the compiled file accessible from http://example.com/assets/application.js 4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 5 | // the compiled file. 6 | // 7 | //= require jquery 8 | //= require jquery_ujs 9 | //= require h5bp 10 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/templates/javascripts/polyfills.js: -------------------------------------------------------------------------------- 1 | // This file was generated by html5-rails 2 | // https://github.com/sporkd/html5-rails 3 | // Upgrade with: $ rails generate html5:install 4 | // 5 | // This is a manifest for javascript polyfills that will be included 6 | // in the head section of your layouts. 7 | // 8 | // polyfill (n): a JavaScript shim that replicates the standard API for older browsers. 9 | // 10 | //= require modernizr.min 11 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/templates/stylesheets/application/index.css.scss: -------------------------------------------------------------------------------- 1 | // This file was generated by html5-rails 2 | // https://github.com/sporkd/html5-rails 3 | // Upgrade with: $ rails generate html5:install 4 | // 5 | // <%= file_path %> styles 6 | 7 | //----------------------------------------- 8 | // Variables 9 | //----------------------------------------- 10 | @import 'variables'; 11 | 12 | //----------------------------------------- 13 | // Vendor imports 14 | //----------------------------------------- 15 | // @import 'compass/css3'; 16 | @import 'h5bp'; 17 | 18 | //----------------------------------------- 19 | // Vendor includes 20 | //----------------------------------------- 21 | @include h5bp-normalize; 22 | @include h5bp-main; 23 | @include h5bp-helpers; 24 | 25 | //----------------------------------------- 26 | // Custom imports 27 | //----------------------------------------- 28 | @import 'layout'; 29 | @import 'media_queries'; 30 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/templates/stylesheets/application/layout.css.scss: -------------------------------------------------------------------------------- 1 | // This file was generated by html5-rails 2 | // https://github.com/sporkd/html5-rails 3 | // Upgrade with: $ rails generate html5:install 4 | 5 | //----------------------------------------- 6 | // Layout styles 7 | //----------------------------------------- 8 | 9 | html {} 10 | body {} 11 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/templates/stylesheets/application/media_queries.css.scss: -------------------------------------------------------------------------------- 1 | // This file was generated by html5-rails 2 | // https://github.com/sporkd/html5-rails 3 | // Upgrade with: $ rails generate html5:install 4 | // 5 | // EXAMPLE Media Query for Responsive Design. 6 | // This example overrides the primary ('mobile first') styles 7 | // Modify as content requires. 8 | 9 | @media only screen and (min-width: 35em) { 10 | // Style adjustments for viewports that meet the condition 11 | } 12 | 13 | @media print, 14 | (-o-min-device-pixel-ratio: 5/4), 15 | (-webkit-min-device-pixel-ratio: 1.25), 16 | (min-resolution: 120dpi) { 17 | // Style adjustments for high resolution devices 18 | } 19 | 20 | // Print styles. 21 | // Inlined to avoid required HTTP connection: h5bp.com/r 22 | 23 | @media print { 24 | @include h5bp-media-print; 25 | } 26 | -------------------------------------------------------------------------------- /lib/generators/html5/assets/templates/stylesheets/application/variables.css.scss: -------------------------------------------------------------------------------- 1 | // This file was generated by html5-rails 2 | // https://github.com/sporkd/html5-rails 3 | // Upgrade with: $ rails generate html5:install 4 | // 5 | // These global SCSS(SASS) variables will be 6 | // available to all your stylesheets. 7 | 8 | //---------------------------------------------- 9 | // Html5 Boilerplate overrides 10 | //---------------------------------------------- 11 | $line-height: 1.4; // 1.4 for true normalization 12 | $font-color: #222; 13 | $font-family: sans-serif; 14 | $font-size: 1em; 15 | $link-color: #00e; 16 | $link-hover-color: #06e; 17 | $link-visited-color: #551a8b; 18 | $selected-font-color: #fff; 19 | $selected-background-color: #ff5e99; 20 | $invalid-background-color: #f0dddd; 21 | -------------------------------------------------------------------------------- /lib/generators/html5/generator_helpers.rb: -------------------------------------------------------------------------------- 1 | module Html5 2 | module Generators 3 | module GeneratorHelpers 4 | 5 | def application_name 6 | if defined?(::Rails) && ::Rails.application 7 | ::Rails.application.class.name.split('::').first 8 | else 9 | "application" 10 | end 11 | end 12 | 13 | def application_title 14 | if defined?(::Rails) && ::Rails.application 15 | ::Rails.application.class.name.split('::').first.titleize 16 | else 17 | "My App" 18 | end 19 | end 20 | 21 | protected 22 | 23 | def format 24 | :html 25 | end 26 | 27 | def handler 28 | # Rails.configuration.generators.rails[:template_engine] || 29 | options[:template_engine] || :erb 30 | end 31 | 32 | def filename_with_extensions(name) 33 | [name, format, handler].compact.join(".") 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/generators/html5/install/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Installs Html5Rails and copies compass config file to your application. 3 | 4 | Example: 5 | rails generate html5:install 6 | 7 | This will create: 8 | config/compass.rb 9 | config/html5_rails.yml 10 | app/views/layouts/application.html.(erb|haml|slim) 11 | app/views/layouts/application.html.(erb|haml|slim) 12 | app/views/application 13 | app/views/application/_footer.html.(erb|haml|slim) 14 | app/views/application/_head.html.(erb|haml|slim) 15 | app/views/application/_header.html.(erb|haml|slim) 16 | app/views/application/_chromeframe.html.(erb|haml|slim) 17 | app/assets/javascripts/application.js 18 | app/assets/javascripts/polyfills.js 19 | app/assets/stylesheets/application 20 | app/assets/stylesheets/application/index.css.scss 21 | app/assets/stylesheets/application/variables.css.scss 22 | app/assets/stylesheets/application/layout.css.scss 23 | app/assets/stylesheets/application/media_queries.css.scss 24 | -------------------------------------------------------------------------------- /lib/generators/html5/install/install_generator.rb: -------------------------------------------------------------------------------- 1 | require "generators/html5/generator_helpers" 2 | 3 | module Html5 4 | module Generators 5 | class InstallGenerator < ::Rails::Generators::Base 6 | include Html5::Generators::GeneratorHelpers 7 | 8 | source_root File.expand_path('../templates', __FILE__) 9 | 10 | class_option :template_engine 11 | 12 | # def run_config 13 | # inside do 14 | # # Needs more work 15 | # run("bundle exec compass config --app rails -r compass-h5bp -q") 16 | # end 17 | # end 18 | 19 | def copy_configs 20 | template "config/compass.rb" 21 | template "config/html5_rails.yml" 22 | end 23 | 24 | def generate_layout 25 | invoke "html5:layout", ["application"], { :minimal_partials => true, :template_engine => options[:template_engine] } 26 | end 27 | 28 | def generate_assets 29 | invoke "html5:assets", ["application"] 30 | end 31 | 32 | def show_readme 33 | readme "README" if behavior == :invoke 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/generators/html5/install/templates/README: -------------------------------------------------------------------------------- 1 | =============================================================================== 2 | 3 | You've successfully installed html5-rails! 4 | 5 | If want to genrate additional layouts, just run: 6 | $ rails g html5:layout my_new_layout 7 | 8 | Or if want to customize your other shared partials: 9 | $ rails g html5:partial --all 10 | 11 | =============================================================================== 12 | -------------------------------------------------------------------------------- /lib/generators/html5/install/templates/config/compass.rb: -------------------------------------------------------------------------------- 1 | # Require any additional compass plugins here. 2 | require 'compass/h5bp' 3 | 4 | project_type = :rails 5 | -------------------------------------------------------------------------------- /lib/generators/html5/install/templates/config/html5_rails.yml: -------------------------------------------------------------------------------- 1 | # This file stores config values that html5-rails uses 2 | # to render various code blocks and features. 3 | # (i.e. Google Analytics) 4 | # 5 | # Leaving a value blank will result in that code block 6 | # or feature not rendering. 7 | # 8 | # You can also define any key/value pair in you ENV and 9 | # it will take precidence over the yml value. 10 | # e.g. ENV['google_account_id'] || yml[:google_account_id] 11 | 12 | defaults: &defaults 13 | :google_account_id: '' # Google Analytics 14 | :google_api_key: '' # Google APIs 15 | 16 | :development: 17 | <<: *defaults 18 | 19 | :test: 20 | <<: *defaults 21 | 22 | :staging: 23 | <<: *defaults 24 | 25 | :production: 26 | <<: *defaults 27 | -------------------------------------------------------------------------------- /lib/generators/html5/layout/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Installs a new html5-rails layout in /app/views/layouts 3 | 4 | Example: 5 | rails generate html5:layout my_new_layout 6 | 7 | This will create: 8 | app/views/layouts/my_new_layout.html.(erb|haml|slim) 9 | -------------------------------------------------------------------------------- /lib/generators/html5/layout/layout_generator.rb: -------------------------------------------------------------------------------- 1 | require "generators/html5/generator_helpers" 2 | 3 | module Html5 4 | module Generators 5 | class LayoutGenerator < ::Rails::Generators::NamedBase 6 | include Html5::Generators::GeneratorHelpers 7 | 8 | source_root File.expand_path('../templates', __FILE__) 9 | 10 | argument :name, :type => :string, 11 | :required => false, 12 | :default => 'application' 13 | 14 | class_option :all_partials, :type => :boolean, 15 | :default => false, 16 | :desc => 'Generate all partials for this layout' 17 | 18 | class_option :minimal_partials, :type => :boolean, 19 | :default => false, 20 | :desc => 'Generate minimal partials for this layout' 21 | 22 | class_option :template_engine 23 | 24 | def generate_layout 25 | if file_path == 'application' && options[:template_engine].to_s != 'erb' 26 | remove_file "app/views/layouts/application.html.erb" 27 | end 28 | template filename_with_extensions("application"), File.join("app/views/layouts", class_path, filename_with_extensions(file_name)) 29 | end 30 | 31 | def generate_partials 32 | if options.all_partials? 33 | invoke "html5:partial", [], { :all => true, :path => file_path, 34 | :template_engine => options[:template_engine] } 35 | end 36 | 37 | if options.minimal_partials? 38 | invoke "html5:partial", [], { :minimal => true, :path => file_path, 39 | :template_engine => options[:template_engine] } 40 | end 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/generators/html5/layout/templates/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%%= html_tag :class => "no-js" %> 3 | <%%= render "head" %> 4 | 5 | 6 | <%%= render "chromeframe" %> 7 | <%%= render "header" %> 8 | <%%= render "flashes" %> 9 | 10 | <%%= yield %> 11 | 12 | <%%= render "footer" %> 13 | 14 | <%%# Javascript at the bottom for fast page loading %> 15 | <%%= render "javascripts" %> 16 | 17 | 18 | -------------------------------------------------------------------------------- /lib/generators/html5/layout/templates/application.html.haml: -------------------------------------------------------------------------------- 1 | !!! 5 2 | - html_tag :class => 'no-js' do 3 | = render 'head' 4 | 5 | %body{ :class => "#{ controller.controller_name }" } 6 | = render 'chromeframe' 7 | = render 'header' 8 | = render 'flashes' 9 | 10 | = yield 11 | 12 | = render 'footer' 13 | 14 | -# Javascript at the bottom for fast page loading 15 | = render 'javascripts' 16 | -------------------------------------------------------------------------------- /lib/generators/html5/layout/templates/application.html.slim: -------------------------------------------------------------------------------- 1 | doctype html 2 | /[if lt IE 7] 3 | | 4 | /[if IE 7] 5 | | 6 | /[if IE 8] 7 | | 8 | /![if gt IE 8]> :string, 11 | :required => false, 12 | :default => '' 13 | 14 | class_option :all, :type => :boolean, 15 | :default => false, 16 | :desc => 'Generate all partials' 17 | 18 | class_option :minimal, :type => :boolean, 19 | :default => false, 20 | :desc => 'Generate minimal partials (_head, _header, _footer)' 21 | 22 | class_option :path, :type => :string, 23 | :default => nil, 24 | :required => false, 25 | :desc => 'resource path to generate partials in' 26 | 27 | class_option :template_engine 28 | 29 | # def validate_name 30 | # if options[:all] || options[:minimal] 31 | # if partials.include?(file_name) 32 | # path = class_path.join('/') 33 | # message = "Argument '#{ file_path }' not allowed with --all or --minimal options." 34 | # message << " Try using '#{ path }' instead." if !path.blank? 35 | # raise Error, message 36 | # end 37 | # end 38 | # end 39 | 40 | def generate_partials 41 | if partials.any? 42 | empty_directory File.join('app/views', partial_path) 43 | end 44 | partials.each do |partial| 45 | generate_partial(partial) 46 | end 47 | end 48 | 49 | protected 50 | 51 | def partials 52 | if options[:all] 53 | %w(_flashes _footer _head _header _javascripts _stylesheets _chromeframe) 54 | elsif options.minimal? 55 | %w(_footer _head _header _chromeframe) 56 | elsif file_name 57 | [file_name] 58 | else 59 | [] 60 | end 61 | end 62 | 63 | def partial_path 64 | if !options.path.blank? 65 | path = options.path 66 | else 67 | path = File.join(class_path) 68 | end 69 | path.blank? ? 'application' : path 70 | end 71 | 72 | def generate_partial(partial_name) 73 | template filename_with_extensions(partial_name), File.join('app/views', partial_path, filename_with_extensions(partial_name)) 74 | end 75 | end 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_chromeframe.html.erb: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_chromeframe.html.haml: -------------------------------------------------------------------------------- 1 | /[if lt IE 7 ] 2 | %p.chromeframe 3 | You are using an outdated browser. 4 | Please upgrade your browser or activate Google Chrome Frame to improve your experience. 5 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_chromeframe.html.slim: -------------------------------------------------------------------------------- 1 | /[if lt IE 7 ] 2 | p.chromeframe 3 | | You are using an outdated browser. 4 | Please upgrade your browser or 5 | or activate Google Chrome Frame 6 | to improve your experience. 7 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_flashes.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%% flash.each do |key, value| %> 3 |
4 |

<%%= value %>

5 |
6 | <%% end %> 7 |
8 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_flashes.html.haml: -------------------------------------------------------------------------------- 1 | #flash 2 | - flash.each do |key, value| 3 | %div{ :title => key.to_s.humanize, :class => key } 4 | %p= value 5 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_flashes.html.slim: -------------------------------------------------------------------------------- 1 | #flash 2 | - flash.each do |key, value| 3 | div title=key.to_s.humanize class=key 4 | p= value 5 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_footer.html.haml: -------------------------------------------------------------------------------- 1 | %footer#footer 2 | %small.copyright 3 | <%= application_title %>, Copyright © #{ Date.today.year } 4 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_footer.html.slim: -------------------------------------------------------------------------------- 1 | footer#footer 2 | small.copyright 3 | | <%= application_title %>, Copyright © #{ Date.today.year } 4 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_head.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%%= "#{ controller.controller_name.titleize } - #{ controller.action_name.titleize }" %> 6 | 7 | 8 | 9 | 10 | <%%= render "stylesheets" %> 11 | <%%= javascript_include_tag "polyfills" %> 12 | 13 | <%%= csrf_meta_tag %> 14 | 15 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_head.html.haml: -------------------------------------------------------------------------------- 1 | %head 2 | %meta{ :charset => 'utf-8' }/ 3 | %meta{ 'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1' }/ 4 | 5 | %title 6 | == #{ controller.controller_name.titleize } - #{ controller.action_name.titleize } 7 | 8 | %meta{ :name => 'description', :content => '' }/ 9 | %meta{ :name => 'viewport', :content => 'width=device-width' }/ 10 | 11 | = render 'stylesheets' 12 | = javascript_include_tag 'polyfills' 13 | 14 | = csrf_meta_tag 15 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_head.html.slim: -------------------------------------------------------------------------------- 1 | head 2 | meta charset='utf-8' 3 | meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible' 4 | title 5 | | #{ controller.controller_name.titleize } - #{ controller.action_name.titleize } 6 | meta content='' name='description' 7 | meta content='width=device-width' name='viewport' 8 | 9 | == render 'stylesheets' 10 | 11 | / All JavaScript at the bottom, except polyfills 12 | = javascript_include_tag 'polyfills' 13 | 14 | = csrf_meta_tag 15 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_header.html.erb: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_header.html.haml: -------------------------------------------------------------------------------- 1 | %header#header 2 | %h1 <%= application_title %> 3 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_header.html.slim: -------------------------------------------------------------------------------- 1 | header#header 2 | h1 <%= application_title %> 3 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_javascripts.html.erb: -------------------------------------------------------------------------------- 1 | <%%= javascript_include_tag "application" %> 2 | 3 | <%%# Append your own using content_for :javascripts %> 4 | <%%= yield :javascripts %> 5 | 6 | <%%# Google Analytics %> 7 | <%%# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml %> 8 | <%% if !google_account_id.blank? %> 9 | 17 | <%% end %> 18 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_javascripts.html.haml: -------------------------------------------------------------------------------- 1 | = javascript_include_tag 'application' 2 | 3 | -# Append your own using content_for :javascripts 4 | = yield :javascripts 5 | 6 | -# Google Analytics 7 | -# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml 8 | - if !google_account_id.blank? 9 | :javascript 10 | var _gaq=[['_setAccount','#{ google_account_id }'],['_trackPageview']]; 11 | (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; 12 | g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; 13 | s.parentNode.insertBefore(g,s)}(document,'script')); 14 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_javascripts.html.slim: -------------------------------------------------------------------------------- 1 | = javascript_include_tag 'application' 2 | 3 | / Append your own using content_for :javascripts 4 | == yield :javascripts 5 | 6 | / Google Analytics 7 | / Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml 8 | - if !google_account_id.blank? 9 | javascript: 10 | var _gaq=[['_setAccount','#{ google_account_id }'],['_trackPageview']]; 11 | (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; 12 | g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; 13 | s.parentNode.insertBefore(g,s)}(document,'script')); 14 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_stylesheets.html.erb: -------------------------------------------------------------------------------- 1 | <%%= stylesheet_link_tag 'application', :media => nil %> 2 | 3 | <%%# Append your own using content_for :stylesheets %> 4 | <%%= yield :stylesheets %> 5 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_stylesheets.html.haml: -------------------------------------------------------------------------------- 1 | = stylesheet_link_tag 'application', :media => nil 2 | 3 | -# Append your own using content_for :stylesheets 4 | = yield :stylesheets 5 | -------------------------------------------------------------------------------- /lib/generators/html5/partial/templates/_stylesheets.html.slim: -------------------------------------------------------------------------------- 1 | = stylesheet_link_tag 'application', :media => nil 2 | 3 | / Append your own using content_for :stylesheets 4 | == yield :stylesheets 5 | -------------------------------------------------------------------------------- /lib/html5-rails.rb: -------------------------------------------------------------------------------- 1 | require "html5/rails" 2 | -------------------------------------------------------------------------------- /lib/html5/rails.rb: -------------------------------------------------------------------------------- 1 | require "html5/rails/version" 2 | require "html5/rails/engine" 3 | 4 | module Html5 5 | module Rails 6 | autoload :Helpers, 'html5/rails/helpers' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/html5/rails/engine.rb: -------------------------------------------------------------------------------- 1 | module Html5 2 | module Rails 3 | class Engine < ::Rails::Engine 4 | 5 | # Extend application_helper 6 | initializer 'html5_rails_engine.helper' do |app| 7 | ActionController::Base.helper(Html5::Rails::Helpers) 8 | end 9 | 10 | # Extend application_controller 11 | # initializer 'html5_rails_engine.controller' do |app| 12 | # ActiveSupport.on_load(:action_controller) do 13 | # include Html5::Rails::BoilerplateController 14 | # end 15 | # end 16 | 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/html5/rails/helpers.rb: -------------------------------------------------------------------------------- 1 | module Html5 2 | module Rails 3 | module Helpers 4 | 5 | # Helper to display conditional html tags for IE 6 | # http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither 7 | def html_tag(attrs={}) 8 | attrs.symbolize_keys! 9 | html = "" 10 | html << "\n" 11 | html << "\n" 12 | html << "\n" 13 | html << " " 14 | 15 | if block_given? && defined? Haml 16 | haml_concat(html.html_safe) 17 | haml_tag :html, attrs do 18 | haml_concat("".html_safe) 19 | yield 20 | end 21 | else 22 | html = html.html_safe 23 | html << tag(:html, attrs, true) 24 | html << " \n".html_safe 25 | html 26 | end 27 | end 28 | 29 | def ie_html(attrs={}, &block) 30 | warn "[DEPRECATION] 'ie_html' is deprecated. Use html_tag instead." 31 | html_tag(attrs, &block) 32 | end 33 | 34 | def google_account_id 35 | ENV['GOOGLE_ACCOUNT_ID'] || html5_rails_config(:google_account_id) 36 | end 37 | 38 | def google_api_key 39 | ENV['GOOGLE_API_KEY'] || html5_rails_config(:google_api_key) 40 | end 41 | 42 | private 43 | 44 | def add_class(name, attrs) 45 | classes = attrs[:class] || "" 46 | classes.strip! 47 | classes = " " + classes if !classes.blank? 48 | classes = name + classes 49 | attrs.merge(:class => classes) 50 | end 51 | 52 | def html5_rails_config(key) 53 | configs = YAML.load_file(File.join(::Rails.root, 'config', 'html5_rails.yml'))[::Rails.env.to_sym] rescue {} 54 | configs[key] 55 | end 56 | 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/html5/rails/version.rb: -------------------------------------------------------------------------------- 1 | module Html5 2 | module Rails 3 | VERSION = "0.1.0" 4 | COMPASS_H5BP_VERSION = "0.1.1" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /test/dummy/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile ~/.gitignore_global 6 | 7 | # Ignore bundler config 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | 13 | # Ignore all logfiles and tempfiles. 14 | /log/*.log 15 | /tmp 16 | -------------------------------------------------------------------------------- /test/dummy/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Dummy::Application.load_tasks 8 | -------------------------------------------------------------------------------- /test/dummy/app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/app/assets/images/rails.png -------------------------------------------------------------------------------- /test/dummy/app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require_tree . 16 | -------------------------------------------------------------------------------- /test/dummy/app/assets/javascripts/pages.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | 5 | pages = -> 6 | alert("I'm just a page"); -------------------------------------------------------------------------------- /test/dummy/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def home 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /test/dummy/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/dummy/app/helpers/pages_helper.rb: -------------------------------------------------------------------------------- 1 | module PagesHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/dummy/app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/app/mailers/.gitkeep -------------------------------------------------------------------------------- /test/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/app/models/.gitkeep -------------------------------------------------------------------------------- /test/dummy/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dummy 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/home.html.erb: -------------------------------------------------------------------------------- 1 |

Ohai

-------------------------------------------------------------------------------- /test/dummy/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Dummy::Application 5 | -------------------------------------------------------------------------------- /test/dummy/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | require "active_record/railtie" 5 | require "action_controller/railtie" 6 | require "action_mailer/railtie" 7 | require "active_resource/railtie" 8 | require "sprockets/railtie" 9 | # require "rails/test_unit/railtie" 10 | 11 | if defined?(Bundler) 12 | # If you precompile assets before deploying to production, use this line 13 | Bundler.require(*Rails.groups(:assets => %w(development test))) 14 | # If you want your assets lazily compiled in production, use this line 15 | # Bundler.require(:default, :assets, Rails.env) 16 | end 17 | 18 | require "html5-rails" 19 | 20 | module Dummy 21 | class Application < Rails::Application 22 | # Settings in config/environments/* take precedence over those specified here. 23 | # Application configuration should go into files in config/initializers 24 | # -- all .rb files in that directory are automatically loaded. 25 | 26 | # Custom directories with classes and modules you want to be autoloadable. 27 | # config.autoload_paths += %W(#{config.root}/extras) 28 | 29 | # Only load the plugins named here, in the order given (default is alphabetical). 30 | # :all can be used as a placeholder for all plugins not explicitly named. 31 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 32 | 33 | # Activate observers that should always be running. 34 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 35 | 36 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 37 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 38 | # config.time_zone = 'Central Time (US & Canada)' 39 | 40 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 41 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 42 | # config.i18n.default_locale = :de 43 | 44 | # Configure the default encoding used in templates for Ruby 1.9. 45 | config.encoding = "utf-8" 46 | 47 | # Configure sensitive parameters which will be filtered from the log file. 48 | config.filter_parameters += [:password] 49 | 50 | # Enable escaping HTML in JSON. 51 | config.active_support.escape_html_entities_in_json = true 52 | 53 | # Use SQL instead of Active Record's schema dumper when creating the database. 54 | # This is necessary if your schema can't be completely dumped by the schema dumper, 55 | # like if you have constraints or database-specific column types 56 | # config.active_record.schema_format = :sql 57 | 58 | # Enforce whitelist mode for mass assignment. 59 | # This will create an empty whitelist of attributes available for mass-assignment for all models 60 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 61 | # parameters by using an attr_accessible or attr_protected declaration. 62 | config.active_record.whitelist_attributes = true 63 | 64 | # Enable the asset pipeline 65 | config.assets.enabled = true 66 | 67 | # Version of your assets, change this if you want to expire all your assets 68 | config.assets.version = '1.0' 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /test/dummy/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | 8 | $:.unshift File.expand_path('../../../../lib', __FILE__) -------------------------------------------------------------------------------- /test/dummy/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /test/dummy/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Dummy::Application.initialize! 6 | -------------------------------------------------------------------------------- /test/dummy/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger 20 | config.active_support.deprecation = :log 21 | 22 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | 25 | # Raise exception on mass assignment protection for Active Record models 26 | config.active_record.mass_assignment_sanitizer = :strict 27 | 28 | # Log the query plan for queries taking more than this (works 29 | # with SQLite, MySQL, and PostgreSQL) 30 | config.active_record.auto_explain_threshold_in_seconds = 0.5 31 | 32 | # Do not compress assets 33 | config.assets.compress = false 34 | 35 | # Expands the lines which load the assets 36 | config.assets.debug = true 37 | end 38 | -------------------------------------------------------------------------------- /test/dummy/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress JavaScripts and CSS 15 | config.assets.compress = true 16 | 17 | # Don't fallback to assets pipeline if a precompiled asset is missed 18 | config.assets.compile = false 19 | 20 | # Generate digests for assets URLs 21 | config.assets.digest = true 22 | 23 | # Defaults to nil and saved in location specified by config.assets.prefix 24 | # config.assets.manifest = YOUR_PATH 25 | 26 | # Specifies the header that your server uses for sending files 27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 29 | 30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 31 | # config.force_ssl = true 32 | 33 | # See everything in the log (default is :info) 34 | # config.log_level = :debug 35 | 36 | # Prepend all log lines with the following tags 37 | # config.log_tags = [ :subdomain, :uuid ] 38 | 39 | # Use a different logger for distributed setups 40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 41 | 42 | # Use a different cache store in production 43 | # config.cache_store = :mem_cache_store 44 | 45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 46 | # config.action_controller.asset_host = "http://assets.example.com" 47 | 48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 49 | # config.assets.precompile += %w( search.js ) 50 | 51 | # Disable delivery errors, bad email addresses will be ignored 52 | # config.action_mailer.raise_delivery_errors = false 53 | 54 | # Enable threaded mode 55 | # config.threadsafe! 56 | 57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 58 | # the I18n.default_locale when a translation can not be found) 59 | config.i18n.fallbacks = true 60 | 61 | # Send deprecation notices to registered listeners 62 | config.active_support.deprecation = :notify 63 | 64 | # Log the query plan for queries taking more than this (works 65 | # with SQLite, MySQL, and PostgreSQL) 66 | # config.active_record.auto_explain_threshold_in_seconds = 0.5 67 | end 68 | -------------------------------------------------------------------------------- /test/dummy/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | # Raise exception on mass assignment protection for Active Record models 33 | config.active_record.mass_assignment_sanitizer = :strict 34 | 35 | # Print deprecation notices to the stderr 36 | config.active_support.deprecation = :stderr 37 | end 38 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | Dummy::Application.config.secret_token = '0eecea4e8fdb11b1bad9dfde1137c1bfc19d06045539b215ab30af3661199625dac8865e9bfdca9f4237b934c14a76cb0c6154630f9f957271e3383692a882c0' 8 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Dummy::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /test/dummy/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /test/dummy/config/routes.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.routes.draw do 2 | # The priority is based upon order of creation: 3 | # first created -> highest priority. 4 | 5 | # Sample of regular route: 6 | # match 'products/:id' => 'catalog#view' 7 | # Keep in mind you can assign values other than :controller and :action 8 | 9 | # Sample of named route: 10 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 11 | # This route can be invoked with purchase_url(:id => product.id) 12 | 13 | # Sample resource route (maps HTTP verbs to controller actions automatically): 14 | # resources :products 15 | 16 | # Sample resource route with options: 17 | # resources :products do 18 | # member do 19 | # get 'short' 20 | # post 'toggle' 21 | # end 22 | # 23 | # collection do 24 | # get 'sold' 25 | # end 26 | # end 27 | 28 | # Sample resource route with sub-resources: 29 | # resources :products do 30 | # resources :comments, :sales 31 | # resource :seller 32 | # end 33 | 34 | # Sample resource route with more complex sub-resources 35 | # resources :products do 36 | # resources :comments 37 | # resources :sales do 38 | # get 'recent', :on => :collection 39 | # end 40 | # end 41 | 42 | # Sample resource route within a namespace: 43 | # namespace :admin do 44 | # # Directs /admin/products/* to Admin::ProductsController 45 | # # (app/controllers/admin/products_controller.rb) 46 | # resources :products 47 | # end 48 | 49 | # You can have the root of your site routed with "root" 50 | # just remember to delete public/index.html. 51 | root :to => 'pages#home' 52 | 53 | # See how all your routes lay out with "rake routes" 54 | 55 | # This is a legacy wild controller route that's not recommended for RESTful applications. 56 | # Note: This route will make all actions in every controller accessible via GET requests. 57 | # match ':controller(/:action(/:id))(.:format)' 58 | end 59 | -------------------------------------------------------------------------------- /test/dummy/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /test/dummy/doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /test/dummy/lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/lib/assets/.gitkeep -------------------------------------------------------------------------------- /test/dummy/lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /test/dummy/log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/log/.gitkeep -------------------------------------------------------------------------------- /test/dummy/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/dummy/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/dummy/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /test/dummy/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/public/favicon.ico -------------------------------------------------------------------------------- /test/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/dummy/script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /test/dummy/vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/vendor/assets/javascripts/.gitkeep -------------------------------------------------------------------------------- /test/dummy/vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/vendor/assets/stylesheets/.gitkeep -------------------------------------------------------------------------------- /test/dummy/vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sporkd/html5-rails/5faad969f5a0b5de06c148c832fc89993a76f9de/test/dummy/vendor/plugins/.gitkeep -------------------------------------------------------------------------------- /test/generators/assets_generator_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | require "generators/html5/assets/assets_generator" 3 | 4 | class AssetsGeneratorTest < Rails::Generators::TestCase 5 | include GeneratorTestHelper 6 | tests Html5::Generators::AssetsGenerator 7 | 8 | test "html5:assets should make changes to application.js" do 9 | run_generator 10 | 11 | assert_file "app/assets/javascripts/application.js", /\/\/= require h5bp/ do |contents| 12 | assert_no_match /require_tree \./, contents 13 | end 14 | end 15 | 16 | test "html5:assets should generate polyfills.js" do 17 | run_generator 18 | assert_file "app/assets/javascripts/polyfills.js" 19 | end 20 | 21 | test "html5:assets" do 22 | run_generator 23 | 24 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'variables';/ 25 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'layout';/ 26 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'media_queries';/ 27 | %w(variables layout media_queries).each do |file| 28 | assert_file "app/assets/stylesheets/application/#{ file }.css.scss" 29 | end 30 | end 31 | 32 | test "html5:assets application" do 33 | run_generator %w(application) 34 | 35 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'variables';/ 36 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'layout';/ 37 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'media_queries';/ 38 | %w(variables layout media_queries).each do |file| 39 | assert_file "app/assets/stylesheets/application/#{ file }.css.scss" 40 | end 41 | end 42 | 43 | test "html5:assets pancakes" do 44 | run_generator %w(pancakes) 45 | 46 | assert_file "app/assets/stylesheets/pancakes/index.css.scss", /@import 'variables';/ 47 | assert_file "app/assets/stylesheets/pancakes/index.css.scss", /@import 'layout';/ 48 | assert_file "app/assets/stylesheets/pancakes/index.css.scss", /@import 'media_queries';/ 49 | %w(variables layout media_queries).each do |file| 50 | assert_file "app/assets/stylesheets/pancakes/#{ file }.css.scss" 51 | end 52 | end 53 | 54 | test "html5:assets admin/pancakes" do 55 | run_generator %w(admin/pancakes) 56 | 57 | assert_file "app/assets/stylesheets/admin/pancakes/index.css.scss", /@import 'variables';/ 58 | assert_file "app/assets/stylesheets/admin/pancakes/index.css.scss", /@import 'layout';/ 59 | assert_file "app/assets/stylesheets/admin/pancakes/index.css.scss", /@import 'media_queries';/ 60 | %w(variables layout media_queries).each do |file| 61 | assert_file "app/assets/stylesheets/admin/pancakes/#{ file }.css.scss" 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /test/generators/install_generator_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | require "generators/html5/install/install_generator" 3 | 4 | class InstallGeneratorTest < Rails::Generators::TestCase 5 | include GeneratorTestHelper 6 | tests Html5::Generators::InstallGenerator 7 | 8 | test "Compass config file should be generated" do 9 | run_generator 10 | assert_file "config/compass.rb" 11 | end 12 | 13 | test "html5_rails.yml config file should be generated" do 14 | run_generator 15 | assert_file "config/html5_rails.yml" 16 | end 17 | 18 | test "application layout should be generated" do 19 | run_generator 20 | assert_file "app/views/layouts/application.html.erb" 21 | end 22 | 23 | test "with flag --template-engine=haml" do 24 | run_generator ["--template-engine=haml"] 25 | assert_no_file "app/views/layouts/application.html.erb" 26 | assert_file "app/views/layouts/application.html.haml" 27 | end 28 | 29 | test "with flag --template-engine=slim" do 30 | run_generator ["--template-engine=slim"] 31 | assert_no_file "app/views/layouts/application.html.erb" 32 | assert_file "app/views/layouts/application.html.slim" 33 | end 34 | 35 | test "minimal application partials should be generated" do 36 | run_generator 37 | %w(_footer _head _header _chromeframe).each do |file| 38 | assert_file "app/views/application/#{ file }.html.erb" 39 | end 40 | %w(_flashes _javascripts _stylesheets).each do |file| 41 | assert_no_file "app/views/application/#{ file }.html.erb" 42 | end 43 | end 44 | 45 | test "assets should be generated" do 46 | run_generator 47 | 48 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'variables';/ 49 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'layout';/ 50 | assert_file "app/assets/stylesheets/application/index.css.scss", /@import 'media_queries';/ 51 | %w(variables layout media_queries).each do |file| 52 | assert_file "app/assets/stylesheets/application/#{ file }.css.scss" 53 | end 54 | end 55 | 56 | test "application.css gets removed" do 57 | run_generator 58 | assert_no_file "app/assets/stylesheets/application.css" 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /test/generators/layout_generator_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | require "generators/html5/layout/layout_generator" 3 | 4 | class LayoutGeneratorTest < Rails::Generators::TestCase 5 | include GeneratorTestHelper 6 | tests Html5::Generators::LayoutGenerator 7 | 8 | %w(erb haml slim).each do |engine| 9 | defaults = ["--template-engine=#{ engine }"] 10 | 11 | test "html5:layout --template-engine=#{ engine }" do 12 | run_generator defaults 13 | 14 | assert_no_file "app/views/layouts/application.html.erb" if engine != 'erb' 15 | assert_file "app/views/layouts/application.html.#{ engine }" 16 | end 17 | 18 | test "html5:layout application --template-engine=#{ engine }" do 19 | run_generator %w(application) + defaults 20 | assert_file "app/views/layouts/application.html.#{ engine }" 21 | end 22 | 23 | test "html5:layout pancakes --template-engine=#{ engine }" do 24 | run_generator %w(pancakes) + defaults 25 | assert_file "app/views/layouts/pancakes.html.#{ engine }" 26 | end 27 | 28 | test "html5:layout admin/pancakes --template-engine=#{ engine }" do 29 | run_generator %w(admin/pancakes) + defaults 30 | assert_file "app/views/layouts/admin/pancakes.html.#{ engine }" 31 | end 32 | 33 | test "html5:layout Admin::Pancakes --template-engine=#{ engine }" do 34 | run_generator %w(Admin::Pancakes) + defaults 35 | assert_file "app/views/layouts/admin/pancakes.html.#{ engine }" 36 | end 37 | 38 | test "html5:layout --template-engine=#{ engine } (without --all-partials)" do 39 | run_generator defaults 40 | assert_no_directory "app/views/application" 41 | end 42 | 43 | test "html5:layout --all-partials --template-engine=#{ engine }" do 44 | run_generator ["--all-partials"] + defaults 45 | 46 | assert_file "app/views/layouts/application.html.#{ engine }" 47 | %w(_flashes _footer _head _header _javascripts _stylesheets _chromeframe).each do |file| 48 | assert_file "app/views/application/#{ file }.html.#{ engine }" 49 | end 50 | end 51 | 52 | test "html5:layout pancakes --all-partials --template-engine=#{ engine }" do 53 | run_generator ["pancakes", "--all-partials"] + defaults 54 | 55 | assert_file "app/views/layouts/pancakes.html.#{ engine }" 56 | %w(_flashes _footer _head _header _javascripts _stylesheets _chromeframe).each do |file| 57 | assert_file "app/views/pancakes/#{ file }.html.#{ engine }" 58 | end 59 | end 60 | 61 | test "html5:layout admin/pancakes --all-partials --template-engine=#{ engine }" do 62 | run_generator ["admin/pancakes", "--all-partials"] + defaults 63 | 64 | assert_file "app/views/layouts/admin/pancakes.html.#{ engine }" 65 | %w(_flashes _footer _head _header _javascripts _stylesheets _chromeframe).each do |file| 66 | assert_file "app/views/admin/pancakes/#{ file }.html.#{ engine }" 67 | end 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /test/generators/partial_generator_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | require "generators/html5/partial/partial_generator" 3 | 4 | class PartialGeneratorTest < Rails::Generators::TestCase 5 | include GeneratorTestHelper 6 | tests Html5::Generators::PartialGenerator 7 | 8 | %w(erb haml slim).each do |engine| 9 | defaults = ["--template-engine=#{ engine }"] 10 | 11 | test "html5:partial --template-engine=#{ engine }" do 12 | run_generator defaults 13 | assert_no_directory "app/views/application" 14 | end 15 | 16 | test "html5:partial _header --template-engine=#{ engine }" do 17 | run_generator %w(_header) + defaults 18 | assert_file "app/views/application/_header.html.#{ engine }" 19 | end 20 | 21 | test "html:partial waffles/_footer --template-engine=#{ engine }" do 22 | run_generator %w(waffles/_footer) + defaults 23 | assert_file "app/views/waffles/_footer.html.#{ engine }" 24 | end 25 | 26 | test "html5:partial --minimal --template-engine=#{ engine }" do 27 | run_generator %w(--minimal) + defaults 28 | 29 | %w(_footer _head _header _chromeframe).each do |file| 30 | assert_file "app/views/application/#{ file }.html.#{ engine }" 31 | end 32 | %w(_flashes _javascripts _stylesheets).each do |file| 33 | assert_no_file "app/views/application/#{ file }.html.#{ engine }" 34 | end 35 | end 36 | 37 | test "html5:partial --all --template-engine=#{ engine }" do 38 | run_generator %w(--all) + defaults 39 | 40 | %w(_flashes _footer _head _header _javascripts _stylesheets _chromeframe).each do |file| 41 | assert_file "app/views/application/#{ file }.html.#{ engine }" 42 | end 43 | end 44 | 45 | test "html5:partial --minimal --path=waffles --template-engine=#{ engine }" do 46 | run_generator ["--minimal", "--path=waffles"] + defaults 47 | 48 | %w(_footer _head _header _chromeframe).each do |file| 49 | assert_file "app/views/waffles/#{ file }.html.#{ engine }" 50 | end 51 | %w(_flashes _javascripts _stylesheets).each do |file| 52 | assert_no_file "app/views/waffles/#{ file }.html.#{ engine }" 53 | end 54 | end 55 | 56 | test "html5:partial --all --path=admin/waffles --template-engine=#{ engine }" do 57 | run_generator ["--all", "--path=admin/waffles"] + defaults 58 | 59 | %w(_flashes _footer _head _header _javascripts _stylesheets _chromeframe).each do |file| 60 | assert_file "app/views/admin/waffles/#{ file }.html.#{ engine }" 61 | end 62 | end 63 | 64 | test "header should contain app title in #{ engine } template" do 65 | run_generator %w(_header) + defaults 66 | assert_file "app/views/application/_header.html.#{ engine }", /h1(>| )Dummy/ 67 | end 68 | 69 | test "footer should contain app title in #{ engine } template" do 70 | run_generator %w(_footer) + defaults 71 | assert_file "app/views/application/_footer.html.#{ engine }", /Dummy, Copyright/ 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /test/html5_rails_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Html5RailsTest < ActiveSupport::TestCase 4 | test "truth" do 5 | assert_kind_of Module, Html5::Rails 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/integration/navigation_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class NavigationTest < ActiveSupport::IntegrationCase 4 | test "truth" do 5 | assert_kind_of Dummy::Application, Rails.application 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/support/generator_test_helper.rb: -------------------------------------------------------------------------------- 1 | module GeneratorTestHelper 2 | def self.included(base) 3 | base.class_eval do 4 | destination File.expand_path("../../tmp", __FILE__) 5 | setup :prepare_destination 6 | end 7 | end 8 | 9 | protected 10 | 11 | def prepare_destination 12 | rm_rf(destination_root) 13 | mkdir_p(destination_root + "/app") 14 | dummy_app = File.expand_path("../../dummy", __FILE__) 15 | FileUtils.cp_r(dummy_app + "/app/views", destination_root + "/app") 16 | FileUtils.cp_r(dummy_app + "/app/assets", destination_root + "/app") 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/support/integration_case.rb: -------------------------------------------------------------------------------- 1 | # Define a bare test case to use with Capybara 2 | class ActiveSupport::IntegrationCase < ActiveSupport::TestCase 3 | include Capybara::DSL 4 | include Rails.application.routes.url_helpers 5 | end 6 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # Configure Rails Envinronment 2 | ENV["RAILS_ENV"] = "test" 3 | 4 | require File.expand_path("../dummy/config/environment.rb", __FILE__) 5 | require "rails/test_help" 6 | 7 | ActionMailer::Base.delivery_method = :test 8 | ActionMailer::Base.perform_deliveries = true 9 | ActionMailer::Base.default_url_options[:host] = "test.com" 10 | 11 | Rails.backtrace_cleaner.remove_silencers! 12 | 13 | # Configure capybara for integration testing 14 | # require "capybara/rails" 15 | # Capybara.default_driver = :rack_test 16 | # Capybara.default_selector = :css 17 | 18 | # Load support files 19 | Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } 20 | 21 | # For generators 22 | require 'rails/generators/test_case' 23 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/h5bp.js: -------------------------------------------------------------------------------- 1 | // Avoid `console` errors in browsers that lack a console. 2 | (function() { 3 | var method; 4 | var noop = function () {}; 5 | var methods = [ 6 | 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 7 | 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 8 | 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 9 | 'timeStamp', 'trace', 'warn' 10 | ]; 11 | var length = methods.length; 12 | var console = (window.console = window.console || {}); 13 | 14 | while (length--) { 15 | method = methods[length]; 16 | 17 | // Only stub undefined methods. 18 | if (!console[method]) { 19 | console[method] = noop; 20 | } 21 | } 22 | }()); 23 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/modernizr.min.js: -------------------------------------------------------------------------------- 1 | /* Modernizr 2.6.2 (Custom Build) | MIT & BSD 2 | * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load 3 | */ 4 | ;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f