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> <html>
<head> <head>
<title>Blog</title> <title>Blog</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
</head> </head>
<body> <body>

View File

@ -14,7 +14,7 @@ Blog::Application.configure do
# Configure static asset server for tests with Cache-Control for performance. # Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true 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. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true

View File

@ -130,7 +130,7 @@ Rails-specific features. For example:
```ruby ```ruby
class FooBar class FooBar
def as_json(options = nil) def as_json(options = nil)
{ foo: "bar" } { foo: 'bar' }
end end
end end
@ -503,13 +503,13 @@ get 'こんにちは', controller: 'welcome', action: 'index'
```ruby ```ruby
# Rails 3.x # Rails 3.x
match "/" => "root#index" match '/' => 'root#index'
# becomes # becomes
match "/" => "root#index", via: :get match '/' => 'root#index', via: :get
# or # 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`. * 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 ```ruby
# Configure static asset server for tests with Cache-Control for performance # Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true 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 ### 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. * Write controller generated routes in routes.rb with single quotes.
*Cristian Mircea Messel* *Cristian Mircea Messel*

View File

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

View File

@ -14,7 +14,7 @@ Rails.application.configure do
# Configure static asset server for tests with Cache-Control for performance. # Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true 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. # Show full error reports and disable caching.
config.consider_all_requests_local = true 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 File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help' require 'rails/test_help'

View File

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