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

deprecation warning at 'rails s' #122

Closed
coppolaf opened this issue Jul 22, 2016 · 57 comments
Closed

deprecation warning at 'rails s' #122

coppolaf opened this issue Jul 22, 2016 · 57 comments
Assignees

Comments

@coppolaf
Copy link

guys,
when i start app in development mode i receive this deprecation warnings
actually all seems to run fine, but not production deployment tests have been done yet!!

=> Booting WEBrick
=> Rails 4.2.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block in <class:Railtie> at /home/francesco/.rvm/gems/ruby-2.2.2@crm_2016/bundler/gems/less-rails-05186ebeea3a/lib/less/rails/railtie.rb:16)
DEPRECATION WARNING: You are using the a deprecated processor interface Less::Rails::ImportProcessor.
Please update your processor interface:
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block in <class:Railtie> at /home/francesco/.rvm/gems/ruby-2.2.2@crm_2016/bundler/gems/less-rails-05186ebeea3a/lib/less/rails/railtie.rb:21)
[2016-07-22 11:24:33] INFO  WEBrick 1.3.1
[2016-07-22 11:24:33] INFO  ruby 2.2.2 (2015-04-13) [x86_64-linux]
[2016-07-22 11:24:33] INFO  WEBrick::HTTPServer#start: pid=22380 port=3000

i think something is running bad during initialization against sprocket v.3.7.0...
available to give you more info if needed....

waiting your suggestions

regards
francesco

@pauloschilling
Copy link

Same problem already solved on sass-rails gem: rails/sass-rails#381

Diff: rails/sass-rails@v5.0.5...v5.0.6

✌️

@simi simi self-assigned this Jul 23, 2016
@jonbcampos
Copy link

jonbcampos commented Jul 24, 2016

+1

@coppolaf
Copy link
Author

i've seen simi has self-assigned this issue..
supposing he's working on....
i'll remain available for any other info may be useful!

bye,
francesco

@simi
Copy link
Collaborator

simi commented Jul 24, 2016

Yup, I'm fighting Rails 5 support removing this deprecation message in https://github.com/metaskills/less-rails/tree/rails5 branch. Not ready yet.

@coppolaf
Copy link
Author

thank you for your time!!!
waiting!!

bye
francesco

@ronwsmith
Copy link

+1

@felipero
Copy link

felipero commented Aug 6, 2016

Just to help others, I'm using the branch rails5 and still get the warnings:

DEPRECATION WARNING: Sprockets method register_engineis deprecated. Please register a mime type usingregister_mime_typethen useregister_compressororregister_transformer. https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors (called from block in <class:Railtie> at /Users/felipero/.rvm/gems/ruby-2.3.1@and1analytics/bundler/gems/less-rails-2b251787fc69/lib/less/rails/railtie.rb:16) DEPRECATION WARNING: You are using the a deprecated processor interface Less::Rails::ImportProcessor. Please update your processor interface: https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors (called from block in <class:Railtie> at /Users/felipero/.rvm/gems/ruby-2.3.1@and1analytics/bundler/gems/less-rails-2b251787fc69/lib/less/rails/railtie.rb:21)

@coppolaf
Copy link
Author

coppolaf commented Aug 6, 2016

@felipero
as you can see...
@simi is still working on this issue, i thinkwhen he'll solve on rails5 branch, the same fix may be applied to the master one!!
we're all waiting!

bye
francesco

@vernondegoede
Copy link

Any update on this one @simi ?

@ayushlodhi11
Copy link

+1

@simi
Copy link
Collaborator

simi commented Aug 26, 2016

I have something prepared. But I can't reach all Sprockets compatibility. I think new version dropping older version of Sprockets will be easy way how to solve this, but it will force users to update Sprockets for older rails. I'm still thinking how to solve this.

Any ideas?

@coppolaf
Copy link
Author

@simi,

