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

Support Sprockets 3.0 #6

Merged
merged 2 commits into from
May 15, 2015
Merged

Support Sprockets 3.0 #6

merged 2 commits into from
May 15, 2015

Conversation

agrobbin
Copy link
Owner

@agrobbin agrobbin commented May 7, 2015

A lot changed between version 2 and 3, specifically Hike was dropped entirely as a dependency. That of course means that sprockets_environment.send(:trail) doesn't exist anymore, so the entire reset_sprockets_caches! was going to fail in some spectacular fashion.

Dropping into a pry session to determine what sprockets_environment actually is at within reset_sprockets_caches! point revealed that it was a Sprockets::CachedEnvironment. Eventually, after following all of the code paths within CachedEnvironment, Environment, Base, and the various mixed in modules, you end up coming back to Sprockets::CachedEnvironment and a few instance variables within it, @stats, @entries, and @uris.

These are very similar to the instance variables used in our original reset_sprockets_caches! monkey-patch. @entries is a Hash of directory keys which map to an Array of nested files/directories. @stats is a Hash of all files and directories and their File::Stat counterparts. @uris is a Hash of file URIs and their matching Sprockets::Asset objects.

In the end this turns out not to be such a difficult change. We still have to drill into Sprockets::CachedEnvironment to manipulate its instance variables, but it's actually simpler than before.

@aprescott
Copy link

👍 looks good to me!

agrobbin added a commit that referenced this pull request May 15, 2015
@agrobbin agrobbin merged commit 70bb9e2 into master May 15, 2015
@agrobbin agrobbin deleted the 5-sprockets-3 branch May 15, 2015 20:14
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