Skip to content

Commit

Permalink
Merge pull request #30230 from koic/use_frozen_string_literal
Browse files Browse the repository at this point in the history
Use frozen string literal
  • Loading branch information
matthewd committed Aug 13, 2017
2 parents 788f46d + d17264d commit dbe1647
Show file tree
Hide file tree
Showing 31 changed files with 64 additions and 13 deletions.
10 changes: 1 addition & 9 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,8 @@ Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Include:
- 'activesupport/**/*'
- 'activemodel/**/*'
- 'actioncable/**/*'
- 'activejob/**/*'
- 'activerecord/**/*'
- 'activestorage/**/*'
- 'actionmailer/**/*'
- 'actionview/**/*'
- 'actionpack/**/*'
Exclude:
- 'railties/**/*'
- 'actionview/test/**/*.builder'
- 'actionview/test/**/*.ruby'
- 'actionpack/test/**/*.builder'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) { |repo| "https://github.com/#{repo}.git" }
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "net/http"

$:.unshift __dir__
Expand Down
2 changes: 2 additions & 0 deletions ci/travis.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "fileutils"
include FileUtils

Expand Down
2 changes: 2 additions & 0 deletions guides/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :guides do
desc 'Generate guides (for authors), use ONLY=foo to process just "foo.md"'
task generate: "generate:html"
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/action_controller_gem.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/action_controller_master.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/active_job_gem.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/active_job_master.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/active_record_gem.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/active_record_master.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/active_record_migrations_gem.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/benchmark.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/generic_gem.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/bug_report_templates/generic_master.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "bundler/inline"
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$:.unshift __dir__

as_lib = File.expand_path("../activesupport/lib", __dir__)
Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides/generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "set"
require "fileutils"

Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "yaml"

module RailsGuides
Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides/indexer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/object/blank"
require "active_support/core_ext/string/inflections"

Expand Down
1 change: 1 addition & 0 deletions guides/rails_guides/kindle.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "kindlerb"
require "nokogiri"
Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides/levenshtein.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module RailsGuides
module Levenshtein
# This code is based directly on the Text gem implementation.
Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides/markdown.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "redcarpet"
require "nokogiri"
require "rails_guides/markdown/renderer"
Expand Down
2 changes: 2 additions & 0 deletions guides/rails_guides/markdown/renderer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module RailsGuides
class Markdown
class Renderer < Redcarpet::Render::HTML
Expand Down
2 changes: 2 additions & 0 deletions guides/w3c_validator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# ---------------------------------------------------------------------------
#
# This script validates the generated guides against the W3C Validator.
Expand Down
2 changes: 2 additions & 0 deletions rails.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

version = File.read(File.expand_path("RAILS_VERSION", __dir__)).strip

Gem::Specification.new do |s|
Expand Down
10 changes: 6 additions & 4 deletions tasks/release.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

FRAMEWORKS = %w( activesupport activemodel activerecord actionview actionpack activejob actionmailer actioncable activestorage railties )
FRAMEWORK_NAMES = Hash.new { |h, k| k.split(/(?<=active|action)/).map(&:capitalize).join(" ") }

Expand Down Expand Up @@ -72,9 +74,9 @@

task gem => %w(update_versions pkg) do
cmd = ""
cmd << "cd #{framework} && " unless framework == "rails"
cmd << "bundle exec rake package && " unless framework == "rails"
cmd << "gem build #{gemspec} && mv #{framework}-#{version}.gem #{root}/pkg/"
cmd += "cd #{framework} && " unless framework == "rails"
cmd += "bundle exec rake package && " unless framework == "rails"
cmd += "gem build #{gemspec} && mv #{framework}-#{version}.gem #{root}/pkg/"
sh cmd
end

Expand Down Expand Up @@ -104,7 +106,7 @@
current_contents = File.read(fname)

header = "## Rails #{version} (#{Date.today.strftime('%B %d, %Y')}) ##\n\n"
header << "* No changes.\n\n\n" if current_contents =~ /\A##/
header += "* No changes.\n\n\n" if current_contents =~ /\A##/
contents = header + current_contents
File.open(fname, "wb") { |f| f.write contents }
end
Expand Down
2 changes: 2 additions & 0 deletions tools/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler"
Bundler.setup

Expand Down
2 changes: 2 additions & 0 deletions tools/profile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Profile require calls giving information about the time and the files that are called
# when loading the provided file.
#
Expand Down
2 changes: 2 additions & 0 deletions tools/test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$: << File.expand_path("test", COMPONENT_ROOT)

require "bundler"
Expand Down
2 changes: 2 additions & 0 deletions version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
# Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
def self.gem_version
Expand Down

0 comments on commit dbe1647

Please sign in to comment.