Rykian / clockwork

A scheduler process to replace cron.
MIT License
544 stars 66 forks source link

Miss-behavior using haml 5.0.4 and temple 0.8.0 #39

Closed aledustet closed 6 years ago

aledustet commented 6 years ago

After my upgrade to rails 5.1 i am seeing this warning

DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <top (required)>

When i upgrade the haml gem the template handler changes and the deprecation warning with it but it brings the temple gem and with it this runtime error:

RuntimeError:
       Unsupported callback newline
gems/clockwork-2.0.2/lib/clockwork/manager.rb:44:in `on'
gems/clockwork-2.0.2/lib/clockwork.rb:38:in `on'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:86:in `dispatcher'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:49:in `compile'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:7:in `block in on_multi'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:7:in `each'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:7:in `on_multi'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:82:in `dispatcher'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:49:in `compile'
gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb:45:in `call'
gems/temple-0.8.0/lib/temple/engine.rb:50:in `block in call'
gems/temple-0.8.0/lib/temple/engine.rb:50:in `each'
gems/temple-0.8.0/lib/temple/engine.rb:50:in `inject'
gems/temple-0.8.0/lib/temple/engine.rb:50:in `call'
gems/haml-5.0.4/lib/haml/temple_engine.rb:41:in `compile'
gems/haml-5.0.4/lib/haml/engine.rb:61:in `initialize'

The callback method is also code. Here is the line that is throwing the error https://github.com/Rykian/clockwork/blob/v2.0.2/lib/clockwork/manager.rb#L44

aledustet commented 6 years ago

The issue was that the clock.rb files content was not 'namespaced':

include Clockwork
every(1.hour, ...
...

After moving it under the module the problem was solved:

module Clockwork
  every(1.hour, ...
end

I'm closing it 👍

jemminger commented 5 years ago

@aledustet I still get this error all the time, using clockwork 2.0.2, haml 5.0.4 and temple 0.8.0. Was this fixed anywhere?

aledustet commented 5 years ago

@jemminger I currently have

jemminger commented 5 years ago

@aledustet I upgraded to clockwork 2.0.3, still getting it:

RuntimeError: Unsupported callback newline (Most recent call first)

File /app/vendor/bundle/ruby/2.5.0/gems/clockwork-2.0.3/lib/clockwork/manager.rb line 44 in on
File /app/vendor/bundle/ruby/2.5.0/gems/clockwork-2.0.3/lib/clockwork.rb line 38 in on
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 86 in dispatcher
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 49 in compile
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 7 in block in on_multi
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 7 in each
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 7 in on_multi
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 84 in dispatcher
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 49 in compile
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/mixins/dispatcher.rb line 45 in call
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/engine.rb line 50 in block in call
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/engine.rb line 50 in each
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/engine.rb line 50 in inject
File /app/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/engine.rb line 50 in call
File /app/vendor/bundle/ruby/2.5.0/gems/haml-5.0.4/lib/haml/temple_engine.rb line 41 in compile
File /app/vendor/bundle/ruby/2.5.0/gems/haml-5.0.4/lib/haml/engine.rb line 61 in initialize
File /app/vendor/bundle/ruby/2.5.0/gems/haml-5.0.4/lib/haml/plugin.rb line 16 in new
File /app/vendor/bundle/ruby/2.5.0/gems/haml-5.0.4/lib/haml/plugin.rb line 16 in compile
File /app/vendor/bundle/ruby/2.5.0/gems/haml-5.0.4/lib/haml/plugin.rb line 23 in call