I'll try something this weekend if my family duties will permit....
Not sure to be able but i'll try and keep you updated!!!

Regards
Francesco

@coppolaf
Copy link
Author

PS: May you give me a preview of your changes into init routine?!?
This May sure be helpful!!

@simi
Copy link
Collaborator

simi commented Aug 26, 2016

@coppolaf it is in rails5 branch. Latest commit is WIP. I'll probably need to study Sprockets to be able to rewrite LessTemplate to use new Sprockets API instead of Tilt template API.

@coppolaf
Copy link
Author

Ok...
I'll try to look at your code...

Bye

Francesco

Il 26/ago/2016 09:54 PM, "Josef Šimánek" notifications@github.com ha
scritto:

@coppolaf https://github.com/coppolaf it is in rails5 branch. Latest
commit is WIP. I'll probably need to study Sprockets to be able to rewrite
LessTemplate to use new Sprockets API instead of Tilt template API.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#122 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG_wheeojRiIYJnwaxt4zWmSjdnFBTqFks5qj0RygaJpZM4JSl3Z
.

@coppolaf
Copy link
Author

Josef,

done some testing....

using 'raw' your code, i receive an error (see:
#123)

the pull request author (manzikhov) has revealed the same issue and
proposed a fix for it...

here you'll find my version,

#124

feel free to choose the one you evaluate more flexible (extracted from
railtie.rb):

unable to actually find solution to the second deprecation warning....

bye

francesco

On 26/08/2016 21:54, Josef Šimánek wrote:

@coppolaf https://github.com/coppolaf it is in rails5 branch. Latest
commit is WIP. I'll probably need to study Sprockets to be able to
rewrite |LessTemplate| to use new Sprockets API instead of Tilt
template API.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#122 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG_wheeojRiIYJnwaxt4zWmSjdnFBTqFks5qj0RygaJpZM4JSl3Z.

@simi
Copy link
Collaborator

simi commented Aug 30, 2016

Thanks a lot! I'll inspect this tomorrow and let you know.

@coppolaf
Copy link
Author

Ok...
Keep me updated!!

Good night!!

F.

Il 30/ago/2016 11:09 PM, "Josef Šimánek" notifications@github.com ha
scritto:

Thanks a lot! I'll inspect this tomorrow and let you know.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#122 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG_whWD-WBlPUnV-GwUN64cNoo1jo48xks5qlJv7gaJpZM4JSl3Z
.

@coppolaf
Copy link
Author

coppolaf commented Sep 7, 2016

Josef,

Have you inspected my code?!
I think i've omitted the rspec related part so it will fail testing
phase... Actually using my modded version in my development env (other
app!!) Waiting your definitive release!!

Pls let me know your opinion about the solution i've applied to solve the
first deprecation warning!!

Waiting news...
Regards

Francesco

Il 30/ago/2016 11:09 PM, "Josef Šimánek" notifications@github.com ha
scritto:

Thanks a lot! I'll inspect this tomorrow and let you know.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#122 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG_whWD-WBlPUnV-GwUN64cNoo1jo48xks5qlJv7gaJpZM4JSl3Z
.

@simi
Copy link
Collaborator

simi commented Sep 8, 2016

Damn, I totally forgot about this. I'm really busy right now, but I'll do my best to take a look A$AP.

maybe @maxd is around

@coppolaf
Copy link
Author

coppolaf commented Sep 8, 2016

No problem... As i said i've not implementeranno any testing so build test
by travis-ci will fail!!!

Waiting news!!
Regards

Francesco

Il 08/set/2016 12:47 PM, "Josef Šimánek" notifications@github.com ha
scritto:

Damn, I totally forgot about this. I'm really busy right now, but I'll do
my best to take a look A$AP.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#122 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG_whaWcSVkqdxYepAlT98QlT0IY9jeyks5qn-e7gaJpZM4JSl3Z
.

@dawcars
Copy link

dawcars commented Sep 21, 2016

What is the status of this? I have this issue too.

Thanks
Carol

@poombavai
Copy link

Is this issue solved?

@USvER
Copy link

USvER commented Sep 27, 2016

Why it's so hard to fix? Something strange =\

yohm added a commit to crest-cassia/oacis that referenced this issue Sep 29, 2016
@yohm
Copy link

yohm commented Sep 29, 2016

For the time being, the issue is avoided by adding gem "sprockets", '3.6.3' to Gemfile.

@krtschmr
Copy link

krtschmr commented Oct 21, 2016

still a thing.

gem "sprockets", '3.6.3'

fixed the problem, but if you use 3.7 the same problem occurs.

@brendon
Copy link
Contributor

brendon commented May 29, 2017

@simi, would you mind looking at #137 for me? Travis is still running but fingers crossed. I might need to update the .travis.yml to bring the rubies up to date.

@brendon
Copy link
Contributor

brendon commented May 30, 2017

Hi everyone, just wondering if you could test this fork to see if it fixes your deprecation errors: https://github.com/brendon/less-rails/tree/fix-sprockets-loading. It should support Sprockets 2, 3, and 4 though looking at the .gemspec it looks like it's currently locked to 3.x.

@tmking
Copy link

tmking commented May 30, 2017

@brendon I can confirm that this fix completely removes the warnings for me.

@tmking
Copy link

tmking commented May 30, 2017

@brendon upon further investigation, I've found that running my application with less-rails pointing to your fork results in a slew of parser errors. I have not had an opportunity to figure out why but I thought you might want to be alerted.

@brendon
Copy link
Contributor

brendon commented May 30, 2017

Thanks @tmking. That's interesting. If you could give me some more details that would be helpful.

@tmking
Copy link

tmking commented May 31, 2017

@brendon what happened was that the majority of my feature specs threw a Less::ParserError because of an undefined variable. Other specs failed because of a Sprockets::FileNotFound exception. The app threw the same Less::ParseError exception when accessed normally in the browser.

I briefly looked into upgrading libv8 to a more recent version but my app also uses therubyracer, which has a dependency on libv8 ~> 3.16.14.15. I did confirm that everything works as expected when the gem is pointed to the master branch.

By the way, the app is running on Rails 4.2.7 and Ruby 2.2.5.

@brendon
Copy link
Contributor

brendon commented May 31, 2017

Yes that's strange. Can you grab my fork and branch locally then try removing the Grease wrapper around the Template and Processor. Try one at a time. Grease.apply(LessTemplate).

Use the local copy in your app and see if it stops failing at any point. You'll probably still get the deprecation warnings but hopefully we can track down which exact change is causing problems.

@tmking
Copy link

tmking commented Jun 5, 2017

@brendon I think the issue is that the variable is defined in a .less.erb file. It looks like a separate transformer needs to be registered for processing erb.

@brendon
Copy link
Contributor

brendon commented Jun 5, 2017

Ah yes, I think the reason for tilt was so that all the various use cases would be handled automatically. I think in Sprockets 3/4 we need to say what we support explicitly. I'll look into this some more. Can people ping in with what they use with less? I'd assume probably only erb?

@brendon
Copy link
Contributor

brendon commented Jun 14, 2017

Ok, I've added .less.erb as a mime type and changed to use register_transformer instead of preprocessor. Can you let me know how that works for you? I've updated the branch. @simi, I'd really appreciate it if you could chime in at this point as to the possibility of this being merged. :)

@jyfcrw
Copy link

jyfcrw commented Jun 15, 2017

Hey, guys. Here is my code to solve the "deprecated processor interface Less::Rails::ImportProcessor" warning.

For my case,
sprockets (3.7.1)
Rails (5.0.2)

CODE IS BELOW

module Less  
  module Rails    
    class ImportProcessor < Tilt::Template
      
      IMPORT_SCANNER = /@import\s*['"]([^'"]+)['"]\s*;/.freeze
      PATHNAME_FINDER = Proc.new { |scope, path| 
        begin
          scope.resolve(path)
        rescue Sprockets::FileNotFound
          nil
        end
      }
      
      def prepare
      end
      
      def evaluate(scope, locals, &block)
        self.class.depend_on scope, data
        data
      end

      def self.call(input)
        scope = Sprockets::Context.new(input)
        data  = input[:data]
        self.depend_on scope, data
      end

      def self.depend_on(scope, data, base=File.dirname(scope.logical_path))
        import_paths = data.scan(IMPORT_SCANNER).flatten.compact.uniq
        import_paths.each do |path|
          pathname = PATHNAME_FINDER.call(scope, path) || PATHNAME_FINDER.call(scope, File.join(base, path))
          scope.depend_on(pathname) if pathname && pathname.to_s.ends_with?('.less')
          self.depend_on(scope, File.read(pathname), File.dirname(path)) if pathname
        end
        data
      end
    end
  end
end

You should do monkey patch, whatever. or see use https://github.com/jyfcrw/less-rails

@tmking
Copy link

tmking commented Jun 17, 2017

@brendon that change worked for me. All my specs are passing now and the deprecation warnings are gone.

@brendon
Copy link
Contributor

brendon commented Jun 18, 2017

Thanks @tmking, I think we just have to wait on @simi now :)

