Use single quotes in generated files

This commit is contained in:
Chulki Lee 2014-01-14 09:57:40 -08:00
parent b23330745b
commit 1ab6c656d6
8 changed files with 24 additions and 20 deletions

View File

@ -2,8 +2,8 @@
<html>
<head>
<title>Blog</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>

View File

@ -14,7 +14,7 @@ Blog::Application.configure do
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true

View File

@ -130,7 +130,7 @@ Rails-specific features. For example:
```ruby
class FooBar
def as_json(options = nil)
{ foo: "bar" }
{ foo: 'bar' }
end
end
@ -503,13 +503,13 @@ get 'こんにちは', controller: 'welcome', action: 'index'
```ruby
# Rails 3.x
match "/" => "root#index"
match '/' => 'root#index'
# becomes
match "/" => "root#index", via: :get
match '/' => 'root#index', via: :get
# or
get "/" => "root#index"
get '/' => 'root#index'
```
* Rails 4.0 has removed `ActionDispatch::BestStandardsSupport` middleware, `<!DOCTYPE html>` already triggers standards mode per http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx and ChromeFrame header has been moved to `config.action_dispatch.default_headers`.
@ -705,7 +705,7 @@ You can help test performance with these additions to your test environment:
```ruby
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
config.static_cache_control = 'public, max-age=3600'
```
### config/initializers/wrap_parameters.rb

View File

@ -1,3 +1,7 @@
* Use single quotes in generated files.
*Chulki Lee*
* Write controller generated routes in routes.rb with single quotes.
*Cristian Mircea Messel*

View File

@ -3,14 +3,14 @@
<head>
<title><%= camelized %></title>
<%- if options[:skip_javascript] -%>
<%%= stylesheet_link_tag "application", media: "all" %>
<%%= stylesheet_link_tag 'application', media: 'all' %>
<%- else -%>
<%- if gemfile_entries.any? { |m| m.name == "turbolinks" } -%>
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%- if gemfile_entries.any? { |m| m.name == 'turbolinks' } -%>
<%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%- else -%>
<%%= stylesheet_link_tag "application", media: "all" %>
<%%= javascript_include_tag "application" %>
<%%= stylesheet_link_tag 'application', media: 'all' %>
<%%= javascript_include_tag 'application' %>
<%- end -%>
<%- end -%>
<%%= csrf_meta_tags %>

View File

@ -14,7 +14,7 @@ Rails.application.configure do
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true

View File

@ -1,4 +1,4 @@
ENV["RAILS_ENV"] ||= "test"
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

View File

@ -58,8 +58,8 @@ class AppGeneratorTest < Rails::Generators::TestCase
def test_assets
run_generator
assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application", media: "all", "data-turbolinks-track" => true/)
assert_file("app/views/layouts/application.html.erb", /javascript_include_tag\s+"application", "data-turbolinks-track" => true/)
assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+'application', media: 'all', 'data-turbolinks-track' => true/)
assert_file("app/views/layouts/application.html.erb", /javascript_include_tag\s+'application', 'data-turbolinks-track' => true/)
assert_file("app/assets/stylesheets/application.css")
assert_file("app/assets/javascripts/application.js")
end
@ -364,8 +364,8 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_no_file "vendor/assets/javascripts"
assert_file "app/views/layouts/application.html.erb" do |contents|
assert_match(/stylesheet_link_tag\s+"application", media: "all" %>/, contents)
assert_no_match(/javascript_include_tag\s+"application" \%>/, contents)
assert_match(/stylesheet_link_tag\s+'application', media: 'all' %>/, contents)
assert_no_match(/javascript_include_tag\s+'application' \%>/, contents)
end
assert_file "Gemfile" do |content|