implement Page.version

This commit is contained in:
Tom Preston-Werner
2010-04-11 11:32:09 -06:00
parent c37204e42a
commit 6c1b65158a
3 changed files with 9 additions and 2 deletions
+1
View File
@@ -5,6 +5,7 @@ require 'github/markup'
# internal
require 'gollum/wiki'
require 'gollum/page'
require 'gollum/version'
module Gollum
VERSION = '0.0.1'
+7 -2
View File
@@ -2,7 +2,7 @@ module Gollum
class Page
VALID_PAGE_RE = /^(.+)\.(md|mkdn?|mdown|markdown|textile|rdoc|org|re?st(\.txt)?|asciidoc|pod|\d)$/i
attr_accessor :wiki, :blob
attr_accessor :wiki, :blob, :version
# Initialize a page.
#
@@ -79,7 +79,12 @@ module Gollum
# Returns a Gollum::Page or nil if the page could not be found.
def find(name)
commit = self.wiki.repo.commits.first
find_page_in_tree(commit.tree, name)
if page = find_page_in_tree(commit.tree, name)
page.version = Version.new(commit)
page
else
nil
end
end
# private