@brendon
Copy link
Contributor

brendon commented Jun 28, 2017

Does anyone have any ideas on what we can do to move this along if @simi and @maxd aren't able to assist. I suppose we'd have to fork the gem and try to direct people to use that instead? Seems a shame, but there's not much that can be done if we can't get PR's accepted here.

@dangerous
Copy link

Not sure about the history of the project but this is @metaskills ' repo, right? Maybe he can merge?

@simi
Copy link
Collaborator

simi commented Jun 30, 2017

Hello. Sorry for lack of my response.

Is there any patch solving this deprecation for all supported Sprockets versions?

Or maybe we can drop old Sprockets support. I'm not sure how to proceed here.

@brendon
Copy link
Contributor

brendon commented Jul 1, 2017

Hi @simi, please check out this PR: #137. It solves the deprecation for versions 2 and 3. Version 4 of sprockets hasn't actually be released yet. The test suite currently fails on 4beta but it more because of changes to the manifest logic and accessing assets for testing purposes. Someone here has reported it works with sprockets 4 in a project I think. My PR supports both the old and new sprockets methods.

joe4dev added a commit to sealuzh/cloud-workbench that referenced this issue Jul 11, 2017
`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'
@StanBoyet
Copy link

I've been following this for the past 6 months. Can I do anything to help?

@brendon
Copy link
Contributor

brendon commented Jul 25, 2017

Unfortunately, it all rests on @simi now to review my PR and hopefully accept it. You could try using my fork to see if everything works correctly for you (css code is generated correctly etc...) in the meantime.

@simi
Copy link
Collaborator

simi commented Jul 26, 2017

@brendon nice work. I left few comments in your PR. I'm ready to merge and release and to finally close this issue.

@StanBoyet I'm sorry, but I had no time to fix this (I tried 3 times already) and I was waiting for PR aiming on both 2 and 3 Sprockets version.

@StanBoyet
Copy link

@simi I don't add anything to the conversation but I'd like to add: don't get me wrong, I'm really grateful for your work and all the contributors. I don't like coming in here without bringing anything to the table, hence the proposition to help.

Glad to see an end to it though. Thanks again ;-)

@simi simi closed this as completed in #137 Oct 1, 2017
davidlaprade added a commit to davidlaprade/twitter-bootstrap-rails that referenced this issue Feb 20, 2018
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.
joe4dev added a commit to sealuzh/cloud-workbench that referenced this issue Aug 16, 2018
`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'
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

No branches or pull requests