1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/commands/initializers/initializers_command.rb
yuuji.yaginuma 6f94260ac6 Add -e/--environment option to rails initializers
This allows specifying the environment as would any other rails commands.
2019-03-16 10:02:06 +09:00

23 lines
628 B
Ruby

# 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|
say "#{initializer.context_class}.#{initializer.name}"
end
end
end
end
end