html5-rails 0.0.2 → 0.0.3
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.
- data/Gemfile +13 -12
- data/LICENSE +20 -0
- data/README.md +58 -3
- data/app/assets/javascripts/application.js +9 -1
- data/app/assets/javascripts/polyfills.js +9 -1
- data/app/views/application/_flashes.html.erb +9 -0
- data/app/views/application/_footer.html.erb +5 -0
- data/app/views/application/_head.html.erb +25 -0
- data/app/views/application/_header.html.erb +3 -0
- data/app/views/application/_javascripts.html.erb +24 -0
- data/app/views/application/_stylesheets.html.erb +4 -0
- data/app/views/layouts/application.html.erb +25 -0
- data/html5-rails.gemspec +4 -2
- data/lib/generators/html5/assets/USAGE +11 -0
- data/lib/generators/html5/assets/assets_generator.rb +63 -0
- data/lib/generators/html5/assets/templates/javascripts/application.js +9 -0
- data/lib/generators/html5/assets/templates/javascripts/polyfills.js +10 -0
- data/lib/generators/html5/assets/templates/stylesheets/_defaults.css.scss +18 -0
- data/lib/generators/html5/assets/templates/stylesheets/application.css.scss +42 -0
- data/lib/generators/html5/assets/templates/stylesheets/application/_defaults.css.scss +7 -0
- data/lib/generators/html5/assets/templates/stylesheets/application/document.css.scss +9 -0
- data/lib/generators/html5/assets/templates/stylesheets/application/media_queries.css.scss +17 -0
- data/lib/generators/html5/generator_helpers.rb +37 -0
- data/lib/generators/html5/install/USAGE +1 -0
- data/lib/generators/html5/install/install_generator.rb +18 -3
- data/lib/generators/html5/install/templates/README +10 -2
- data/lib/generators/html5/install/templates/{compass.rb → config/compass.rb} +1 -1
- data/lib/generators/html5/install/templates/config/html5_rails.yml +26 -0
- data/lib/generators/html5/layout/USAGE +8 -0
- data/lib/generators/html5/layout/layout_generator.rb +44 -0
- data/lib/generators/html5/layout/templates/application.html.erb +25 -0
- data/lib/generators/html5/layout/templates/application.html.haml +16 -0
- data/lib/generators/html5/partial/USAGE +8 -0
- data/lib/generators/html5/partial/partial_generator.rb +77 -0
- data/lib/generators/html5/partial/templates/_flashes.html.erb +9 -0
- data/lib/generators/html5/partial/templates/_flashes.html.haml +5 -0
- data/lib/generators/html5/partial/templates/_footer.html.erb +5 -0
- data/lib/generators/html5/partial/templates/_footer.html.haml +3 -0
- data/lib/generators/html5/partial/templates/_head.html.erb +25 -0
- data/lib/generators/html5/partial/templates/_head.html.haml +28 -0
- data/lib/generators/html5/partial/templates/_header.html.erb +3 -0
- data/lib/generators/html5/partial/templates/_header.html.haml +2 -0
- data/lib/generators/html5/partial/templates/_javascripts.html.erb +24 -0
- data/lib/generators/html5/partial/templates/_javascripts.html.haml +19 -0
- data/lib/generators/html5/partial/templates/_stylesheets.html.erb +4 -0
- data/lib/generators/html5/partial/templates/_stylesheets.html.haml +4 -0
- data/lib/html5/rails.rb +1 -1
- data/lib/html5/rails/engine.rb +1 -1
- data/lib/html5/rails/{boilerplate_helper.rb → helpers.rb} +12 -10
- data/lib/html5/rails/version.rb +3 -5
- data/test/dummy/.gitignore +15 -5
- data/test/dummy/app/assets/javascripts/application.js +9 -2
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/pages/home.html.erb +1 -0
- data/test/dummy/config/application.rb +9 -4
- data/test/dummy/config/environments/development.rb +3 -0
- data/test/dummy/config/environments/production.rb +11 -2
- data/test/dummy/config/initializers/wrap_parameters.rb +5 -3
- data/test/dummy/config/routes.rb +1 -1
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/doc/README_FOR_APP +2 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/generators/assets_generator_test.rb +60 -0
- data/test/generators/install_generator_test.rb +44 -3
- data/test/generators/layout_generator_test.rb +71 -0
- data/test/generators/partial_generator_test.rb +75 -0
- data/test/support/generator_test_helper.rb +18 -0
- data/test/test_helper.rb +4 -8
- data/{app/assets/javascripts/html5/boilerplate → vendor/assets/javascripts/h5bp}/index.js +0 -0
- data/vendor/assets/javascripts/h5bp/plugins.js +15 -0
- data/vendor/assets/javascripts/modernizr.min.js +3 -3
- metadata +115 -72
- data/LICENSE.rb +0 -3
- data/app/assets/javascripts/html5/boilerplate/plugins.js +0 -16
- data/app/assets/javascripts/html5/boilerplate/polyfills.js +0 -2
- data/app/views/application/_flashes.html.haml +0 -4
- data/app/views/application/_footer.html.haml +0 -2
- data/app/views/application/_head.html.haml +0 -24
- data/app/views/application/_header.html.haml +0 -1
- data/app/views/application/_javascripts.html.haml +0 -27
- data/app/views/application/_stylesheets.html.haml +0 -5
- data/app/views/layouts/application.html.haml +0 -20
- data/test/dummy/app/assets/stylesheets/application.css.scss +0 -19
- data/test/dummy/app/assets/stylesheets/partials/_media.css.scss +0 -22
- data/test/dummy/app/views/pages/home.html.haml +0 -2
- data/test/dummy/config/initializers/sass.rb +0 -3
- data/vendor/assets/javascripts/respond.min.js +0 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<%%= javascript_include_tag "application" %>
|
|
2
|
+
|
|
3
|
+
<%%# Append your own using content_for :javascripts %>
|
|
4
|
+
<%%= yield :javascripts %>
|
|
5
|
+
|
|
6
|
+
<%%# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet %>
|
|
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
|
+
<script>
|
|
10
|
+
//<![CDATA[
|
|
11
|
+
var _gaq=[['_setAccount','<%%= google_account_id %>'],['_trackPageview']];
|
|
12
|
+
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
|
13
|
+
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
|
14
|
+
s.parentNode.insertBefore(g,s)}(document,'script'));
|
|
15
|
+
//]]>
|
|
16
|
+
</script>
|
|
17
|
+
<%% end %>
|
|
18
|
+
|
|
19
|
+
<%%# Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. %>
|
|
20
|
+
<%%# chromium.org/developers/how-tos/chrome-frame-getting-started %>
|
|
21
|
+
<!--[if lt IE 7 ]>
|
|
22
|
+
<script defer src='//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js'></script>
|
|
23
|
+
<script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
|
|
24
|
+
<![endif]-->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
= javascript_include_tag "application"
|
|
2
|
+
|
|
3
|
+
-# Append your own using content_for :javascripts
|
|
4
|
+
= yield :javascripts
|
|
5
|
+
|
|
6
|
+
-# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
|
|
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
|
+
|
|
15
|
+
-# Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
|
|
16
|
+
-# chromium.org/developers/how-tos/chrome-frame-getting-started
|
|
17
|
+
/[if lt IE 7 ]
|
|
18
|
+
%script{ :defer => true, :src => "//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js" }
|
|
19
|
+
%script{ :defer => true } window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})
|
data/lib/html5/rails.rb
CHANGED
data/lib/html5/rails/engine.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module Html5
|
|
2
2
|
module Rails
|
|
3
|
-
module
|
|
3
|
+
module Helpers
|
|
4
4
|
|
|
5
5
|
# Create a named haml tag to wrap IE conditional around a block
|
|
6
6
|
# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
|
|
7
7
|
def ie_tag(name=:body, attrs={}, &block)
|
|
8
8
|
attrs.symbolize_keys!
|
|
9
|
-
haml_concat("<!--[if lt IE 7]> #{ tag(name, add_class('
|
|
10
|
-
haml_concat("<!--[if IE 7]> #{ tag(name, add_class('
|
|
11
|
-
haml_concat("<!--[if IE 8]> #{ tag(name, add_class('
|
|
9
|
+
haml_concat("<!--[if lt IE 7]> #{ tag(name, add_class('lt-ie9 lt-ie8 lt-ie7', attrs), true) } <![endif]-->".html_safe)
|
|
10
|
+
haml_concat("<!--[if IE 7]> #{ tag(name, add_class('lt-ie9 lt-ie8', attrs), true) } <![endif]-->".html_safe)
|
|
11
|
+
haml_concat("<!--[if IE 8]> #{ tag(name, add_class('lt-ie9', attrs), true) } <![endif]-->".html_safe)
|
|
12
12
|
haml_concat("<!--[if gt IE 8]><!-->".html_safe)
|
|
13
13
|
haml_tag name, attrs do
|
|
14
14
|
haml_concat("<!--<![endif]-->".html_safe)
|
|
@@ -25,14 +25,15 @@ module Html5
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def google_account_id
|
|
28
|
-
ENV['GOOGLE_ACCOUNT_ID'] ||
|
|
28
|
+
ENV['GOOGLE_ACCOUNT_ID'] || html5_rails_config(:google_account_id)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def google_api_key
|
|
32
|
-
ENV['GOOGLE_API_KEY'] ||
|
|
32
|
+
ENV['GOOGLE_API_KEY'] || html5_rails_config(:google_api_key)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def remote_jquery(version)
|
|
36
|
+
warn "[DEPRECATION] 'remote_jquery' is deprecated."
|
|
36
37
|
if ::Rails.env == 'development'
|
|
37
38
|
"'jquery', '#{version}', {uncompressed:true}"
|
|
38
39
|
else
|
|
@@ -41,6 +42,7 @@ module Html5
|
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
def local_jquery(version)
|
|
45
|
+
warn "[DEPRECATION] 'local_jquery' is deprecated."
|
|
44
46
|
if ::Rails.env == 'development'
|
|
45
47
|
"#{version}/jquery.js"
|
|
46
48
|
else
|
|
@@ -51,15 +53,15 @@ module Html5
|
|
|
51
53
|
private
|
|
52
54
|
|
|
53
55
|
def add_class(name, attrs)
|
|
54
|
-
classes = attrs[:class] ||
|
|
56
|
+
classes = attrs[:class] || ""
|
|
55
57
|
classes.strip!
|
|
56
|
-
classes =
|
|
58
|
+
classes = " " + classes if !classes.blank?
|
|
57
59
|
classes = name + classes
|
|
58
60
|
attrs.merge(:class => classes)
|
|
59
61
|
end
|
|
60
62
|
|
|
61
|
-
def
|
|
62
|
-
configs = YAML.load_file(File.join(::Rails.root, 'config', '
|
|
63
|
+
def html5_rails_config(key)
|
|
64
|
+
configs = YAML.load_file(File.join(::Rails.root, 'config', 'html5_rails.yml'))[::Rails.env.to_sym] rescue {}
|
|
63
65
|
configs[key]
|
|
64
66
|
end
|
|
65
67
|
|
data/lib/html5/rails/version.rb
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
module Html5
|
|
2
2
|
module Rails
|
|
3
|
-
VERSION = "0.0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
MODERNIZER_VERSION = "2.0"
|
|
7
|
-
RESPOND_VERSION = "625d77dc1aed97baf0ae"
|
|
3
|
+
VERSION = "0.0.3"
|
|
4
|
+
COMPASS_H5BP_VERSION = "0.0.2"
|
|
5
|
+
MODERNIZER_VERSION = "2.0.6"
|
|
8
6
|
end
|
|
9
7
|
end
|
data/test/dummy/.gitignore
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.
|
|
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
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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_tree .
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
|
5
|
+
*= require_self
|
|
6
|
+
*= require_tree .
|
|
7
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>Ohai</h1>
|
|
@@ -2,10 +2,12 @@ require File.expand_path('../boot', __FILE__)
|
|
|
2
2
|
|
|
3
3
|
require 'rails/all'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
if defined?(Bundler)
|
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
|
7
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
|
10
|
+
end
|
|
9
11
|
|
|
10
12
|
require "html5-rails"
|
|
11
13
|
|
|
@@ -41,5 +43,8 @@ module Dummy
|
|
|
41
43
|
|
|
42
44
|
# Enable the asset pipeline
|
|
43
45
|
config.assets.enabled = true
|
|
46
|
+
|
|
47
|
+
# Version of your assets, change this if you want to expire all your assets
|
|
48
|
+
config.assets.version = '1.0'
|
|
44
49
|
end
|
|
45
50
|
end
|
|
@@ -14,9 +14,18 @@ Dummy::Application.configure do
|
|
|
14
14
|
# Compress JavaScripts and CSS
|
|
15
15
|
config.assets.compress = true
|
|
16
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 Rails.root.join("public/assets")
|
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
|
25
|
+
|
|
17
26
|
# Specifies the header that your server uses for sending files
|
|
18
|
-
#
|
|
19
|
-
config.action_dispatch.x_sendfile_header =
|
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
20
29
|
|
|
21
30
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
22
31
|
# config.force_ssl = true
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
# is enabled by default.
|
|
5
5
|
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
|
7
|
-
|
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
|
8
|
+
wrap_parameters format: [:json]
|
|
9
|
+
end
|
|
8
10
|
|
|
9
11
|
# Disable root element in JSON by default.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
|
13
|
+
self.include_root_in_json = false
|
|
12
14
|
end
|
data/test/dummy/config/routes.rb
CHANGED
|
@@ -54,5 +54,5 @@ Dummy::Application.routes.draw do
|
|
|
54
54
|
|
|
55
55
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
56
56
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
57
|
-
# match ':controller(/:action(/:id
|
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
|
58
58
|
end
|
|
@@ -0,0 +1,7 @@
|
|
|
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)
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
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/_defaults.css.scss"
|
|
25
|
+
assert_file "app/assets/stylesheets/application.css.scss", /@import "application\/document";/
|
|
26
|
+
%w(_defaults document media_queries).each do |file|
|
|
27
|
+
assert_file "app/assets/stylesheets/application/#{ file }.css.scss"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
test "html5:assets application" do
|
|
32
|
+
run_generator %w(application)
|
|
33
|
+
|
|
34
|
+
assert_file "app/assets/stylesheets/_defaults.css.scss"
|
|
35
|
+
assert_file "app/assets/stylesheets/application.css.scss", /@import "application\/document";/
|
|
36
|
+
%w(_defaults document media_queries).each do |file|
|
|
37
|
+
assert_file "app/assets/stylesheets/application/#{ file }.css.scss"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
test "html5:assets pancakes" do
|
|
42
|
+
run_generator %w(pancakes)
|
|
43
|
+
|
|
44
|
+
assert_file "app/assets/stylesheets/_defaults.css.scss"
|
|
45
|
+
assert_file "app/assets/stylesheets/pancakes.css.scss", /@import "pancakes\/document";/
|
|
46
|
+
%w(_defaults document media_queries).each do |file|
|
|
47
|
+
assert_file "app/assets/stylesheets/pancakes/#{ file }.css.scss"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
test "html5:assets admin/pancakes" do
|
|
52
|
+
run_generator %w(admin/pancakes)
|
|
53
|
+
|
|
54
|
+
assert_file "app/assets/stylesheets/_defaults.css.scss"
|
|
55
|
+
assert_file "app/assets/stylesheets/admin_pancakes.css.scss", /@import "admin\/pancakes\/document";/
|
|
56
|
+
%w(_defaults document media_queries).each do |file|
|
|
57
|
+
assert_file "app/assets/stylesheets/admin_pancakes/#{ file }.css.scss"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -1,12 +1,53 @@
|
|
|
1
1
|
require "test_helper"
|
|
2
|
+
require "generators/html5/install/install_generator"
|
|
2
3
|
|
|
3
4
|
class InstallGeneratorTest < Rails::Generators::TestCase
|
|
5
|
+
include GeneratorTestHelper
|
|
4
6
|
tests Html5::Generators::InstallGenerator
|
|
5
|
-
destination File.expand_path("../../tmp", __FILE__)
|
|
6
|
-
setup :prepare_destination
|
|
7
7
|
|
|
8
|
-
test "
|
|
8
|
+
test "Compass config file should be generated" do
|
|
9
9
|
run_generator
|
|
10
10
|
assert_file "config/compass.rb"
|
|
11
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 "minimal application partials should be generated" do
|
|
30
|
+
run_generator
|
|
31
|
+
%w(_footer _head _header).each do |file|
|
|
32
|
+
assert_file "app/views/application/#{ file }.html.erb"
|
|
33
|
+
end
|
|
34
|
+
%w(_flashes _javascripts _stylesheets).each do |file|
|
|
35
|
+
assert_no_file "app/views/application/#{ file }.html.erb"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
test "assets should be generated" do
|
|
40
|
+
run_generator
|
|
41
|
+
|
|
42
|
+
assert_file "app/assets/stylesheets/_defaults.css.scss"
|
|
43
|
+
assert_file "app/assets/stylesheets/application.css.scss", /@import "application\/document";/
|
|
44
|
+
%w(_defaults document media_queries).each do |file|
|
|
45
|
+
assert_file "app/assets/stylesheets/application/#{ file }.css.scss"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
test "application.css gets removed" do
|
|
50
|
+
run_generator
|
|
51
|
+
assert_no_file "app/assets/stylesheets/application.css"
|
|
52
|
+
end
|
|
12
53
|
end
|