Skip to content

Conversation

anniecodes
Copy link

What this is doing:

  • Moves the initializers rake task to use Rails::Command without changing the API
  • Adds deprecation when calling it with bin/rake instead of bin/rails
  • Adds tests for the rake task since there wasn't any

cc/ @kaspth

* Invoke Rails::Command within the rake task
* Adds test for calling initializers with 'bin/rake'
* Adds deprecation warning to the rake task
@rails-bot
Copy link

r? @eileencodes

(@rails-bot has picked a reviewer for you, use r? to override)

desc "Print out all defined initializers in the order they are invoked by Rails."
task initializers: :environment do
Copy link
Author

@anniecodes anniecodes Aug 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got rid of loading the environment here since we are loading it within the Rails::Command. My assumption is that requiring it in both places would load it twice which is unnecessary, but please correct me if I'm wrong here .

The only down side of getting rid of it here is that our ActiveSupport::Deprecation.behavior will not be taken into consideration and therefore the warning is outputted to stderr instead of following whatever the user set up in their app. I thought it was pretty benign to have it output to stderr since this entire task will be removed in 6.1 but please let me know if you feel strongly about keeping the environment loading here.

@@ -1,8 +1,10 @@
# frozen_string_literal: true

require "rails/command"
require "active_support/deprecation"

desc "Print out all defined initializers in the order they are invoked by Rails."
Copy link
Contributor

@bogdanvlviv bogdanvlviv Aug 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove this desc? It would remove this deprecated rake task from the task list(rake -T)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we've removed documentation before from other things, but I don't think that's a helpful habit or the best approach.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaspth if it's deprecated, and the command is now documented under rails-proper, I don't see why we'd keep this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to remove

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, that's right 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants