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
|
# => :markdown
|
||||||
|
|
||||||
vsn = page.version
|
vsn = page.version
|
||||||
# => <Gollum::Version>
|
# => <Grit::Commit>
|
||||||
|
|
||||||
vsn.id
|
vsn.id
|
||||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
# => '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:
|
Get a list of versions for a given page:
|
||||||
|
|
||||||
vsns = gollum.page('page-name').versions
|
vsns = gollum.page('page-name').versions
|
||||||
# => [<Gollum::Version, <Gollum::Version, <Gollum::Version>]
|
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
|
||||||
|
|
||||||
vsns.first.id
|
vsns.first.id
|
||||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ require 'github/markup'
|
|||||||
# internal
|
# internal
|
||||||
require 'gollum/wiki'
|
require 'gollum/wiki'
|
||||||
require 'gollum/page'
|
require 'gollum/page'
|
||||||
require 'gollum/version'
|
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '0.0.1'
|
VERSION = '0.0.1'
|
||||||
|
|||||||
+3
-5
@@ -76,11 +76,9 @@ module Gollum
|
|||||||
|
|
||||||
# All of the versions that have touched this Page.
|
# All of the versions that have touched this Page.
|
||||||
#
|
#
|
||||||
# Returns an Array of Gollum::Version.
|
# Returns an Array of Grit::Commit.
|
||||||
def versions
|
def versions
|
||||||
@wiki.repo.log('master', self.path).map do |v|
|
@wiki.repo.log('master', self.path)
|
||||||
Version.new(v)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find a page in the given Gollum repo.
|
# Find a page in the given Gollum repo.
|
||||||
@@ -91,7 +89,7 @@ module Gollum
|
|||||||
def find(name)
|
def find(name)
|
||||||
commit = self.wiki.repo.commits.first
|
commit = self.wiki.repo.commits.first
|
||||||
if page = find_page_in_tree(commit.tree, name)
|
if page = find_page_in_tree(commit.tree, name)
|
||||||
page.version = Version.new(commit)
|
page.version = commit
|
||||||
page
|
page
|
||||||
else
|
else
|
||||||
nil
|
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