Skip to content

Instantly share code, notes, and snippets.

@jmettraux
Last active January 7, 2020 08:59
Show Gist options
  • Save jmettraux/e81d703e6cd9701c55d5229f93904d6c to your computer and use it in GitHub Desktop.
Save jmettraux/e81d703e6cd9701c55d5229f93904d6c to your computer and use it in GitHub Desktop.
flor hook vs require:
-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch
+ error in Flor::Scheduler#notify
#<NameError: uninitialized constant Flor::PoloZeroHook>
/Users/jmettraux/w/flor/lib/flor/unit/hook.rb:106:in `instantiate'
/Users/jmettraux/w/flor/lib/flor/unit/hook.rb:67:in `class_to_hook'
/Users/jmettraux/w/flor/lib/flor/unit/hook.rb:18:in `to_hook'
/Users/jmettraux/w/flor/lib/flor/core/executor.rb:131:in `collect'
/Users/jmettraux/w/flor/lib/flor/core/executor.rb:131:in `traps_and_hooks'
/Users/jmettraux/w/flor/lib/flor/unit/hooker.rb:65:in `notify'
/Users/jmettraux/w/flor/lib/flor/unit/scheduler.rb:385:in `notify'
/Users/jmettraux/w/flor/lib/flor/core/executor.rb:455:in `process'
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:75:in `block in do_run'
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:63:in `times'
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:63:in `do_run'
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:36:in `block in run'
-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch .
describe 'hooks' do
before :each do
FileUtils.mkdir('envs/test/lib/hooks/polo')
File.open('envs/test/lib/hooks/polo/zero.rb', 'wb') do |f|
f.write(%{
class PoloZeroHook
def on(message)
message['hello'] = 'world'
[] # return empty list of new messages
end
end
})
end
File.open('envs/test/lib/hooks/hooks.json', 'wb') do |f|
f.write(%{
[
{ point: terminated, consumed: true, require: 'polo/zero.rb', class: 'PoloZeroHook' }
]
})
end
end
after :each do
FileUtils.rm_rf('envs/test/lib/hooks/polo')
FileUtils.rm_f('envs/test/lib/hooks/hooks.json')
end
they 'may be placed under <env>/lib/hooks' do
r =
@unit.launch(
%{
sequence
_
},
wait: true)
pp r
expect(r).to have_terminated_as_point
expect(i.counter).to eq(10)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment