Mark more Precious::App internal methods as private
This commit is contained in:
+19
-20
@@ -93,26 +93,6 @@ module Precious
|
|||||||
redirect clean_url(::File.join(@base_url, @page_dir, wiki_new.index_page))
|
redirect clean_url(::File.join(@base_url, @page_dir, wiki_new.index_page))
|
||||||
end
|
end
|
||||||
|
|
||||||
# path is set to name if path is nil.
|
|
||||||
# if path is 'a/b' and a and b are dirs, then
|
|
||||||
# path must have a trailing slash 'a/b/' or
|
|
||||||
# extract_path will trim path to 'a'
|
|
||||||
# name, path, version
|
|
||||||
def wiki_page(name, path = nil, version = nil, exact = true)
|
|
||||||
wiki = wiki_new
|
|
||||||
path = name if path.nil?
|
|
||||||
name, ext = extract_name(name) || wiki.index_page
|
|
||||||
path = extract_path(path)
|
|
||||||
path = '/' if exact && path.nil?
|
|
||||||
|
|
||||||
OpenStruct.new(:wiki => wiki, :page => wiki.paged(join_page_name(name, ext), path, exact, version),
|
|
||||||
:name => name, :path => path, :ext => ext)
|
|
||||||
end
|
|
||||||
|
|
||||||
def wiki_new
|
|
||||||
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/last-commit-info' do
|
get '/last-commit-info' do
|
||||||
content_type :json
|
content_type :json
|
||||||
if page = wiki_page(params[:path]).page
|
if page = wiki_page(params[:path]).page
|
||||||
@@ -534,6 +514,25 @@ module Precious
|
|||||||
wiki.update_page(page, name, format, content.to_s, commit)
|
wiki.update_page(page, name, format, content.to_s, commit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# path is set to name if path is nil.
|
||||||
|
# if path is 'a/b' and a and b are dirs, then
|
||||||
|
# path must have a trailing slash 'a/b/' or
|
||||||
|
# extract_path will trim path to 'a'
|
||||||
|
def wiki_page(name, path = nil, version = nil, exact = true)
|
||||||
|
wiki = wiki_new
|
||||||
|
path = name if path.nil?
|
||||||
|
name, ext = extract_name(name) || wiki.index_page
|
||||||
|
path = extract_path(path)
|
||||||
|
path = '/' if exact && path.nil?
|
||||||
|
|
||||||
|
OpenStruct.new(:wiki => wiki, :page => wiki.paged(join_page_name(name, ext), path, exact, version),
|
||||||
|
:name => name, :path => path, :ext => ext)
|
||||||
|
end
|
||||||
|
|
||||||
|
def wiki_new
|
||||||
|
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||||
|
end
|
||||||
|
|
||||||
# Options parameter to Gollum::Committer#initialize
|
# Options parameter to Gollum::Committer#initialize
|
||||||
# :message - The String commit message.
|
# :message - The String commit message.
|
||||||
# :name - The String author full name.
|
# :name - The String author full name.
|
||||||
|
|||||||
Reference in New Issue
Block a user