-
Notifications
You must be signed in to change notification settings - Fork 133
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
Solve Sprockets DEPRECATION WARNING #137
Conversation
I’m using Grease https://github.com/yasaichi/grease as a wrapper around `LessTemplate` and `ImportProcessor` and have also rejigged the loading process to make things compatible with Sprockets 2, 3 and 4. Extra changes: * Turned the warnings off for now with rake to make the output of the tests a bit more understandable. * Update the `README` with regards to getting the test suite running * Fixed a couple of spec’s to look for the right engine and preprocessor classes * Removed the use of `capture` in `run_generator`. There is no recommended replacement.
@simi, finally the test suite seems to be in order! Let me know if you need any more information about this. I think there's a large group of people hanging out for this fix :D |
this works for us (thank you, @brendon!) -- almost -- on Rails 5.0 because it eliminates the one additional issue that we hit is the line above:
|
I don’t think Sprockets::Engines is required to be called explicitly to autoload.
Thanks for the feedback @tdonia :) I've pushed a change that should hopefully fix that. Let me know how it works on your end. I'll see how travis likes it also. |
Use `register_transformer` instead of `register_preprocessor`.
`rails s` still yield the deprecation warning: * See issue: metaskills/less-rails#122 * PR pending: metaskills/less-rails#137 * Workaround: `gem 'less-rails', github: 'brendon/less-rails', branch: 'fix-sprockets-loading'
Any update on this? Thank you. |
$ bundle install | ||
$ bundle exec rake appraisal:setup | ||
$ bundle exec rake appraisal test | ||
$ bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep bundle install
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that, but bundle
is the same as bundle install
(install is the default action). Let me know if you still want it changed back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone alive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that I am alive.
Rakefile
Outdated
@@ -7,6 +7,7 @@ Rake::TestTask.new do |t| | |||
t.libs = ['lib','test'] | |||
t.test_files = Dir.glob("test/**/*_spec.rb").sort | |||
t.verbose = true | |||
t.warning = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. I think it was to silence the errors from some other dependencies (therubyracer
) and make the test results more rational to view.
.travis.yml
Outdated
- 2.0.0 | ||
- 2.1.4 | ||
- jruby-19mode | ||
- 2.2.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to drop old rubies here? Are they failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off the top of my head I can't remember. Depending on the rails version, we'd have to exclude certain combinations. I can add them back to the matrix and see how they test out if you like?
Fuzzy matching doesn’t seem to work properly with RVM
This could be fixed by moving away from therubyracer in the future.
Hi @simi, I've updated the test matrix and all the tests pass. I'm only testing for the latest version of jruby. Is that ok? I've commented out the warnings line. It's handy to have there locally to uncomment because of the excessive I'll wait to hear from you on the |
Hi @simi, any more comments before we finalise this? :) |
Rails did this transition already. Either library will work, but we should go with what is current. It also removes the warnings showing up in the tests.
@simi Can we get this merged in? We just upgraded sprockets / rails and are running into these warnings. Happy to help make any changes, but it looks like the changes have been made and we're just waiting on a merge + release. |
I've used the workaround: |
Hi @ubugnu, thanks for reporting the error. If I've added the |
100,000 🎉 :D |
Can you ping when the gem is released? :) |
See metaskills/less-rails#137 and #102. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
The warning is: ``` DEPRECATION WARNING: Sprockets method `register_engine` is deprecated. Please register a mime type using `register_mime_type` then use `register_compressor` or `register_transformer`. ``` This problem is really a less-rails error, and is documented in this issue of that repo: metaskills/less-rails#122 It was fixed with this PR, merged Oct 2017: metaskills/less-rails#137 Bumping our less-rails dependency to 3.0.0 will give us the updates in that PR. Version 3.0.0 is the next version after 2.8.0, so there are very few other changes to worry about. You can view all of the less-rails code changes between 2.8.0 and 3.0.0 here: metaskills/less-rails@05186eb...7bb14e5 They are almost all test and/or README changes. So this update should be low risk.
`rails s` still yield the deprecation warning: * See issue: metaskills/less-rails#122 * PR pending: metaskills/less-rails#137 * Workaround: `gem 'less-rails', github: 'brendon/less-rails', branch: 'fix-sprockets-loading'
I’m using Grease https://github.com/yasaichi/grease as a wrapper around
LessTemplate
andImportProcessor
and have also rejigged the loadingprocess to make things compatible with Sprockets 2, 3 and 4.
Extra changes:
tests a bit more understandable.
README
with regards to getting the test suite runningpreprocessor classes
capture
inrun_generator
. There is norecommended replacement.
Closes: #122 Finally! :)
Thanks to #128 for inspiration @MustafaZain.