class Middleman::Sitemap::Extensions::OnDisk

def before_configuration

def before_configuration
  app.files.on_change(:source, &method(:update_files))
end

def files_for_sitemap

def files_for_sitemap
  @app.files.by_type(:source).files.reject(&method(:ignored?))
end

def ignored?(file)

def ignored?(file)
  @app.config[:ignored_sitemap_matchers].any? do |_, callback|
    callback.call(file, @app)
  end
end

def initialize(app, config={}, &block)

def initialize(app, config={}, &block)
  super
  @file_paths_on_disk = Set.new
  @waiting_for_ready = true
end

def manipulate_resource_list(resources)

def manipulate_resource_list(resources)
  resources + files_for_sitemap.map do |file|
    ::Middleman::Sitemap::Resource.new(
      @app.sitemap,
      @app.sitemap.file_to_path(file),
      file
    )
  end
end

def ready

def ready
  @waiting_for_ready = false
  # Make sure the sitemap is ready for the first request
  app.sitemap.ensure_resource_list_updated!
end

def update_files(updated_files, removed_files)

def update_files(updated_files, removed_files)
  return if (updated_files + removed_files).all?(&method(:ignored?))
  # Rebuild the sitemap any time a file is touched
  # in case one of the other manipulators
  # (like asset_hash) cares about the contents of this file,
  # whether or not it belongs in the sitemap (like a partial)
  @app.sitemap.rebuild_resource_list!(:touched_file)
  # Force sitemap rebuild so the next request is ready to go.
  # Skip this during build because the builder will control sitemap refresh.
  @app.sitemap.ensure_resource_list_updated! unless @waiting_for_ready || @app.build?
end