gollum.rb 865 Bytes
Newer Older
1
module Gollum
Douwe Maan's avatar
Douwe Maan committed
2
  GIT_ADAPTER = "rugged".freeze
3 4 5 6 7 8 9 10 11 12
end
require "gollum-lib"

module Gollum
  class Committer
    # Patch for UTF-8 path
    def method_missing(name, *args)
      index.send(name, *args)
    end
  end
Francisco Lopez's avatar
Francisco Lopez committed
13 14 15 16 17 18 19 20 21 22 23

  class Wiki
    def pages(treeish = nil, limit: nil)
      tree_list((treeish || @ref), limit: limit)
    end

    def tree_list(ref, limit: nil)
      if (sha = @access.ref_to_sha(ref))
        commit = @access.commit(sha)
        tree_map_for(sha).inject([]) do |list, entry|
          next list unless @page_class.valid_page_name?(entry.name)
24

Francisco Lopez's avatar
Francisco Lopez committed
25 26
          list << entry.page(self, commit)
          break list if limit && list.size >= limit
27

Francisco Lopez's avatar
Francisco Lopez committed
28 29 30 31 32 33 34 35 36 37 38 39 40
          list
        end
      else
        []
      end
    end
  end
end

Rails.application.configure do
  config.after_initialize do
    Gollum::Page.per_page = Kaminari.config.default_per_page
  end
41
end