Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import append_assets_path initializer #215

Merged
merged 3 commits into from
Jan 21, 2015
Merged

Import append_assets_path initializer #215

merged 3 commits into from
Jan 21, 2015

Conversation

josh
Copy link
Contributor

@josh josh commented Jan 20, 2015

Alright, @rafaelfranca

Heres the idea for moving the append_assets_path into this plugin.

Then in rails/master we could completely remove config.assets and this guy. This code would still cover people running Rails 4.2. And eventually we can remove the guard when we only need to support Rails 5.

Related discussion

@@ -36,6 +36,17 @@ def assets
# Returns Sprockets::Manifest for app config.
attr_accessor :assets_manifest
end

class Engine < Railtie
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is extending initializers on Engine allowed?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is, although it is not the best way of doing it.

Since we want to detect if the initializer was already defined I think we can't do better.

When we drop support to Rails 4 we can change it to instead of reopening Rails::Engine just define a Sprockets::Rails::Engine instead of a Railtie.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we drop support to Rails 4 we can change it to instead of reopening Rails::Engine just define a Sprockets::Rails::Engine instead of a Railtie.

Ah, cool, I didn't realize that would work.

# Skip defining append_assets_path on Rails <= 4.2
unless initializers.find { |init| init.name == :append_assets_path }
initializer :append_assets_path, :group => :all do |app|
if paths["app/assets"].respond_to?(:existent_directories)
Copy link
Member

Choose a reason for hiding this comment

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

Why bother with versions < 4 if the initializer is defined and we will not enter this code? It is just because Rails 3.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:/ yeah, I just wanted to make the tests pass. This is merging into the old 2.x. I'll drop this condition when pulling this patch into master.

josh added a commit that referenced this pull request Jan 21, 2015
Import append_assets_path initializer
@josh josh merged commit d9cdd77 into 2.x Jan 21, 2015
@josh josh deleted the init-append-assets-path branch January 21, 2015 19:19
@p8 p8 mentioned this pull request Aug 5, 2022
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.

2 participants