def callback(what, callback_code=nil)
@collection = Chef::ResourceCollection.new
case callback_code
when Proc
Chef::Log.info "Running callback #{what} code block"
recipe_eval(&callback_code)
when String
callback_file = "#{release_path}/#{callback_code}"
unless ::File.exist?(callback_file)
raise RuntimeError, "Can't find your callback file #{callback_file}"
end
run_callback_from_file(callback_file)
when nil
run_callback_from_file("#{release_path}/deploy/#{what}.rb")
else
raise RuntimeError, "You gave me a callback I don't know what to do with: #{callback_code.inspect}"
end
end