diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-03-16 09:57:12 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-03-16 10:02:06 +0900 |
commit | 6f94260ac67755fbc4d89e7dd9ba6be04abfa9e7 (patch) | |
tree | ff5638bfc76958caad9298b2866241ef82be7980 /railties/lib | |
parent | a47c84d584777238a6955e3a08436577c471af0f (diff) | |
download | rails-6f94260ac67755fbc4d89e7dd9ba6be04abfa9e7.tar.gz rails-6f94260ac67755fbc4d89e7dd9ba6be04abfa9e7.tar.bz2 rails-6f94260ac67755fbc4d89e7dd9ba6be04abfa9e7.zip |
Add -e/--environment option to `rails initializers`
This allows specifying the environment as would any other rails commands.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/commands/initializers/initializers_command.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/rails/commands/initializers/initializers_command.rb b/railties/lib/rails/commands/initializers/initializers_command.rb index 33596177af..bd2f3bed67 100644 --- a/railties/lib/rails/commands/initializers/initializers_command.rb +++ b/railties/lib/rails/commands/initializers/initializers_command.rb @@ -1,10 +1,17 @@ # frozen_string_literal: true +require "rails/command/environment_argument" + module Rails module Command class InitializersCommand < Base # :nodoc: + include EnvironmentArgument + desc "initializers", "Print out all defined initializers in the order they are invoked by Rails." def perform + extract_environment_option_from_argument + ENV["RAILS_ENV"] = options[:environment] + require_application_and_environment! Rails.application.initializers.tsort_each do |initializer| |