Make wiki.page directory aware.

Remove scoped_page.
This commit is contained in:
bootstraponline
2012-07-31 23:22:17 -06:00
parent c1afa2a0e3
commit 2261cfabf3
2 changed files with 6 additions and 16 deletions
+4 -14
View File
@@ -189,26 +189,16 @@ module Gollum
@access.exist?
end
# Public: Get the formatted page for a given page name.
# Public: Get the formatted page for a given page name, version, and dir.
#
# name - The human or canonical String page name of the wiki page.
# version - The String version ID to find (default: @ref).
#
# Returns a Gollum::Page or nil if no matching page was found.
def page(name, version = @ref)
@page_class.new(self).find(name, version)
end
# Public: Get the formatted page for a given page name scoped to a
# directory.
#
# name - The human or canonical String page name of the wiki page.
# dir - The directory String relative to the repo.
# version - The String version ID to find (default: @ref).
#
# Returns a Gollum::Page or nil if no matching page was found.
def scoped_page(name, dir, version = @ref)
@page_class.new(self).find(name, version || @ref, dir)
def page(name, version = @ref, dir = nil)
version = @ref if version.nil?
@page_class.new(self).find(name, version, dir)
end
# Public: Get the static file for a given name.
+2 -2
View File
@@ -104,8 +104,8 @@ context "Wiki" do
index.add('Foobar/Elrond.md', 'Baz')
index.commit 'Add Foobar/Elrond.', [wiki.repo.commits.last], Grit::Actor.new('Tom Preston-Werner', 'tom@github.com')
assert_equal 'Rivendell/Elrond.md', wiki.scoped_page('Elrond', 'Rivendell').path
assert_equal 'Foobar/Elrond.md', wiki.scoped_page('Elrond', 'Foobar').path
assert_equal 'Rivendell/Elrond.md', wiki.page('Elrond', nil, 'Rivendell').path
assert_equal 'Foobar/Elrond.md', wiki.page('Elrond', nil, 'Foobar').path
ensure
FileUtils.rm_rf(@path)
end