aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-09-01 16:31:15 +0900
committerYuji Yaginuma <yuuji.yaginuma@gmail.com>2018-09-04 20:06:54 +0900
commitfb3642b0caf42b0554a8fd0672943f4da1643b2c (patch)
treef82e8de176f593602a44d45fbbf4d85d5ad325c0 /railties/lib
parent63c6943131189c902485f725b465b48ebea14b09 (diff)
downloadrails-fb3642b0caf42b0554a8fd0672943f4da1643b2c.tar.gz
rails-fb3642b0caf42b0554a8fd0672943f4da1643b2c.tar.bz2
rails-fb3642b0caf42b0554a8fd0672943f4da1643b2c.zip
Respect config setting when output deprecation notice in rake tasks
The rake tasks which became deprecate now does not load the environment. Therefore, even if the application specifies the behavior of deprecating, the message is output to stderr ignoring the specification. It seems that this is not the expected behavior. We should respect the setting even in the rake tasks.
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/tasks/annotations.rake6
-rw-r--r--railties/lib/rails/tasks/dev.rake2
-rw-r--r--railties/lib/rails/tasks/initializers.rake2
3 files changed, 5 insertions, 5 deletions
diff --git a/railties/lib/rails/tasks/annotations.rake b/railties/lib/rails/tasks/annotations.rake
index 65af778a15..3a78de418a 100644
--- a/railties/lib/rails/tasks/annotations.rake
+++ b/railties/lib/rails/tasks/annotations.rake
@@ -2,20 +2,20 @@
require "rails/source_annotation_extractor"
-task :notes do
+task notes: :environment do
Rails::SourceAnnotationExtractor::Annotation.notes_task_deprecation_warning
Rails::Command.invoke :notes
end
namespace :notes do
["OPTIMIZE", "FIXME", "TODO"].each do |annotation|
- task annotation.downcase.intern do
+ task annotation.downcase.intern => :environment do
Rails::SourceAnnotationExtractor::Annotation.notes_task_deprecation_warning
Rails::Command.invoke :notes, ["--annotations", annotation]
end
end
- task :custom do
+ task custom: :environment do
Rails::SourceAnnotationExtractor::Annotation.notes_task_deprecation_warning
Rails::Command.invoke :notes, ["--annotations", ENV["ANNOTATION"]]
end
diff --git a/railties/lib/rails/tasks/dev.rake b/railties/lib/rails/tasks/dev.rake
index 8d75965294..716fb6a331 100644
--- a/railties/lib/rails/tasks/dev.rake
+++ b/railties/lib/rails/tasks/dev.rake
@@ -4,7 +4,7 @@ require "rails/command"
require "active_support/deprecation"
namespace :dev do
- task :cache do
+ task cache: :environment do
ActiveSupport::Deprecation.warn("Using `bin/rake dev:cache` is deprecated and will be removed in Rails 6.1. Use `bin/rails dev:cache` instead.\n")
Rails::Command.invoke "dev:cache"
end
diff --git a/railties/lib/rails/tasks/initializers.rake b/railties/lib/rails/tasks/initializers.rake
index 1fa8ca4f51..f108517d1d 100644
--- a/railties/lib/rails/tasks/initializers.rake
+++ b/railties/lib/rails/tasks/initializers.rake
@@ -3,7 +3,7 @@
require "rails/command"
require "active_support/deprecation"
-task :initializers do
+task initializers: :environment do
ActiveSupport::Deprecation.warn("Using `bin/rake initializers` is deprecated and will be removed in Rails 6.1. Use `bin/rails initializers` instead.\n")
Rails::Command.invoke "initializers"
end