Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fd16daeca | |||
| d9b38c3b73 | |||
| 0a5176c1ee | |||
| b836b0e273 | |||
| 9a41e2a65d | |||
| cb1b74ed7b | |||
| e25e5d9768 | |||
| 9f3766952f | |||
| cb4471b07f | |||
| 9fa7eac41f | |||
| 94fa985550 | |||
| 1c498ead35 | |||
| 5abc983172 | |||
| 7a0d4919b0 | |||
| d5e9183877 | |||
| 9b39a51e9f | |||
| bec7eabd1c | |||
| cd3791087f | |||
| 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 | |||
| 9c714e7687 | |||
| 6c3523d61c | |||
| 183840b793 | |||
| 4e2856aa64 | |||
| 4627a39165 | |||
| c87cbe83d2 | |||
| f05282badf | |||
| 957879346e | |||
| 87e64f67f3 | |||
| 43840d246d |
+2
-4
@@ -1,8 +1,6 @@
|
|||||||
rvm:
|
rvm:
|
||||||
- 1.8.7
|
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
notifications:
|
- 2.0.0
|
||||||
email:
|
|
||||||
- code@bootstraponline.com
|
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
|
- sudo apt-get install libicu-dev
|
||||||
+19
-3
@@ -19,7 +19,10 @@ require 'gollum'
|
|||||||
|
|
||||||
exec = {}
|
exec = {}
|
||||||
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
|
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
|
||||||
wiki_options = {}
|
wiki_options = {
|
||||||
|
:live_preview => false,
|
||||||
|
:allow_uploads => false,
|
||||||
|
}
|
||||||
|
|
||||||
opts = OptionParser.new do |opts|
|
opts = OptionParser.new do |opts|
|
||||||
opts.banner = help
|
opts.banner = help
|
||||||
@@ -53,6 +56,10 @@ opts = OptionParser.new do |opts|
|
|||||||
wiki_options[:js] = true
|
wiki_options[:js] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on("--template-dir [PATH]", "Specify custom template directory") do |path|
|
||||||
|
wiki_options[:template_dir] = path
|
||||||
|
end
|
||||||
|
|
||||||
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
|
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
|
||||||
wiki_options[:page_file_dir] = path
|
wiki_options[:page_file_dir] = path
|
||||||
end
|
end
|
||||||
@@ -73,6 +80,14 @@ opts = OptionParser.new do |opts|
|
|||||||
wiki_options[:live_preview] = false
|
wiki_options[:live_preview] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on("--live-preview", "Enables livepreview.") do
|
||||||
|
wiki_options[:live_preview] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.on("--allow-uploads", "Allows file uploads.") do
|
||||||
|
wiki_options[:allow_uploads] = true
|
||||||
|
end
|
||||||
|
|
||||||
opts.on("--mathjax", "Enables mathjax.") do
|
opts.on("--mathjax", "Enables mathjax.") do
|
||||||
wiki_options[:mathjax] = true
|
wiki_options[:mathjax] = true
|
||||||
end
|
end
|
||||||
@@ -135,7 +150,7 @@ if options['irb']
|
|||||||
begin
|
begin
|
||||||
require 'gollum-lib'
|
require 'gollum-lib'
|
||||||
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
|
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 "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
|
||||||
puts
|
puts
|
||||||
puts %( page = wiki.page('page-name'))
|
puts %( page = wiki.page('page-name'))
|
||||||
@@ -149,7 +164,7 @@ if options['irb']
|
|||||||
puts
|
puts
|
||||||
puts "Check out the Gollum README for more."
|
puts "Check out the Gollum README for more."
|
||||||
IRB.start_session(binding)
|
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}"
|
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
@@ -157,6 +172,7 @@ else
|
|||||||
require 'gollum/app'
|
require 'gollum/app'
|
||||||
Precious::App.set(:gollum_path, gollum_path)
|
Precious::App.set(:gollum_path, gollum_path)
|
||||||
Precious::App.set(:wiki_options, wiki_options)
|
Precious::App.set(:wiki_options, wiki_options)
|
||||||
|
Precious::App.settings.mustache[:templates] = wiki_options[:template_dir] if wiki_options[:template_dir]
|
||||||
|
|
||||||
if cfg = options['config']
|
if cfg = options['config']
|
||||||
# If the path begins with a '/' it will be considered an absolute path,
|
# If the path begins with a '/' it will be considered an absolute path,
|
||||||
|
|||||||
+10
-7
@@ -2,11 +2,11 @@ Gem::Specification.new do |s|
|
|||||||
s.specification_version = 2 if s.respond_to? :specification_version=
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.rubygems_version = '1.3.5'
|
s.rubygems_version = '1.3.5'
|
||||||
s.required_ruby_version = ">= 1.8.7"
|
s.required_ruby_version = ">= 1.9"
|
||||||
|
|
||||||
s.name = 'gollum'
|
s.name = 'gollum'
|
||||||
s.version = '2.4.15'
|
s.version = '2.6.0'
|
||||||
s.date = '2013-06-18'
|
s.date = '2014-01-02'
|
||||||
s.rubyforge_project = 'gollum'
|
s.rubyforge_project = 'gollum'
|
||||||
s.license = 'MIT'
|
s.license = 'MIT'
|
||||||
|
|
||||||
@@ -24,13 +24,14 @@ Gem::Specification.new do |s|
|
|||||||
s.rdoc_options = ["--charset=UTF-8"]
|
s.rdoc_options = ["--charset=UTF-8"]
|
||||||
s.extra_rdoc_files = %w[README.md LICENSE]
|
s.extra_rdoc_files = %w[README.md LICENSE]
|
||||||
|
|
||||||
s.add_dependency 'gollum-lib', '~> 1.0.3'
|
s.add_dependency 'gollum-lib', '~> 1.0', '>= 1.0.9'
|
||||||
s.add_dependency 'sinatra', '~> 1.4.2'
|
s.add_dependency 'github-markdown', '~> 0.5.5'
|
||||||
|
s.add_dependency 'sinatra', '~> 1.4', '>= 1.4.3'
|
||||||
s.add_dependency 'mustache', ['>= 0.99.4', '< 1.0.0']
|
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 'rack-test', '~> 0.6.2'
|
||||||
s.add_development_dependency 'shoulda', ['>= 3.4.0', '< 3.5.0']
|
s.add_development_dependency 'shoulda', '~> 3.4.0'
|
||||||
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
|
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
|
||||||
|
|
||||||
# = MANIFEST =
|
# = MANIFEST =
|
||||||
@@ -529,6 +530,8 @@ Gem::Specification.new do |s|
|
|||||||
licenses/css_tree_menu_thecssninja/license.txt
|
licenses/css_tree_menu_thecssninja/license.txt
|
||||||
licenses/licenses.txt
|
licenses/licenses.txt
|
||||||
licenses/unity_asset_pool/COPYRIGHT
|
licenses/unity_asset_pool/COPYRIGHT
|
||||||
|
openrc/conf.d/gollum
|
||||||
|
openrc/init.d/gollum
|
||||||
templates/formatting.html
|
templates/formatting.html
|
||||||
templates/helper_wiki.rb
|
templates/helper_wiki.rb
|
||||||
]
|
]
|
||||||
|
|||||||
+1
-2
@@ -5,7 +5,6 @@ require 'digest/sha1'
|
|||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
|
||||||
# external
|
# external
|
||||||
require 'grit'
|
|
||||||
require 'github/markup'
|
require 'github/markup'
|
||||||
require 'sanitize'
|
require 'sanitize'
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
|||||||
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '2.4.15'
|
VERSION = '2.6.0'
|
||||||
|
|
||||||
def self.assets_path
|
def self.assets_path
|
||||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||||
|
|||||||
+62
-8
@@ -13,13 +13,17 @@ require 'gollum/views/has_page'
|
|||||||
|
|
||||||
require File.expand_path '../helpers', __FILE__
|
require File.expand_path '../helpers', __FILE__
|
||||||
|
|
||||||
|
#required to upload bigger binary files
|
||||||
|
Gollum::set_git_timeout(120)
|
||||||
|
Gollum::set_git_max_filesize(190 * 10**6)
|
||||||
|
|
||||||
# Fix to_url
|
# Fix to_url
|
||||||
class String
|
class String
|
||||||
alias :upstream_to_url :to_url
|
alias :upstream_to_url :to_url
|
||||||
# _Header => header which causes errors
|
# _Header => header which causes errors
|
||||||
def to_url
|
def to_url
|
||||||
return nil if self.nil?
|
return nil if self.nil?
|
||||||
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
|
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar'], :force_downcase => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -137,8 +141,7 @@ module Precious
|
|||||||
else
|
else
|
||||||
@page = page
|
@page = page
|
||||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||||
raw_data = page.raw_data
|
@content = page.text_data
|
||||||
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
|
|
||||||
mustache :edit
|
mustache :edit
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -146,6 +149,53 @@ module Precious
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
post '/uploadFile' do
|
||||||
|
wiki = wiki_new
|
||||||
|
|
||||||
|
unless wiki.allow_uploads
|
||||||
|
@message = "File uploads are disabled"
|
||||||
|
mustache :error
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:file]
|
||||||
|
fullname = params[:file][:filename]
|
||||||
|
tempfile = params[:file][:tempfile]
|
||||||
|
end
|
||||||
|
|
||||||
|
dir = 'uploads'
|
||||||
|
ext = ::File.extname(fullname)
|
||||||
|
format = ext.split('.').last || 'txt'
|
||||||
|
filename = ::File.basename(fullname, ext)
|
||||||
|
contents = ::File.read(tempfile)
|
||||||
|
reponame = filename + '.' + format
|
||||||
|
|
||||||
|
head = wiki.repo.head
|
||||||
|
|
||||||
|
options = {
|
||||||
|
:message => "Uploaded file to uploads/#{reponame}",
|
||||||
|
:parent => wiki.repo.head.commit,
|
||||||
|
}
|
||||||
|
author = session['gollum.author']
|
||||||
|
unless author.nil?
|
||||||
|
options.merge! author
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
committer = Gollum::Committer.new(wiki, options)
|
||||||
|
committer.add_to_index(dir, filename, format, contents)
|
||||||
|
committer.after_commit do |committer, sha|
|
||||||
|
wiki.clear_cache
|
||||||
|
committer.update_working_dir(dir, filename, format)
|
||||||
|
end
|
||||||
|
committer.commit
|
||||||
|
redirect to('/')
|
||||||
|
rescue Gollum::DuplicatePageError => e
|
||||||
|
@message = "Duplicate page: #{e.message}"
|
||||||
|
mustache :error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
post '/rename/*' do
|
post '/rename/*' do
|
||||||
wikip = wiki_page(params[:splat].first)
|
wikip = wiki_page(params[:splat].first)
|
||||||
halt 500 if wikip.nil?
|
halt 500 if wikip.nil?
|
||||||
@@ -239,6 +289,8 @@ module Precious
|
|||||||
format = params[:format].intern
|
format = params[:format].intern
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
|
|
||||||
|
path.gsub!(/^\//, '')
|
||||||
|
|
||||||
begin
|
begin
|
||||||
wiki.write_page(name, format, params[:content], commit_message, path)
|
wiki.write_page(name, format, params[:content], commit_message, path)
|
||||||
|
|
||||||
@@ -250,15 +302,14 @@ module Precious
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
post '/revert/:page/*' do
|
post '/revert/*/:sha1/:sha2' do
|
||||||
wikip = wiki_page(params[:page])
|
wikip = wiki_page(params[:splat].first)
|
||||||
@path = wikip.path
|
@path = wikip.path
|
||||||
@name = wikip.name
|
@name = wikip.name
|
||||||
wiki = wikip.wiki
|
wiki = wikip.wiki
|
||||||
@page = wiki.paged(@name,@path)
|
@page = wiki.paged(@name,@path)
|
||||||
shas = params[:splat].first.split("/")
|
sha1 = params[:sha1]
|
||||||
sha1 = shas.shift
|
sha2 = params[:sha2]
|
||||||
sha2 = shas.shift
|
|
||||||
|
|
||||||
commit = commit_message
|
commit = commit_message
|
||||||
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
|
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
|
||||||
@@ -283,6 +334,7 @@ module Precious
|
|||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
@h1_title = wiki.h1_title
|
@h1_title = wiki.h1_title
|
||||||
@editable = false
|
@editable = false
|
||||||
|
@allow_uploads = wiki.allow_uploads
|
||||||
mustache :page
|
mustache :page
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -336,6 +388,7 @@ module Precious
|
|||||||
@page = page
|
@page = page
|
||||||
@name = name
|
@name = name
|
||||||
@content = page.formatted_data
|
@content = page.formatted_data
|
||||||
|
@version = version
|
||||||
mustache :page
|
mustache :page
|
||||||
else
|
else
|
||||||
halt 404
|
halt 404
|
||||||
@@ -401,6 +454,7 @@ module Precious
|
|||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
@h1_title = wiki.h1_title
|
@h1_title = wiki.h1_title
|
||||||
@bar_side = wiki.bar_side
|
@bar_side = wiki.bar_side
|
||||||
|
@allow_uploads = wiki.allow_uploads
|
||||||
|
|
||||||
mustache :page
|
mustache :page
|
||||||
elsif file = wiki.file(fullpath, wiki.ref, true)
|
elsif file = wiki.file(fullpath, wiki.ref, true)
|
||||||
|
|||||||
@@ -37,11 +37,14 @@
|
|||||||
fieldMarkup += '<div class="field">';
|
fieldMarkup += '<div class="field">';
|
||||||
switch ( fieldArray[i].type ) {
|
switch ( fieldArray[i].type ) {
|
||||||
|
|
||||||
// only text is supported for now
|
|
||||||
case 'text':
|
case 'text':
|
||||||
fieldMarkup += Dialog.createFieldText( fieldArray[i] );
|
fieldMarkup += Dialog.createFieldText( fieldArray[i] );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'file':
|
||||||
|
fieldMarkup += Dialog.createFieldFile( fieldArray[i] );
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -60,7 +63,7 @@
|
|||||||
if ( fieldAttributes.name ) {
|
if ( fieldAttributes.name ) {
|
||||||
html += '<label';
|
html += '<label';
|
||||||
if ( fieldAttributes.id ) {
|
if ( fieldAttributes.id ) {
|
||||||
html += ' for="' + fieldAttributes.name + '"';
|
html += ' for="gollum-dialog-dialog-generated-field-' + fieldAttributes.id + '"';
|
||||||
}
|
}
|
||||||
html += '>' + fieldAttributes.name + '</label>';
|
html += '>' + fieldAttributes.name + '</label>';
|
||||||
}
|
}
|
||||||
@@ -86,6 +89,26 @@
|
|||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createFieldFile: function( fieldAttributes ) {
|
||||||
|
// Not actually a field, but an embedded form.
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
var id = fieldAttributes.id || 'upload';
|
||||||
|
var name = fieldAttributes.name || 'file';
|
||||||
|
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;
|
||||||
|
},
|
||||||
|
|
||||||
createMarkup: function( title, body ) {
|
createMarkup: function( title, body ) {
|
||||||
Dialog.markupCreated = true;
|
Dialog.markupCreated = true;
|
||||||
if ($.facebox) {
|
if ($.facebox) {
|
||||||
@@ -156,6 +179,7 @@
|
|||||||
duration: 200,
|
duration: 200,
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('#gollum-dialog-dialog').removeClass('active');
|
$('#gollum-dialog-dialog').removeClass('active');
|
||||||
|
$('#gollum-dialog-dialog').css('display', 'none');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,6 +145,27 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($('#minibutton-upload-page').length) {
|
||||||
|
$('#minibutton-upload-page').parent().removeClass('jaws');
|
||||||
|
$('#minibutton-upload-page').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
$.GollumDialog.init({
|
||||||
|
title: 'Upload File',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
type: 'file',
|
||||||
|
context: 'Your uploaded file will be accessible at /uploads/[filename]',
|
||||||
|
action: baseUrl + '/uploadFile'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
OK: function( res ) {
|
||||||
|
$('#upload').submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ($('#minibutton-rename-page').length) {
|
if ($('#minibutton-rename-page').length) {
|
||||||
$('#minibutton-rename-page').parent().removeClass('jaws');
|
$('#minibutton-rename-page').parent().removeClass('jaws');
|
||||||
$('#minibutton-rename-page').click(function(e) {
|
$('#minibutton-rename-page').click(function(e) {
|
||||||
@@ -152,7 +173,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var path = pagePath();
|
var path = pagePath();
|
||||||
var oldName = pageName();
|
var oldName = pageName();
|
||||||
var context_blurb =
|
var context_blurb =
|
||||||
"Renamed page will be under " +
|
"Renamed page will be under " +
|
||||||
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
|
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
|
||||||
" unless an absolute path is given."
|
" unless an absolute path is given."
|
||||||
@@ -206,7 +227,7 @@ $(document).ready(function() {
|
|||||||
// For consistency remove the trailing /
|
// For consistency remove the trailing /
|
||||||
path = path.replace(/\/$/,'')
|
path = path.replace(/\/$/,'')
|
||||||
}
|
}
|
||||||
var context_blurb =
|
var context_blurb =
|
||||||
"Page will be created under " +
|
"Page will be created under " +
|
||||||
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
|
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
|
||||||
" unless an absolute path is given."
|
" unless an absolute path is given."
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
|
||||||
{{#css}}<link rel="stylesheet" type="text/css" href="{{base_url}}/custom.css" media="all">{{/css}}
|
{{#css}}<link rel="stylesheet" type="text/css" href="{{base_url}}/custom.css" media="all">{{/css}}
|
||||||
|
{{#noindex}}<meta name="robots" content="noindex, nofollow" />{{/noindex}}
|
||||||
|
|
||||||
<!--[if IE 7]>
|
<!--[if IE 7]>
|
||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
<script>
|
<script>
|
||||||
var baseUrl = '{{base_url}}';
|
var baseUrl = '{{base_url}}';
|
||||||
{{#page}}
|
{{#page}}
|
||||||
var pageFullPath = '{{url_path}}';
|
var pageFullPath = '{{url_path_display}}';
|
||||||
{{/page}}
|
{{/page}}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
|
<script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ Mousetrap.bind(['e'], function( e ) {
|
|||||||
class="action-fileview">Files</a></li>
|
class="action-fileview">Files</a></li>
|
||||||
<li class="minibutton jaws">
|
<li class="minibutton jaws">
|
||||||
<a href="#" id="minibutton-new-page">New</a></li>
|
<a href="#" id="minibutton-new-page">New</a></li>
|
||||||
|
{{#allow_uploads}}
|
||||||
|
<li class="minibutton jaws">
|
||||||
|
<a href="#" id="minibutton-upload-page">Upload</a></li>
|
||||||
|
{{/allow_uploads}}
|
||||||
{{#editable}}
|
{{#editable}}
|
||||||
<li class="minibutton jaws">
|
<li class="minibutton jaws">
|
||||||
<a href="#" id="minibutton-rename-page">Rename</a></li>
|
<a href="#" id="minibutton-rename-page">Rename</a></li>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
# component must be String
|
# component must be String
|
||||||
def encodeURIComponent(componentString)
|
def encodeURIComponent(componentString)
|
||||||
URI::URIEncodeComponent(componentString)
|
::URI::URIEncodeComponent(componentString)
|
||||||
end
|
end
|
||||||
|
|
||||||
# define charCodeAt on String
|
# define charCodeAt on String
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module Precious
|
|||||||
def header
|
def header
|
||||||
if @header.nil?
|
if @header.nil?
|
||||||
if page = @page.header
|
if page = @page.header
|
||||||
@header = page.raw_data
|
@header = page.text_data
|
||||||
else
|
else
|
||||||
@header = false
|
@header = false
|
||||||
end
|
end
|
||||||
@@ -33,7 +33,7 @@ module Precious
|
|||||||
def footer
|
def footer
|
||||||
if @footer.nil?
|
if @footer.nil?
|
||||||
if page = @page.footer
|
if page = @page.footer
|
||||||
@footer = page.raw_data
|
@footer = page.text_data
|
||||||
else
|
else
|
||||||
@footer = false
|
@footer = false
|
||||||
end
|
end
|
||||||
@@ -44,7 +44,7 @@ module Precious
|
|||||||
def sidebar
|
def sidebar
|
||||||
if @sidebar.nil?
|
if @sidebar.nil?
|
||||||
if page = @page.sidebar
|
if page = @page.sidebar
|
||||||
@sidebar = page.raw_data
|
@sidebar = page.text_data
|
||||||
else
|
else
|
||||||
@sidebar = false
|
@sidebar = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,10 +35,18 @@ module Precious
|
|||||||
first.authored_date.strftime(DATE_FORMAT)
|
first.authored_date.strftime(DATE_FORMAT)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def noindex
|
||||||
|
@version ? true : false
|
||||||
|
end
|
||||||
|
|
||||||
def editable
|
def editable
|
||||||
@editable
|
@editable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def allow_uploads
|
||||||
|
@allow_uploads
|
||||||
|
end
|
||||||
|
|
||||||
def has_header
|
def has_header
|
||||||
@header = (@page.header || false) if @header.nil?
|
@header = (@page.header || false) if @header.nil?
|
||||||
!!@header
|
!!@header
|
||||||
|
|||||||
@@ -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
|
class WikiFactory
|
||||||
def self.create p
|
def self.create p
|
||||||
path = testpath "examples/test.git"
|
examples = testpath "examples"
|
||||||
Grit::Repo.init_bare(@path)
|
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}
|
Gollum::Wiki.default_options = {:universal_toc => false}
|
||||||
cleanup = Proc.new { FileUtils.rm_r File.join(File.dirname(__FILE__), *%w[examples test.git]) }
|
cleanup = Proc.new { FileUtils.rm_r File.join(File.dirname(__FILE__), *%w[examples test.git]) }
|
||||||
Gollum::Wiki.new(@path), @path, cleanup
|
Gollum::Wiki.new(@path), @path, cleanup
|
||||||
|
|||||||
+40
-9
@@ -29,13 +29,13 @@ context "Frontend" do
|
|||||||
# spaces are converted to dashes in URLs
|
# spaces are converted to dashes in URLs
|
||||||
# and in file names saved to disk
|
# and in file names saved to disk
|
||||||
# urls are not case sensitive
|
# 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
|
# ascii only file names prevent UTF8 issues
|
||||||
# when using git repos across operating systems
|
# when using git repos across operating systems
|
||||||
# as this test demonstrates, translation is not
|
# as this test demonstrates, translation is not
|
||||||
# great
|
# great
|
||||||
assert_equal 'm-plus-f', 'μ†ℱ'.to_url
|
assert_equal 'm-plus-F', 'μ†ℱ'.to_url
|
||||||
end
|
end
|
||||||
|
|
||||||
test "utf-8 kcode" do
|
test "utf-8 kcode" do
|
||||||
@@ -253,7 +253,7 @@ context "Frontend" do
|
|||||||
test "creates pages with escaped characters in title" do
|
test "creates pages with escaped characters in title" do
|
||||||
post "/create", :content => 'abc', :page => 'Title with spaces',
|
post "/create", :content => 'abc', :page => 'Title with spaces',
|
||||||
:format => 'markdown', :message => 'foo'
|
: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"
|
get "/Title-with-spaces"
|
||||||
assert_match /abc/, last_response.body
|
assert_match /abc/, last_response.body
|
||||||
end
|
end
|
||||||
@@ -278,7 +278,7 @@ context "Frontend" do
|
|||||||
post "/create", :content => 'abc', :page => 'Home', :path => '/foo/',
|
post "/create", :content => 'abc', :page => 'Home', :path => '/foo/',
|
||||||
:format => 'markdown', :message => '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!
|
follow_redirect!
|
||||||
assert last_response.ok?
|
assert last_response.ok?
|
||||||
@@ -429,7 +429,7 @@ context "Frontend" do
|
|||||||
assert_equal "INITIAL", page2.raw_data.strip
|
assert_equal "INITIAL", page2.raw_data.strip
|
||||||
end
|
end
|
||||||
=end
|
=end
|
||||||
|
=begin
|
||||||
test "cannot revert conflicting commit" do
|
test "cannot revert conflicting commit" do
|
||||||
page1 = @wiki.page('A')
|
page1 = @wiki.page('A')
|
||||||
|
|
||||||
@@ -440,6 +440,7 @@ context "Frontend" do
|
|||||||
page2 = @wiki.page('A')
|
page2 = @wiki.page('A')
|
||||||
assert_equal page1.version.sha, page2.version.sha
|
assert_equal page1.version.sha, page2.version.sha
|
||||||
end
|
end
|
||||||
|
=end
|
||||||
=begin
|
=begin
|
||||||
# redirects are now handled by class MapGollum in bin/gollum
|
# redirects are now handled by class MapGollum in bin/gollum
|
||||||
# they should be set in config.ru
|
# they should be set in config.ru
|
||||||
@@ -504,6 +505,36 @@ context "Frontend" do
|
|||||||
Precious::App.set(:wiki_options, { :js => nil })
|
Precious::App.set(:wiki_options, { :js => nil })
|
||||||
end
|
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
|
||||||
|
|
||||||
|
test "add noindex tags to history pages" do
|
||||||
|
get "A"
|
||||||
|
|
||||||
|
assert last_response.ok?
|
||||||
|
assert_no_match /meta name="robots" content="noindex, nofollow"/, last_response.body
|
||||||
|
|
||||||
|
get "A/fc66539528eb96f21b2bbdbf557788fe8a1196ac"
|
||||||
|
|
||||||
|
assert last_response.ok?
|
||||||
|
assert_match /meta name="robots" content="noindex, nofollow"/, last_response.body
|
||||||
|
end
|
||||||
|
|
||||||
def app
|
def app
|
||||||
Precious::App
|
Precious::App
|
||||||
end
|
end
|
||||||
@@ -612,13 +643,13 @@ context "Frontend with lotr" do
|
|||||||
test "create pages within sub-directories" do
|
test "create pages within sub-directories" do
|
||||||
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
||||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, scary'
|
: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"
|
get "/Mordor/Orc"
|
||||||
assert_match /big smelly creatures/, last_response.body
|
assert_match /big smelly creatures/, last_response.body
|
||||||
|
|
||||||
post "/create", :content => 'really big smelly creatures', :page => 'Uruk Hai',
|
post "/create", :content => 'really big smelly creatures', :page => 'Uruk Hai',
|
||||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, very scary'
|
: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"
|
get "/Mordor/Uruk-Hai"
|
||||||
assert_match /really big smelly creatures/, last_response.body
|
assert_match /really big smelly creatures/, last_response.body
|
||||||
end
|
end
|
||||||
@@ -627,11 +658,11 @@ context "Frontend with lotr" do
|
|||||||
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
||||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, scary'
|
: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',
|
post "/edit/Mordor/Orc", :content => 'not so big smelly creatures',
|
||||||
:page => 'Orc', :path => 'Mordor', :message => 'minor edit'
|
: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"
|
get "/Mordor/Orc"
|
||||||
assert_match /not so big smelly creatures/, last_response.body
|
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
|
context "Precious::Views::Page" do
|
||||||
setup do
|
setup do
|
||||||
@path = testpath("examples/test.git")
|
examples = testpath "examples"
|
||||||
FileUtils.rm_rf(@path)
|
@path = File.join(examples, "test.git")
|
||||||
@repo = Grit::Repo.init_bare(@path)
|
FileUtils.cp_r File.join(examples, "empty.git"), @path, :remove_destination => true
|
||||||
@wiki = Gollum::Wiki.new(@path)
|
@wiki = Gollum::Wiki.new(@path)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,4 +43,4 @@ context "Precious::Views::Page" do
|
|||||||
actual = @view.title
|
actual = @view.title
|
||||||
assert_equal 'H1', title
|
assert_equal 'H1', title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user