aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/application.rb22
-rw-r--r--railties/lib/rails/application/configuration.rb7
-rw-r--r--railties/lib/rails/command/environment_argument.rb12
-rw-r--r--railties/lib/rails/commands/server/server_command.rb36
-rw-r--r--railties/lib/rails/generators/actions.rb20
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb12
-rw-r--r--railties/lib/rails/generators/rails/plugin/plugin_generator.rb10
7 files changed, 20 insertions, 99 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index acd97b64bf..5a924ab8e6 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -172,14 +172,9 @@ module Rails
def key_generator
# number of iterations selected based on consultation with the google security
# team. Details at https://github.com/rails/rails/pull/6952#issuecomment-7661220
- @caching_key_generator ||=
- if secret_key_base
- ActiveSupport::CachingKeyGenerator.new(
- ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
- )
- else
- ActiveSupport::LegacyKeyGenerator.new(secrets.secret_token)
- end
+ @caching_key_generator ||= ActiveSupport::CachingKeyGenerator.new(
+ ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
+ )
end
# Returns a message verifier object.
@@ -254,7 +249,6 @@ module Rails
super.merge(
"action_dispatch.parameter_filter" => config.filter_parameters,
"action_dispatch.redirect_filter" => config.filter_redirect,
- "action_dispatch.secret_token" => secrets.secret_token,
"action_dispatch.secret_key_base" => secret_key_base,
"action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions,
"action_dispatch.show_detailed_exceptions" => config.consider_all_requests_local,
@@ -404,14 +398,6 @@ module Rails
# Fallback to config.secret_key_base if secrets.secret_key_base isn't set
secrets.secret_key_base ||= config.secret_key_base
- # Fallback to config.secret_token if secrets.secret_token isn't set
- secrets.secret_token ||= config.secret_token
-
- if secrets.secret_token.present?
- ActiveSupport::Deprecation.warn(
- "`secrets.secret_token` is deprecated in favor of `secret_key_base` and will be removed in Rails 6.0."
- )
- end
secrets
end
@@ -587,7 +573,7 @@ module Rails
secret_key_base
elsif secret_key_base
raise ArgumentError, "`secret_key_base` for #{Rails.env} environment must be a type of String`"
- elsif secrets.secret_token.blank?
+ else
raise ArgumentError, "Missing `secret_key_base` for '#{Rails.env}' environment, set this string with `rails credentials:edit`"
end
end
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index c2403c57a7..d5a66b6ec1 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -13,7 +13,7 @@ module Rails
:cache_classes, :cache_store, :consider_all_requests_local, :console,
:eager_load, :exceptions_app, :file_watcher, :filter_parameters,
:force_ssl, :helpers_paths, :hosts, :logger, :log_formatter, :log_tags,
- :railties_order, :relative_url_root, :secret_key_base, :secret_token,
+ :railties_order, :relative_url_root, :secret_key_base,
:ssl_options, :public_file_server,
:session_options, :time_zone, :reload_classes_only_on_change,
:beginning_of_week, :filter_redirect, :x, :enable_dependency_loading,
@@ -50,7 +50,6 @@ module Rails
@autoflush_log = true
@log_formatter = ActiveSupport::Logger::SimpleFormatter.new
@eager_load = nil
- @secret_token = nil
@secret_key_base = nil
@api_only = false
@debug_exception_response_format = nil
@@ -97,10 +96,6 @@ module Rails
if respond_to?(:active_record)
active_record.cache_versioning = true
- # Remove the temporary load hook from SQLite3Adapter when this is removed
- ActiveSupport.on_load(:active_record_sqlite3adapter) do
- ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer = true
- end
end
if respond_to?(:action_dispatch)
diff --git a/railties/lib/rails/command/environment_argument.rb b/railties/lib/rails/command/environment_argument.rb
index 5dc98b113d..fdc5ee92d9 100644
--- a/railties/lib/rails/command/environment_argument.rb
+++ b/railties/lib/rails/command/environment_argument.rb
@@ -8,23 +8,13 @@ module Rails
extend ActiveSupport::Concern
included do
- argument :environment, optional: true, banner: "environment"
-
class_option :environment, aliases: "-e", type: :string,
desc: "Specifies the environment to run this console under (test/development/production)."
end
private
def extract_environment_option_from_argument
- if environment
- self.options = options.merge(environment: acceptable_environment(environment))
-
- ActiveSupport::Deprecation.warn "Passing the environment's name as a " \
- "regular argument is deprecated and " \
- "will be removed in the next Rails " \
- "version. Please, use the -e option " \
- "instead."
- elsif options[:environment]
+ if options[:environment]
self.options = options.merge(environment: acceptable_environment(options[:environment]))
else
self.options = options.merge(environment: Rails::Command.environment)
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb
index 6c4cc3cb86..20694e7e39 100644
--- a/railties/lib/rails/commands/server/server_command.rb
+++ b/railties/lib/rails/commands/server/server_command.rb
@@ -21,19 +21,6 @@ module Rails
set_environment
end
- def app
- @app ||= begin
- app = super
- if app.is_a?(Class)
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Using `Rails::Application` subclass to start the server is deprecated and will be removed in Rails 6.0.
- Please change `run #{app}` to `run Rails.application` in config.ru.
- MSG
- end
- app.respond_to?(:to_app) ? app.to_app : app
- end
- end
-
def opt_parser
Options.new
end
@@ -111,8 +98,6 @@ module Rails
DEFAULT_PORT = 3000
DEFAULT_PID_PATH = "tmp/pids/server.pid"
- argument :using, optional: true
-
class_option :port, aliases: "-p", type: :numeric,
desc: "Runs Rails on the specified port - defaults to 3000.", banner: :port
class_option :binding, aliases: "-b", type: :string,
@@ -139,7 +124,6 @@ module Rails
super
@original_options = local_options - %w( --restart )
- deprecate_positional_rack_server_and_rewrite_to_option(@original_options)
end
def perform
@@ -157,7 +141,7 @@ module Rails
after_stop_callback = -> { say "Exiting" unless options[:daemon] }
server.start(after_stop_callback)
else
- say rack_server_suggestion(using)
+ say rack_server_suggestion(options[:using])
end
end
end
@@ -166,7 +150,7 @@ module Rails
def server_options
{
user_supplied_options: user_supplied_options,
- server: using,
+ server: options[:using],
log_stdout: log_to_stdout?,
Port: port,
Host: host,
@@ -275,22 +259,6 @@ module Rails
FileUtils.rm_f(options[:pid]) if options[:restart]
end
- def deprecate_positional_rack_server_and_rewrite_to_option(original_options)
- if using
- ActiveSupport::Deprecation.warn(<<~MSG)
- Passing the Rack server name as a regular argument is deprecated
- and will be removed in the next Rails version. Please, use the -u
- option instead.
- MSG
-
- original_options.concat [ "-u", using ]
- else
- # Use positional internally to get around Thor's immutable options.
- # TODO: Replace `using` occurrences with `options[:using]` after deprecation removal.
- @using = options[:using]
- end
- end
-
def rack_server_suggestion(server)
if server.in?(RACK_SERVERS)
<<~MSG
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 4646a55316..3856a74a39 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -8,7 +8,6 @@ module Rails
def initialize(*) # :nodoc:
super
@indentation = 0
- @after_bundle_callbacks = []
end
# Adds an entry into +Gemfile+ for the supplied gem.
@@ -248,15 +247,6 @@ module Rails
execute_command :rails, command, options
end
- # Just run the capify command in root
- #
- # capify!
- def capify!
- ActiveSupport::Deprecation.warn("`capify!` is deprecated and will be removed in the next version of Rails.")
- log :capify, ""
- in_root { run("#{extify(:capify)} .", verbose: false) }
- end
-
# Make an entry in Rails routing file <tt>config/routes.rb</tt>
#
# route "root 'welcome#index'"
@@ -276,16 +266,6 @@ module Rails
log File.read(find_in_source_paths(path))
end
- # Registers a callback to be executed after bundle and spring binstubs
- # have run.
- #
- # after_bundle do
- # git add: '.'
- # end
- def after_bundle(&block)
- @after_bundle_callbacks << block
- end
-
private
# Define log for backwards compatibility. If just one argument is sent,
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 337a71ac06..f2f46d6e25 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -276,6 +276,8 @@ module Rails
if options[:api]
self.options = options.merge(skip_sprockets: true, skip_javascript: true).freeze
end
+
+ @after_bundle_callbacks = []
end
public_task :set_default_accessors!
@@ -497,6 +499,16 @@ module Rails
create_file(*args, &block)
end
+ # Registers a callback to be executed after bundle and spring binstubs
+ # have run.
+ #
+ # after_bundle do
+ # git add: '.'
+ # end
+ def after_bundle(&block) # :doc:
+ @after_bundle_callbacks << block
+ end
+
def get_builder_class
defined?(::AppBuilder) ? ::AppBuilder : Rails::AppBuilder
end
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
index 294c8a2609..79a06648b5 100644
--- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
+++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
@@ -263,16 +263,6 @@ task default: :test
public_task :apply_rails_template
- def run_after_bundle_callbacks
- unless @after_bundle_callbacks.empty?
- ActiveSupport::Deprecation.warn("`after_bundle` is deprecated and will be removed in the next version of Rails. ")
- end
-
- @after_bundle_callbacks.each do |callback|
- callback.call
- end
- end
-
def name
@name ||= begin
# same as ActiveSupport::Inflector#underscore except not replacing '-'