brentd / xray-rails

☠️ A development tool that reveals your UI's bones
MIT License
1.22k stars 79 forks source link

Add sprockets-rails 3.0.0 compatibility #62

Closed mattbrictson closed 8 years ago

mattbrictson commented 8 years ago

It seems that sprockets-rails 3.0.0 does not initialize the app.assets object until it runs its after_initialize block. This means that xray-rails must move its initialization process into after_initialize as well.

The exception is the config.assets.precompile modifications, which must be done earlier before that array gets frozen.

These changes fix the "asset pipeline is currently disabled" error when starting up a Rails app that uses sprockets-rails 3.0.0.

This fixes #61.

@brentd Could you give me some pointers on how to test this PR? I am having trouble getting rspec to run (maybe you could share your Gemfile.lock?). I've manually tested this patch using a Rails 4.2.5 app, but I'd like to make sure the test suite passes (and ideally test older versions of Rails and sprockets-rails as well).

Edit: I got rspec working and the tests are passing.

mattbrictson commented 8 years ago

I ran the tests against Rails 4.0.13, 4.1.14, and 4.2.5. For 4.2.5, I also tested with sprockets-rails 2.3.3 and 3.0.0. Everything checks out!

afstanton commented 8 years ago

This would be nice to see merged in - I recently tried pulling this into a Rails 5 beta 1 app, and got the above error. Thanks!

dsexton commented 8 years ago

@brentd any chance we can get this merged in?

amatsuda commented 8 years ago

This worked perfectly, and the patch looks beautiful! :sparkles:

machida commented 8 years ago

I think that’s great work! :+1:

brentd commented 8 years ago

Thanks @mattbrictson!

brentd commented 8 years ago

Released in v0.1.18