Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 714985e377 | |||
| 76c37dce96 | |||
| 5a9af40058 | |||
| e871ff35b7 | |||
| ecc6c32933 | |||
| 831cf61a08 | |||
| cc1231dece | |||
| bb3d1a165b | |||
| 3da0426c54 | |||
| e01aa25be3 | |||
| ee2f9d8dcb | |||
| 4d8677965c | |||
| 72729d5510 | |||
| 0b57e70c87 | |||
| 033d6489f8 | |||
| 8608007337 | |||
| 665e493570 | |||
| eb1e2f60f3 | |||
| dc637f0a9b | |||
| f81634728d | |||
| 440cd5ebc0 | |||
| 1cd7d0f205 | |||
| a69d62911c | |||
| 395e9bd006 | |||
| 90e20810d5 |
@@ -1,4 +1,6 @@
|
||||
rvm:
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install libicu-dev
|
||||
+2
-2
@@ -146,7 +146,7 @@ if options['irb']
|
||||
begin
|
||||
require 'gollum-lib'
|
||||
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
|
||||
if !wiki.exist? then raise Grit::InvalidGitRepositoryError end
|
||||
if !wiki.exist? then raise Gollum::InvalidGitRepositoryError end
|
||||
puts "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
|
||||
puts
|
||||
puts %( page = wiki.page('page-name'))
|
||||
@@ -160,7 +160,7 @@ if options['irb']
|
||||
puts
|
||||
puts "Check out the Gollum README for more."
|
||||
IRB.start_session(binding)
|
||||
rescue Grit::InvalidGitRepositoryError, Grit::NoSuchPathError
|
||||
rescue Gollum::InvalidGitRepositoryError, Gollum::NoSuchPathError
|
||||
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
|
||||
exit 0
|
||||
end
|
||||
|
||||
+8
-5
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = ">= 1.9"
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.5.0'
|
||||
s.date = '2013-07-21'
|
||||
s.version = '2.5.2'
|
||||
s.date = '2013-11-02'
|
||||
s.rubyforge_project = 'gollum'
|
||||
s.license = 'MIT'
|
||||
|
||||
@@ -24,10 +24,11 @@ Gem::Specification.new do |s|
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
s.extra_rdoc_files = %w[README.md LICENSE]
|
||||
|
||||
s.add_dependency 'gollum-lib', '~> 1.0.4'
|
||||
s.add_dependency 'sinatra', '~> 1.4.2'
|
||||
s.add_dependency 'gollum-lib', '~> 1.0.9'
|
||||
s.add_dependency 'github-markdown', '~> 0.5.5'
|
||||
s.add_dependency 'sinatra', '~> 1.4.3'
|
||||
s.add_dependency 'mustache', ['>= 0.99.4', '< 1.0.0']
|
||||
s.add_dependency 'useragent', '~> 0.6.0'
|
||||
s.add_dependency 'useragent', '~> 0.8.2'
|
||||
|
||||
s.add_development_dependency 'rack-test', '~> 0.6.2'
|
||||
s.add_development_dependency 'shoulda', ['>= 3.4.0', '< 3.5.0']
|
||||
@@ -529,6 +530,8 @@ Gem::Specification.new do |s|
|
||||
licenses/css_tree_menu_thecssninja/license.txt
|
||||
licenses/licenses.txt
|
||||
licenses/unity_asset_pool/COPYRIGHT
|
||||
openrc/conf.d/gollum
|
||||
openrc/init.d/gollum
|
||||
templates/formatting.html
|
||||
templates/helper_wiki.rb
|
||||
]
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ require 'digest/sha1'
|
||||
require 'ostruct'
|
||||
|
||||
# external
|
||||
require 'grit'
|
||||
require 'github/markup'
|
||||
require 'sanitize'
|
||||
|
||||
@@ -17,7 +16,7 @@ require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
||||
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
||||
|
||||
module Gollum
|
||||
VERSION = '2.5.0'
|
||||
VERSION = '2.5.2'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||
|
||||
+4
-5
@@ -14,8 +14,8 @@ require 'gollum/views/has_page'
|
||||
require File.expand_path '../helpers', __FILE__
|
||||
|
||||
#required to upload bigger binary files
|
||||
Grit::Git.git_timeout = 120 # timeout in secs
|
||||
Grit::Git.git_max_size = 190 * 10**6 # size in bytes (10^6=1 MB)
|
||||
Gollum::set_git_timeout(120)
|
||||
Gollum::set_git_max_filesize(190 * 10**6)
|
||||
|
||||
# Fix to_url
|
||||
class String
|
||||
@@ -23,7 +23,7 @@ class String
|
||||
# _Header => header which causes errors
|
||||
def to_url
|
||||
return nil if self.nil?
|
||||
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
|
||||
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar'], :force_downcase => false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -141,8 +141,7 @@ module Precious
|
||||
else
|
||||
@page = page
|
||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||
raw_data = page.raw_data
|
||||
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
|
||||
@content = page.text_data
|
||||
mustache :edit
|
||||
end
|
||||
else
|
||||
|
||||
@@ -95,13 +95,17 @@
|
||||
|
||||
var id = fieldAttributes.id || 'upload';
|
||||
var name = fieldAttributes.name || 'file';
|
||||
var action = fieldAttributes.action || 'uploadFile';
|
||||
var action = fieldAttributes.action || '/uploadFile';
|
||||
|
||||
html += '<form method=post enctype="multipart/form-data" ' +
|
||||
'action="' + action + '" ' + 'id="' + id + '">';
|
||||
html += '<input type=file name="' + name + '">';
|
||||
html += '</form>';
|
||||
|
||||
if( fieldAttributes.context ){
|
||||
html += '<span class="context">' + fieldAttributes.context + '</span>';
|
||||
}
|
||||
|
||||
return html;
|
||||
},
|
||||
|
||||
|
||||
@@ -154,7 +154,8 @@ $(document).ready(function() {
|
||||
title: 'Upload File',
|
||||
fields: [
|
||||
{
|
||||
type: 'file'
|
||||
type: 'file',
|
||||
context: 'Your uploaded file will be accessible at /uploads/[filename]'
|
||||
}
|
||||
],
|
||||
OK: function( res ) {
|
||||
@@ -171,7 +172,7 @@ $(document).ready(function() {
|
||||
|
||||
var path = pagePath();
|
||||
var oldName = pageName();
|
||||
var context_blurb =
|
||||
var context_blurb =
|
||||
"Renamed page will be under " +
|
||||
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
|
||||
" unless an absolute path is given."
|
||||
@@ -225,7 +226,7 @@ $(document).ready(function() {
|
||||
// For consistency remove the trailing /
|
||||
path = path.replace(/\/$/,'')
|
||||
}
|
||||
var context_blurb =
|
||||
var context_blurb =
|
||||
"Page will be created under " +
|
||||
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
|
||||
" unless an absolute path is given."
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<script>
|
||||
var baseUrl = '{{base_url}}';
|
||||
{{#page}}
|
||||
var pageFullPath = '{{url_path}}';
|
||||
var pageFullPath = '{{url_path_display}}';
|
||||
{{/page}}
|
||||
</script>
|
||||
<script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
# component must be String
|
||||
def encodeURIComponent(componentString)
|
||||
URI::URIEncodeComponent(componentString)
|
||||
::URI::URIEncodeComponent(componentString)
|
||||
end
|
||||
|
||||
# define charCodeAt on String
|
||||
|
||||
@@ -22,7 +22,7 @@ module Precious
|
||||
def header
|
||||
if @header.nil?
|
||||
if page = @page.header
|
||||
@header = page.raw_data
|
||||
@header = page.text_data
|
||||
else
|
||||
@header = false
|
||||
end
|
||||
@@ -33,7 +33,7 @@ module Precious
|
||||
def footer
|
||||
if @footer.nil?
|
||||
if page = @page.footer
|
||||
@footer = page.raw_data
|
||||
@footer = page.text_data
|
||||
else
|
||||
@footer = false
|
||||
end
|
||||
@@ -44,7 +44,7 @@ module Precious
|
||||
def sidebar
|
||||
if @sidebar.nil?
|
||||
if page = @page.sidebar
|
||||
@sidebar = page.raw_data
|
||||
@sidebar = page.text_data
|
||||
else
|
||||
@sidebar = false
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
GOLLUM_USER=gollum
|
||||
GOLLUM_BASE=/home/gollum/wiki
|
||||
GOLLUM_OPTS="--config /home/gollum/config.rb"
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/sbin/runscript
|
||||
# Distributed under the terms of the MIT License
|
||||
|
||||
NAME=gollum
|
||||
PID=/var/run/${NAME}.pid
|
||||
EXEC=/usr/local/bin/gollum
|
||||
LOG=/var/log/gollum.log
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
start() {
|
||||
# Change log file to be owned by GOLLUM_USER
|
||||
touch "${LOG}"
|
||||
chown "${GOLLUM_USER}" "${LOG}"
|
||||
|
||||
ebegin "Starting Gollum"
|
||||
start-stop-daemon --start \
|
||||
--name "${NAME}" \
|
||||
--user "${GOLLUM_USER}" \
|
||||
--pidfile "${PID}" \
|
||||
--make-pidfile --background \
|
||||
--stderr "${LOG}" \
|
||||
--exec "${EXEC}" -- $GOLLUM_OPTS "$GOLLUM_BASE"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping Gollum"
|
||||
start-stop-daemon --stop \
|
||||
--name "${NAME}" \
|
||||
--user "${GOLLUM_USER}" \
|
||||
--pidfile "${PID}"
|
||||
eend $?
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
class WikiFactory
|
||||
def self.create p
|
||||
path = testpath "examples/test.git"
|
||||
Grit::Repo.init_bare(@path)
|
||||
examples = testpath "examples"
|
||||
path = File.join(examples, "test.git")
|
||||
FileUtils.cp_r File.join(examples, "empty.git"), path, :remove_destination => true
|
||||
Gollum::Wiki.default_options = {:universal_toc => false}
|
||||
cleanup = Proc.new { FileUtils.rm_r File.join(File.dirname(__FILE__), *%w[examples test.git]) }
|
||||
Gollum::Wiki.new(@path), @path, cleanup
|
||||
|
||||
+26
-8
@@ -29,13 +29,13 @@ context "Frontend" do
|
||||
# spaces are converted to dashes in URLs
|
||||
# and in file names saved to disk
|
||||
# urls are not case sensitive
|
||||
assert_equal 'title-space', 'Title Space'.to_url
|
||||
assert_equal 'Title-Space', 'Title Space'.to_url
|
||||
|
||||
# ascii only file names prevent UTF8 issues
|
||||
# when using git repos across operating systems
|
||||
# as this test demonstrates, translation is not
|
||||
# great
|
||||
assert_equal 'm-plus-f', 'μ†ℱ'.to_url
|
||||
assert_equal 'm-plus-F', 'μ†ℱ'.to_url
|
||||
end
|
||||
|
||||
test "utf-8 kcode" do
|
||||
@@ -253,7 +253,7 @@ context "Frontend" do
|
||||
test "creates pages with escaped characters in title" do
|
||||
post "/create", :content => 'abc', :page => 'Title with spaces',
|
||||
:format => 'markdown', :message => 'foo'
|
||||
assert_equal 'http://example.org/title-with-spaces', last_response.headers['Location']
|
||||
assert_equal 'http://example.org/Title-with-spaces', last_response.headers['Location']
|
||||
get "/Title-with-spaces"
|
||||
assert_match /abc/, last_response.body
|
||||
end
|
||||
@@ -278,7 +278,7 @@ context "Frontend" do
|
||||
post "/create", :content => 'abc', :page => 'Home', :path => '/foo/',
|
||||
:format => 'markdown', :message => 'foo'
|
||||
|
||||
assert_equal "http://example.org/foo/home", last_response.headers['Location']
|
||||
assert_equal "http://example.org/foo/Home", last_response.headers['Location']
|
||||
|
||||
follow_redirect!
|
||||
assert last_response.ok?
|
||||
@@ -504,6 +504,24 @@ context "Frontend" do
|
||||
Precious::App.set(:wiki_options, { :js => nil })
|
||||
end
|
||||
|
||||
test "show edit page with header and footer and sidebar of multibyte" do
|
||||
post "/create",
|
||||
:content => 'りんご',
|
||||
:page => 'Multibyte', :format => :markdown, :message => 'mesg'
|
||||
|
||||
post "/edit/Multibyte",
|
||||
:content => 'りんご', :header => 'みかん', :footer => 'バナナ', :sidebar => 'スイカ',
|
||||
:page => 'Multibyte', :format => :markdown, :message => 'mesg'
|
||||
|
||||
get "edit/Multibyte"
|
||||
|
||||
assert last_response.ok?
|
||||
assert_match /りんご/, last_response.body
|
||||
assert_match /みかん/, last_response.body
|
||||
assert_match /バナナ/, last_response.body
|
||||
assert_match /スイカ/, last_response.body
|
||||
end
|
||||
|
||||
def app
|
||||
Precious::App
|
||||
end
|
||||
@@ -612,13 +630,13 @@ context "Frontend with lotr" do
|
||||
test "create pages within sub-directories" do
|
||||
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, scary'
|
||||
assert_equal 'http://example.org/Mordor/orc', last_response.headers['Location']
|
||||
assert_equal 'http://example.org/Mordor/Orc', last_response.headers['Location']
|
||||
get "/Mordor/Orc"
|
||||
assert_match /big smelly creatures/, last_response.body
|
||||
|
||||
post "/create", :content => 'really big smelly creatures', :page => 'Uruk Hai',
|
||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, very scary'
|
||||
assert_equal 'http://example.org/Mordor/uruk-hai', last_response.headers['Location']
|
||||
assert_equal 'http://example.org/Mordor/Uruk-Hai', last_response.headers['Location']
|
||||
get "/Mordor/Uruk-Hai"
|
||||
assert_match /really big smelly creatures/, last_response.body
|
||||
end
|
||||
@@ -627,11 +645,11 @@ context "Frontend with lotr" do
|
||||
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, scary'
|
||||
|
||||
assert_equal 'http://example.org/Mordor/orc', last_response.headers['Location']
|
||||
assert_equal 'http://example.org/Mordor/Orc', last_response.headers['Location']
|
||||
|
||||
post "/edit/Mordor/Orc", :content => 'not so big smelly creatures',
|
||||
:page => 'Orc', :path => 'Mordor', :message => 'minor edit'
|
||||
assert_equal 'http://example.org/Mordor/orc', last_response.headers['Location']
|
||||
assert_equal 'http://example.org/Mordor/Orc', last_response.headers['Location']
|
||||
|
||||
get "/Mordor/Orc"
|
||||
assert_match /not so big smelly creatures/, last_response.body
|
||||
|
||||
@@ -4,9 +4,9 @@ require File.expand_path '../../lib/gollum/views/page', __FILE__
|
||||
|
||||
context "Precious::Views::Page" do
|
||||
setup do
|
||||
@path = testpath("examples/test.git")
|
||||
FileUtils.rm_rf(@path)
|
||||
@repo = Grit::Repo.init_bare(@path)
|
||||
examples = testpath "examples"
|
||||
@path = File.join(examples, "test.git")
|
||||
FileUtils.cp_r File.join(examples, "empty.git"), @path, :remove_destination => true
|
||||
@wiki = Gollum::Wiki.new(@path)
|
||||
end
|
||||
|
||||
@@ -43,4 +43,4 @@ context "Precious::Views::Page" do
|
||||
actual = @view.title
|
||||
assert_equal 'H1', title
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user