module Chef::Mixin::NotifyingBlock

def notifying_block(&block)

def notifying_block(&block)
  subcontext = subcontext_block(&block)
  Chef::Runner.new(subcontext).converge
ensure
  # recipes don't have a new_resource
  if respond_to?(:new_resource)
    if subcontext && subcontext.resource_collection.any?(&:updated?)
      new_resource.updated_by_last_action(true)
    end
  end
end

def subcontext_block(parent_context = nil, &block)

def subcontext_block(parent_context = nil, &block)
  parent_context ||= @run_context
  sub_run_context = parent_context.create_child
  begin
    outer_run_context = @run_context
    @run_context = sub_run_context
    instance_eval(&block)
  ensure
    @run_context = outer_run_context
  end
  sub_run_context
end