return Grit::Commit objects instead of Gollum::Version
This commit is contained in:
@@ -245,7 +245,7 @@ Get the latest version of the given human or canonical page name:
|
||||
# => :markdown
|
||||
|
||||
vsn = page.version
|
||||
# => <Gollum::Version>
|
||||
# => <Grit::Commit>
|
||||
|
||||
vsn.id
|
||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||
@@ -253,7 +253,7 @@ Get the latest version of the given human or canonical page name:
|
||||
Get a list of versions for a given page:
|
||||
|
||||
vsns = gollum.page('page-name').versions
|
||||
# => [<Gollum::Version, <Gollum::Version, <Gollum::Version>]
|
||||
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
|
||||
|
||||
vsns.first.id
|
||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||
|
||||
@@ -5,7 +5,6 @@ require 'github/markup'
|
||||
# internal
|
||||
require 'gollum/wiki'
|
||||
require 'gollum/page'
|
||||
require 'gollum/version'
|
||||
|
||||
module Gollum
|
||||
VERSION = '0.0.1'
|
||||
|
||||
+3
-5
@@ -76,11 +76,9 @@ module Gollum
|
||||
|
||||
# All of the versions that have touched this Page.
|
||||
#
|
||||
# Returns an Array of Gollum::Version.
|
||||
# Returns an Array of Grit::Commit.
|
||||
def versions
|
||||
@wiki.repo.log('master', self.path).map do |v|
|
||||
Version.new(v)
|
||||
end
|
||||
@wiki.repo.log('master', self.path)
|
||||
end
|
||||
|
||||
# Find a page in the given Gollum repo.
|
||||
@@ -91,7 +89,7 @@ module Gollum
|
||||
def find(name)
|
||||
commit = self.wiki.repo.commits.first
|
||||
if page = find_page_in_tree(commit.tree, name)
|
||||
page.version = Version.new(commit)
|
||||
page.version = commit
|
||||
page
|
||||
else
|
||||
nil
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
module Gollum
|
||||
class Version
|
||||
attr_accessor :commit
|
||||
|
||||
def initialize(commit)
|
||||
self.commit = commit
|
||||
end
|
||||
|
||||
# The SHA1 commit ID.
|
||||
#
|
||||
# The String ID.
|
||||
def id
|
||||
self.commit.id
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user