Remove references to grit and stringex (#1482)
* Remove references to grit and stringex * Fix revert tests, fix revert commit message
This commit is contained in:
+3
-17
@@ -4,7 +4,6 @@ require 'sinatra'
|
||||
require 'sinatra/namespace'
|
||||
require 'gollum-lib'
|
||||
require 'mustache/sinatra'
|
||||
require 'stringex'
|
||||
require 'json'
|
||||
require 'sprockets'
|
||||
require 'sprockets-helpers'
|
||||
@@ -28,19 +27,6 @@ require File.expand_path '../helpers', __FILE__
|
||||
Gollum::set_git_timeout(120)
|
||||
Gollum::set_git_max_filesize(190 * 10**6)
|
||||
|
||||
# Use stringex #to_url only to leverage its #to_ascii method when using grit
|
||||
class String
|
||||
if Gollum::GIT_ADAPTER != 'grit'
|
||||
def to_ascii
|
||||
self # Do not transliterate utf-8 url's unless using Grit
|
||||
end
|
||||
end
|
||||
|
||||
def to_url
|
||||
to_ascii
|
||||
end
|
||||
end
|
||||
|
||||
# Run the frontend, based on Sinatra
|
||||
#
|
||||
# There are a number of wiki options that can be set for the frontend
|
||||
@@ -328,7 +314,7 @@ module Precious
|
||||
@template_page = (temppage.page != nil) ? temppage.page.raw_data : 'Template page option is set, but no /_Template page is present or committed.'
|
||||
end
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
@name = wikip.name.to_url
|
||||
@name = wikip.name
|
||||
@ext = wikip.ext
|
||||
@path = wikip.path
|
||||
@allow_uploads = wikip.wiki.allow_uploads
|
||||
@@ -347,7 +333,7 @@ module Precious
|
||||
end
|
||||
|
||||
post '/create' do
|
||||
name = params[:page].to_url
|
||||
name = params[:page]
|
||||
path = sanitize_empty_params(params[:path]) || ''
|
||||
format = params[:format].intern
|
||||
wiki = wiki_new
|
||||
@@ -374,7 +360,7 @@ module Precious
|
||||
sha2 = params[:sha2]
|
||||
|
||||
commit = commit_message
|
||||
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
|
||||
commit[:message] = "Revert commit #{sha2.chars.take(7).join}"
|
||||
if wiki.revert_page(@page, sha1, sha2, commit)
|
||||
redirect to("/#{@page.escaped_url_path}")
|
||||
else
|
||||
|
||||
+6
-9
@@ -474,12 +474,10 @@ context "Frontend" do
|
||||
assert last_response.body.include?('Could not compare these two revisions, no differences were found.')
|
||||
end
|
||||
|
||||
=begin
|
||||
# Grit is broken.
|
||||
test "reverts single commit" do
|
||||
page1 = @wiki.page('B')
|
||||
|
||||
post "/revert/B/7c45b5f16ff3bae2a0063191ef832701214d4df5"
|
||||
post "/gollum/revert/B.md/fc66539528eb96f21b2bbdbf557788fe8a1196ac/7c45b5f16ff3bae2a0063191ef832701214d4df5"
|
||||
follow_redirect!
|
||||
assert last_response.ok?
|
||||
|
||||
@@ -487,13 +485,13 @@ context "Frontend" do
|
||||
page2 = @wiki.page('B')
|
||||
assert_not_equal page1.version.sha, page2.version.sha
|
||||
assert_equal "INITIAL", page2.raw_data.strip
|
||||
# assert_equal "Revert commit #7c45b5f", page2.version.message
|
||||
assert_equal "Revert commit 7c45b5f", page2.version.message
|
||||
end
|
||||
|
||||
test "reverts multiple commits" do
|
||||
page1 = @wiki.page('A')
|
||||
|
||||
post "/revert/A/fc66539528eb96f21b2bbdbf557788fe8a1196ac/b26b791cb7917c4f37dd9cb4d1e0efb24ac4d26f"
|
||||
post "/gollum/revert/A.md/fc66539528eb96f21b2bbdbf557788fe8a1196ac/b26b791cb7917c4f37dd9cb4d1e0efb24ac4d26f"
|
||||
follow_redirect!
|
||||
assert last_response.ok?
|
||||
|
||||
@@ -502,19 +500,18 @@ context "Frontend" do
|
||||
assert_not_equal page1.version.sha, page2.version.sha
|
||||
assert_equal "INITIAL", page2.raw_data.strip
|
||||
end
|
||||
=end
|
||||
=begin
|
||||
|
||||
test "cannot revert conflicting commit" do
|
||||
page1 = @wiki.page('A')
|
||||
|
||||
post "/revert/A/302a5491a9a5ba12c7652ac831a44961afa312d2"
|
||||
post "/gollum/revert/A.md/fc66539528eb96f21b2bbdbf557788fe8a1196ac/302a5491a9a5ba12c7652ac831a44961afa312d2"
|
||||
assert last_response.ok?
|
||||
|
||||
@wiki.clear_cache
|
||||
page2 = @wiki.page('A')
|
||||
assert_equal page1.version.sha, page2.version.sha
|
||||
end
|
||||
=end
|
||||
|
||||
=begin
|
||||
# redirects are now handled by class MapGollum in bin/gollum
|
||||
# they should be set in config.ru
|
||||
|
||||
@@ -91,8 +91,8 @@ context "Frontend Unicode support" do
|
||||
# we transliterate only when adapter is grit
|
||||
return if defined?(Gollum::GIT_ADAPTER) && Gollum::GIT_ADAPTER != 'grit'
|
||||
|
||||
@wiki.write_page("ééééé".to_url, :markdown, '한글 text', { :name => '', :email => '' })
|
||||
page = @wiki.page("eeeee".to_url)
|
||||
@wiki.write_page("ééééé", :markdown, '한글 text', { :name => '', :email => '' })
|
||||
page = @wiki.page("eeeee")
|
||||
assert_equal '한글 text', utf8(page.raw_data)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user