Skip to content

Commit

Permalink
Merge pull request #29891 from pat/frozen-string-literals-railties
Browse files Browse the repository at this point in the history
Railties updates for frozen string literals.
  • Loading branch information
rafaelfranca committed Aug 14, 2017
2 parents 5a5b481 + 7f6a314 commit 5ccdd0b
Show file tree
Hide file tree
Showing 311 changed files with 638 additions and 18 deletions.
1 change: 0 additions & 1 deletion .rubocop.yml
Expand Up @@ -83,7 +83,6 @@ Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Exclude:
- 'railties/**/*'
- 'actionview/test/**/*.builder'
- 'actionview/test/**/*.ruby'
- 'actionpack/test/**/*.builder'
Expand Down
2 changes: 2 additions & 0 deletions railties/Rakefile
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rake/testtask"

task default: :test
Expand Down
1 change: 1 addition & 0 deletions railties/bin/test
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

COMPONENT_ROOT = File.expand_path("..", __dir__)
require_relative "../../tools/test"
1 change: 1 addition & 0 deletions railties/exe/rails
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

git_path = File.expand_path("../../.git", __dir__)

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/minitest/rails_plugin.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/module/attribute_accessors"
require "rails/test_unit/reporter"
require "rails/test_unit/runner"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "rails/ruby_version_check"

require "pathname"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/all.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rails"

%w(
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/api/generator.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "sdoc"

class RDoc::Generator::API < RDoc::Generator::SDoc # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/api/task.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rdoc/task"
require_relative "generator"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/app_loader.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "pathname"
require_relative "version"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/app_updater.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rails/generators"
require "rails/generators/rails/app/app_generator"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "yaml"
require "active_support/core_ext/hash/keys"
require "active_support/core_ext/object/blank"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application/bootstrap.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "fileutils"
require "active_support/notifications"
require "active_support/dependencies"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application/configuration.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/kernel/reporting"
require "active_support/file_update_checker"
require_relative "../engine/configuration"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application/default_middleware_stack.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
class Application
class DefaultMiddlewareStack
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application/finisher.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
class Application
module Finisher
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application/routes_reloader.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/module/delegation"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/application_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Rails::ApplicationController < ActionController::Base # :nodoc:
self.view_paths = File.expand_path("templates", __dir__)
layout "application"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/backtrace_cleaner.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/backtrace_cleaner"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/cli.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "app_loader"

# If we are inside a Rails application this method performs an exec and thus
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/code_statistics.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "code_statistics_calculator"
require "active_support/core_ext/enumerable"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/code_statistics_calculator.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class CodeStatisticsCalculator #:nodoc:
attr_reader :lines, :code_lines, :classes, :methods

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support"
require "active_support/dependencies/autoload"
require "active_support/core_ext/enumerable"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/command/actions.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
module Actions
Expand Down
4 changes: 3 additions & 1 deletion railties/lib/rails/command/base.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "thor"
require "erb"

Expand Down Expand Up @@ -73,7 +75,7 @@ def executable

# Use Rails' default banner.
def banner(*)
"#{executable} #{arguments.map(&:usage).join(' ')} [options]".squish!
"#{executable} #{arguments.map(&:usage).join(' ')} [options]".squish
end

# Sets the base_name taking into account the current class namespace.
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/command/behavior.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/command/environment_argument.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "command"

aliases = {
Expand Down
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../generators"
require_relative "../../generators/rails/app/app_generator"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/console/console_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "irb"
require "irb/completion"

Expand Down
4 changes: 3 additions & 1 deletion railties/lib/rails/commands/dbconsole/dbconsole_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../command/environment_argument"

module Rails
Expand Down Expand Up @@ -58,7 +60,7 @@ def start
logon = ""

if config["username"]
logon = config["username"]
logon = config["username"].dup
logon << "/#{config['password']}" if config["password"] && @options["include_password"]
logon << "@#{config['database']}" if config["database"]
end
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/destroy/destroy_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../generators"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/generate/generate_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../generators"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/help/help_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
class HelpCommand < Base # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/new/new_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
class NewCommand < Base # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/plugin/plugin_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
class PluginCommand < Base # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/rake/rake_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
class RakeCommand < Base # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/runner/runner_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
class RunnerCommand < Base # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/secrets/secrets_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support"
require_relative "../../secrets"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/server/server_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "fileutils"
require "optparse"
require "action_dispatch"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/test/test_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../command"
require_relative "../../test_unit/runner"
require_relative "../../test_unit/reporter"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/commands/version/version_command.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Command
class VersionCommand < Base # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/configuration.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/ordered_options"
require "active_support/core_ext/object"
require_relative "paths"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/console/app.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/all"
require "action_controller"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/console/helpers.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module ConsoleMethods
# Gets the helper methods available to the controller.
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/dev_caching.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "fileutils"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/engine.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "railtie"
require_relative "engine/railties"
require "active_support/core_ext/module/delegation"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/engine/commands.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

unless defined?(APP_PATH)
if File.exist?(File.expand_path("test/dummy/config/application.rb", ENGINE_ROOT))
APP_PATH = File.expand_path("test/dummy/config/application", ENGINE_ROOT)
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/engine/configuration.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../railtie/configuration"

module Rails
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/engine/railties.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
class Engine < Railtie
class Railties
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/engine/updater.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../generators"
require_relative "../generators/rails/plugin/plugin_generator"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/gem_version.rb
@@ -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
4 changes: 3 additions & 1 deletion railties/lib/rails/generators.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

activesupport_path = File.expand_path("../../../activesupport/lib", __dir__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)

Expand Down Expand Up @@ -271,7 +273,7 @@ def invoke(namespace, args = ARGV, config = {})
else
options = sorted_groups.flat_map(&:last)
suggestions = options.sort_by { |suggested| levenshtein_distance(namespace.to_s, suggested) }.first(3)
msg = "Could not find generator '#{namespace}'. "
msg = "Could not find generator '#{namespace}'. ".dup
msg << "Maybe you meant #{ suggestions.map { |s| "'#{s}'" }.to_sentence(last_word_connector: " or ", locale: :en) }\n"
msg << "Run `rails generate --help` for more options."
puts msg
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/actions.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Generators
module Actions
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/actions/create_migration.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "fileutils"
require "thor/actions"

Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/active_model.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Rails
module Generators
# ActiveModel is a class to be implemented by each ORM to allow Rails to
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/app_base.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "fileutils"
require "digest/md5"
require "active_support/core_ext/string/strip"
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/base.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "thor/group"
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/css/assets/assets_generator.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../named_base"

module Css # :nodoc:
Expand Down
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "../../named_base"

module Css # :nodoc:
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/erb.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "named_base"

module Erb # :nodoc:
Expand Down

0 comments on commit 5ccdd0b

Please sign in to comment.