html5-slim-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +38 -0
  3. data/LICENSE.rb +3 -0
  4. data/README.md +4 -0
  5. data/Rakefile +9 -0
  6. data/html5-rails.gemspec +25 -0
  7. data/html5-slim-rails.gemspec +25 -0
  8. data/lib/generators/html5/install/USAGE +5 -0
  9. data/lib/generators/html5/install/install_generator.rb +19 -0
  10. data/lib/generators/html5/install/templates/README +3 -0
  11. data/lib/generators/html5/install/templates/assets/javascripts/application.js +1 -0
  12. data/lib/generators/html5/install/templates/assets/javascripts/html5/boilerplate/index.js +1 -0
  13. data/lib/generators/html5/install/templates/assets/javascripts/html5/boilerplate/plugins.js +16 -0
  14. data/lib/generators/html5/install/templates/assets/javascripts/html5/boilerplate/polyfills.js +2 -0
  15. data/lib/generators/html5/install/templates/assets/javascripts/polyfills.js +1 -0
  16. data/lib/generators/html5/install/templates/assets/stylesheets/application.css.scss +46 -0
  17. data/lib/generators/html5/install/templates/views/application/_flashes.html.slim +4 -0
  18. data/lib/generators/html5/install/templates/views/application/_footer.html.slim +2 -0
  19. data/lib/generators/html5/install/templates/views/application/_head.html.slim +24 -0
  20. data/lib/generators/html5/install/templates/views/application/_header.html.slim +1 -0
  21. data/lib/generators/html5/install/templates/views/application/_javascripts.html.slim +27 -0
  22. data/lib/generators/html5/install/templates/views/application/_stylesheets.html.slim +5 -0
  23. data/lib/generators/html5/install/templates/views/layouts/application.html.slim +29 -0
  24. data/lib/html5/slim_rails/boilerplate_helper.rb +68 -0
  25. data/lib/html5/slim_rails/engine.rb +19 -0
  26. data/lib/html5/slim_rails/version.rb +8 -0
  27. data/lib/html5/slim_rails.rb +8 -0
  28. data/lib/html5-slim-rails.rb +1 -0
  29. data/test/dummy/.gitignore +5 -0
  30. data/test/dummy/Rakefile +7 -0
  31. data/test/dummy/app/assets/images/rails.png +0 -0
  32. data/test/dummy/app/assets/javascripts/application.js +2 -0
  33. data/test/dummy/app/assets/javascripts/pages.js.coffee +6 -0
  34. data/test/dummy/app/assets/stylesheets/application.css.scss +19 -0
  35. data/test/dummy/app/assets/stylesheets/partials/_media.css.scss +22 -0
  36. data/test/dummy/app/controllers/application_controller.rb +3 -0
  37. data/test/dummy/app/controllers/pages_controller.rb +4 -0
  38. data/test/dummy/app/helpers/application_helper.rb +2 -0
  39. data/test/dummy/app/helpers/pages_helper.rb +2 -0
  40. data/test/dummy/app/mailers/.gitkeep +0 -0
  41. data/test/dummy/app/models/.gitkeep +0 -0
  42. data/test/dummy/app/views/pages/home.html.haml +2 -0
  43. data/test/dummy/config/application.rb +45 -0
  44. data/test/dummy/config/boot.rb +8 -0
  45. data/test/dummy/config/database.yml +25 -0
  46. data/test/dummy/config/environment.rb +5 -0
  47. data/test/dummy/config/environments/development.rb +27 -0
  48. data/test/dummy/config/environments/production.rb +51 -0
  49. data/test/dummy/config/environments/test.rb +39 -0
  50. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  51. data/test/dummy/config/initializers/inflections.rb +10 -0
  52. data/test/dummy/config/initializers/mime_types.rb +5 -0
  53. data/test/dummy/config/initializers/sass.rb +3 -0
  54. data/test/dummy/config/initializers/secret_token.rb +7 -0
  55. data/test/dummy/config/initializers/session_store.rb +8 -0
  56. data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
  57. data/test/dummy/config/locales/en.yml +5 -0
  58. data/test/dummy/config/routes.rb +58 -0
  59. data/test/dummy/config.ru +4 -0
  60. data/test/dummy/lib/tasks/.gitkeep +0 -0
  61. data/test/dummy/log/.gitkeep +0 -0
  62. data/test/dummy/public/404.html +26 -0
  63. data/test/dummy/public/422.html +26 -0
  64. data/test/dummy/public/500.html +26 -0
  65. data/test/dummy/public/favicon.ico +0 -0
  66. data/test/dummy/public/robots.txt +5 -0
  67. data/test/dummy/script/rails +6 -0
  68. data/test/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  69. data/test/dummy/vendor/plugins/.gitkeep +0 -0
  70. data/test/generators/install_generator_test.rb +12 -0
  71. data/test/html5_rails_test.rb +7 -0
  72. data/test/integration/navigation_test.rb +7 -0
  73. data/test/support/integration_case.rb +5 -0
  74. data/test/test_helper.rb +26 -0
  75. data/vendor/assets/javascripts/modernizr.min.js +4 -0
  76. data/vendor/assets/javascripts/respond.min.js +2 -0
  77. data/vendor/assets/stylesheets/h5bp_style.css +204 -0
  78. metadata +201 -0
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ test/tmp
data/Gemfile ADDED
@@ -0,0 +1,38 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rails', '3.1.3'
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.1.0.rc'
17
+ gem 'coffee-rails', '~> 3.1.0.rc'
18
+ gem 'uglifier'
19
+ end
20
+
21
+ gem 'jquery-rails'
22
+
23
+ # Use unicorn as the web server
24
+ # gem 'unicorn'
25
+
26
+ # Deploy with Capistrano
27
+ # gem 'capistrano'
28
+
29
+ # To use debugger
30
+ # gem 'ruby-debug19', :require => 'ruby-debug'
31
+
32
+ gem 'capybara'
33
+ gem 'slim'
34
+
35
+ group :test do
36
+ # Pretty printed test output
37
+ gem 'turn', :require => false
38
+ end
data/LICENSE.rb ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2010-2011 Peter Gumeson
2
+
3
+ http://creativecommons.org/licenses/by/3.0/
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ Html5 Rails
2
+ =========================
3
+
4
+ Rewrite of compass-html5-boilerplate that does just the haml bits, but in slim
data/Rakefile ADDED
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "html5/slim_rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "html5-slim-rails"
7
+ s.version = Html5::SlimRails::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["David Haslem"]
10
+ s.email = ["therabidbanana@gmail.com"]
11
+ s.homepage = "http://github.com/therabidbanana/html5-slim-rails"
12
+ s.summary = %q{Rails support for the new compass-html5 gem.}
13
+ s.description = %q{}
14
+
15
+ s.rubyforge_project = "html5-slim-rails"
16
+
17
+ s.add_dependency "railties", "~> 3.1.0.rc"
18
+ s.add_dependency "thor", "~> 0.14"
19
+ s.add_dependency "slim", "~> 1.0"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "html5/slim_rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "html5-slim-rails"
7
+ s.version = Html5::SlimRails::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["David Haslem"]
10
+ s.email = ["therabidbanana@gmail.com"]
11
+ s.homepage = "http://github.com/therabidbanana/html5-slim-rails"
12
+ s.summary = %q{Rails support for the new compass-html5 gem.}
13
+ s.description = %q{}
14
+
15
+ s.rubyforge_project = "html5-slim-rails"
16
+
17
+ s.add_dependency "railties", "~> 3.1.0.rc"
18
+ s.add_dependency "thor", "~> 0.14"
19
+ s.add_dependency "slim", "~> 1.0"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Installs Html5Rails and copies compass config file to your application.
3
+
4
+ Example:
5
+ rails generate html5:install
@@ -0,0 +1,19 @@
1
+ module Html5
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def copy_views
7
+ directory "views", "app/views"
8
+ end
9
+
10
+ def copy_stylesheets
11
+ directory "assets", "app/assets"
12
+ end
13
+
14
+ def show_readme
15
+ readme "README" if behavior == :invoke
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ README
2
+ ==================
3
+
@@ -0,0 +1 @@
1
+ //= require html5/boilerplate
@@ -0,0 +1,16 @@
1
+
2
+ // usage: log('inside coolFunc', this, arguments);
3
+ // paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
4
+ window.log = function(){
5
+ log.history = log.history || []; // store logs to an array for reference
6
+ log.history.push(arguments);
7
+ if(this.console) {
8
+ arguments.callee = arguments.callee.caller;
9
+ console.log( Array.prototype.slice.call(arguments) );
10
+ }
11
+ };
12
+ // make it safe to use console.log always
13
+ (function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
14
+
15
+
16
+ // place any jQuery/helper plugins in here, instead of separate, slower script files.
@@ -0,0 +1,2 @@
1
+ //= require modernizr.min
2
+ //= require respond.min
@@ -0,0 +1 @@
1
+ //= require html5/boilerplate/polyfills
@@ -0,0 +1,46 @@
1
+ //= require 'h5bp_style'
2
+
3
+ /* ==|== primary styles =====================================================
4
+ Author:
5
+ ========================================================================== */
6
+
7
+
8
+
9
+ /* ==|== media queries ======================================================
10
+ PLACEHOLDER Media Queries for Responsive Design.
11
+ These override the primary ('mobile first') styles
12
+ Modify as content requires.
13
+ ========================================================================== */
14
+
15
+ @media only screen and (min-width: 480px) {
16
+ /* Style adjustments for viewports 480px and over go here */
17
+
18
+ }
19
+
20
+ @media only screen and (min-width: 768px) {
21
+ /* Style adjustments for viewports 768px and over go here */
22
+
23
+ }
24
+
25
+
26
+
27
+
28
+ /* ==|== print styles =======================================================
29
+ Print styles.
30
+ Inlined to avoid required HTTP connection: h5bp.com/r
31
+ ========================================================================== */
32
+
33
+ @media print {
34
+ * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */
35
+ a, a:visited { text-decoration: underline; }
36
+ a[href]:after { content: " (" attr(href) ")"; }
37
+ abbr[title]:after { content: " (" attr(title) ")"; }
38
+ .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */
39
+ pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
40
+ thead { display: table-header-group; } /* h5bp.com/t */
41
+ tr, img { page-break-inside: avoid; }
42
+ img { max-width: 100% !important; }
43
+ @page { margin: 0.5cm; }
44
+ p, h2, h3 { orphans: 3; widows: 3; }
45
+ h2, h3 { page-break-after: avoid; }
46
+ }
@@ -0,0 +1,4 @@
1
+ #flash
2
+ - flash.each do |key, value|
3
+ .message class=key
4
+ p= value
@@ -0,0 +1,2 @@
1
+ small.copyright
2
+ | Copyright &copy; #{Date.today.year}
@@ -0,0 +1,24 @@
1
+ meta(charset="utf-8")
2
+
3
+ / Always force latest IE rendering engine (even in intranet) & Chrome Frame
4
+ / Remove this if you use the .htaccess
5
+ meta(http-equiv="X-UA-Compatible" content="IE=edge,chrome=1")
6
+
7
+ meta(name="description" content="")
8
+ meta(name="author" content="")
9
+
10
+ / Mobile viewport optimized: j.mp/bplateviewport
11
+ meta(name="viewport" content="width=device-width, initial-scale=1.0")
12
+
13
+ title
14
+ | #{ controller.controller_name.titleize } - #{ controller.action_name.titleize }
15
+
16
+ / Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons
17
+
18
+ = render "stylesheets"
19
+
20
+ / All JavaScript at the bottom, except for Modernizr and Respond.
21
+ / Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
22
+ = javascript_include_tag "polyfills"
23
+
24
+ = csrf_meta_tag
@@ -0,0 +1,27 @@
1
+ / Grab Google CDN's jQuery, with a protocol relative URL
2
+ / Looks for google_api_key first in ENV['GOOGLE_API_KEY'] then in config/google.yml
3
+ / remote_jquery and local_jquery helpers use minified jquery unless Rails.env is development
4
+ / - if !google_api_key.blank?
5
+ / = javascript_include_tag "//www.google.com/jsapi?key=#{google_api_key}"
6
+ / :javascript
7
+ / google.load(#{ remote_jquery("1.6") });
8
+ / - else
9
+ / = javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/#{ local_jquery("1.6") }"
10
+
11
+ / fall back to local jQuery if necessary
12
+ / :javascript
13
+ / window.jQuery || document.write("<script src='/javascripts/jquery.min.js'>\x3C/script>")
14
+
15
+ = javascript_include_tag "application"
16
+
17
+ / Append your own using content_for :javascripts
18
+ == yield :javascripts
19
+
20
+ / asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
21
+ / Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/google.yml
22
+ - if !google_account_id.blank?
23
+ javascript:
24
+ var _gaq=[["_setAccount","#{google_account_id}"],["_trackPageview"],["_trackPageLoadTime"]];
25
+ (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
26
+ g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
27
+ s.parentNode.insertBefore(g,s)}(document,"script"));
@@ -0,0 +1,5 @@
1
+ / CSS: implied media="all"
2
+ = stylesheet_link_tag 'application', :media => 'all'
3
+
4
+ / Append your own using content_for :stylesheets
5
+ == yield :stylesheets
@@ -0,0 +1,29 @@
1
+ doctype html
2
+ / http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
3
+
4
+ /! paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
5
+ /[ if lt IE 7 ]
6
+ html class="no-js ie6" lang="en"
7
+ /[ if IE 7 ]
8
+ html class="no-js ie7" lang="en"
9
+ /[ if IE 8 ]
10
+ html class="no-js ie8" lang="en"
11
+ | <!--[if (gte IE 9)|!(IE)]<!-->
12
+ <html class="no-js" lang="en"> <!--<![endif]-->
13
+
14
+ head
15
+ == render "head"
16
+
17
+ body class=controller.controller_name
18
+ #container
19
+ header#header
20
+ == render "header"
21
+
22
+ #main role='main'
23
+ == render "flashes"
24
+ == yield
25
+ footer#footer
26
+ == render "footer"
27
+
28
+ / Javascript at the bottom for fast page loading
29
+ == render "javascripts"
@@ -0,0 +1,68 @@
1
+ module Html5
2
+ module SlimRails
3
+ module BoilerplateHelper
4
+
5
+ # Create a named haml tag to wrap IE conditional around a block
6
+ # http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
7
+ def ie_tag(name=:body, attrs={}, &block)
8
+ attrs.symbolize_keys!
9
+ haml_concat("<!--[if lt IE 7]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->".html_safe)
10
+ haml_concat("<!--[if IE 7]> #{ tag(name, add_class('ie7', attrs), true) } <![endif]-->".html_safe)
11
+ haml_concat("<!--[if IE 8]> #{ tag(name, add_class('ie8', attrs), true) } <![endif]-->".html_safe)
12
+ haml_concat("<!--[if gt IE 8]><!-->".html_safe)
13
+ haml_tag name, attrs do
14
+ haml_concat("<!--<![endif]-->".html_safe)
15
+ block.call
16
+ end
17
+ end
18
+
19
+ def ie_html(attrs={}, &block)
20
+ ie_tag(:html, attrs, &block)
21
+ end
22
+
23
+ def ie_body(attrs={}, &block)
24
+ ie_tag(:body, attrs, &block)
25
+ end
26
+
27
+ def google_account_id
28
+ ENV['GOOGLE_ACCOUNT_ID'] || google_config(:google_account_id)
29
+ end
30
+
31
+ def google_api_key
32
+ ENV['GOOGLE_API_KEY'] || google_config(:google_api_key)
33
+ end
34
+
35
+ def remote_jquery(version)
36
+ if ::Rails.env == 'development'
37
+ "'jquery', '#{version}', {uncompressed:true}"
38
+ else
39
+ "'jquery', '#{version}'"
40
+ end
41
+ end
42
+
43
+ def local_jquery(version)
44
+ if ::Rails.env == 'development'
45
+ "#{version}/jquery.js"
46
+ else
47
+ "#{version}/jquery.min.js"
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def add_class(name, attrs)
54
+ classes = attrs[:class] || ''
55
+ classes.strip!
56
+ classes = ' ' + classes if !classes.blank?
57
+ classes = name + classes
58
+ attrs.merge(:class => classes)
59
+ end
60
+
61
+ def google_config(key)
62
+ configs = YAML.load_file(File.join(::Rails.root, 'config', 'google.yml'))[::Rails.env.to_sym] rescue {}
63
+ configs[key]
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,19 @@
1
+ module Html5
2
+ module SlimRails
3
+ class Engine < ::Rails::Engine
4
+
5
+ # Extend application_helper
6
+ initializer 'html5_slim_rails_engine.helper' do |app|
7
+ ActionController::Base.helper(Html5::SlimRails::BoilerplateHelper)
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
@@ -0,0 +1,8 @@
1
+ module Html5
2
+ module SlimRails
3
+ VERSION = "0.0.1"
4
+ JQUERY_VERSION = "1.6.1"
5
+ MODERNIZER_VERSION = "2.0"
6
+ RESPOND_VERSION = "625d77dc1aed97baf0ae"
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require "html5/slim_rails/version"
2
+ require "html5/slim_rails/engine"
3
+
4
+ module Html5
5
+ module SlimRails
6
+ autoload :BoilerplateHelper, 'html5/slim_rails/boilerplate_helper'
7
+ end
8
+ end