Merge branch 'master' of github.com:github/gollum

This commit is contained in:
eston
2011-01-18 22:59:51 -08:00
28 changed files with 451 additions and 192 deletions
+15 -11
View File
@@ -44,7 +44,7 @@ module Precious
get '/edit/*' do
@name = params[:splat].first
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(@name)
@page = page
@content = page.raw_data
@@ -55,11 +55,11 @@ module Precious
end
post '/edit/*' do
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
page = wiki.page(params[:splat].first)
name = params[:rename] || page.name
msg = commit_message
update_wiki_page(wiki, page, params[:content], msg, name,
update_wiki_page(wiki, page, params[:content], msg, name,
params[:format])
update_wiki_page(wiki, page.footer, params[:footer], msg) if params[:footer]
update_wiki_page(wiki, page.sidebar, params[:sidebar], msg) if params[:sidebar]
@@ -69,7 +69,7 @@ module Precious
post '/create' do
name = params[:page]
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
format = params[:format].intern
@@ -83,7 +83,7 @@ module Precious
end
post '/revert/:page/*' do
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = params[:page]
@page = wiki.page(@name)
shas = params[:splat].first.split("/")
@@ -103,7 +103,7 @@ module Precious
end
post '/preview' do
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
@@ -112,7 +112,7 @@ module Precious
get '/history/:name' do
@name = params[:name]
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@page = wiki.page(@name)
@page_num = [params[:page].to_i, 1].max
@versions = @page.versions :page => @page_num
@@ -134,16 +134,20 @@ module Precious
get '/compare/:name/:version_list' do
@name = params[:name]
@versions = params[:version_list].split(/\.{2,3}/)
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@page = wiki.page(@name)
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
mustache :compare
end
get %r{^/(javascript|css|images)} do
halt 404
end
get %r{/(.+?)/([0-9a-f]{40})} do
name = params[:captures][0]
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(name, params[:captures][1])
@page = page
@name = name
@@ -156,7 +160,7 @@ module Precious
get '/search' do
@query = params[:q]
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@results = wiki.search @query
@name = @query
mustache :search
@@ -167,7 +171,7 @@ module Precious
end
def show_page_or_file(name)
wiki = Gollum::Wiki.new(settings.gollum_path)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(name)
@page = page
@name = name