Depending on load order, you might be including your module into an anonymous Ruby class instead of what you think.
If you want to use your method in a recipe, do this at the top of your recipe:
include AppHelper
You could alternatively use :send
at the end of your library:
Chef::Recipe.send(:include, AppHelper)
This is different because it will raise an exception if Chef::Recipe
is not defined (whereas you are creating a new class if it doesn't exist).
That's all you should need to do unless you want to use the helper in not_if
and only_if
guards. Then you need to include the helper in the resource:
Chef::Resource.send(:include, AppHelper)
Okay, now that I explained all of that, it won't actually help you. The Ruby Block provider simply calls the block - it doesn't instance eval it. So including the helper in the resource doesn't do anything.
So, you'll need to use a singleton object in this instance (it's the only solution I can reliably think of). The way you've defined your method, you can call it directly from the global namespace:
AppHelper.find_gem('...')
So:
ruby_block "find gem" do
block do
gem_bin = AppHelper.find_gem('...')
end
end