# File lib/chef/run_context.rb, line 58
    def load
      foreach_cookbook_load_segment(:libraries) do |cookbook_name, filename|
        Chef::Log.debug("Loading cookbook #{cookbook_name}'s library file: #{filename}")
        require filename
      end
      
      foreach_cookbook_load_segment(:providers) do |cookbook_name, filename|
        Chef::Log.debug("Loading cookbook #{cookbook_name}'s providers from #{filename}")
        Chef::Provider.build_from_file(cookbook_name, filename)
      end
      
      foreach_cookbook_load_segment(:resources) do |cookbook_name, filename|
        Chef::Log.debug("Loading cookbook #{cookbook_name}'s resources from #{filename}")
        Chef::Resource.build_from_file(cookbook_name, filename)
      end

      node.load_attributes

      foreach_cookbook_load_segment(:definitions) do |cookbook_name, filename|
        Chef::Log.debug("Loading cookbook #{cookbook_name}'s definitions from #{filename}")
        resourcelist = Chef::ResourceDefinitionList.new
        resourcelist.from_file(filename)
        definitions.merge!(resourcelist.defines) do |key, oldval, newval|
          Chef::Log.info("Overriding duplicate definition #{key}, new found in #{filename}")
          newval
        end
      end

      # Retrieve the fully expanded list of recipes for the node by
      # resolving roles; this step also merges attributes into the
      # node from the roles/recipes included.
      recipe_names = node.expand!

      recipe_names.each do |recipe_name|
        # TODO: timh/cw, 5-14-2010: It's distasteful to be including
        # the DSL in a class outside the context of the DSL
        include_recipe(recipe_name)
      end
    end