Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support Sprockets 3.0#6

Merged
agrobbin merged 2 commits into
masterfrom
5-sprockets-3
May 15, 2015
Merged

Support Sprockets 3.0#6
agrobbin merged 2 commits into
masterfrom
5-sprockets-3

Conversation

@agrobbin

@agrobbin agrobbin commented May 7, 2015

Copy link
Copy Markdown
Owner

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
Copy Markdown

👍 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