forked from github/kensanata.oddmuse
Compare commits
7 Commits
2.3.10
...
as/looking
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7db436f00 | ||
|
|
14c33c5a9a | ||
|
|
0bd2afe4e1 | ||
|
|
0a9ff1b723 | ||
|
|
2dab06f905 | ||
|
|
8c143393e3 | ||
|
|
8255303d95 |
25
server.pl
25
server.pl
@@ -14,22 +14,31 @@
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package OddMuse;
|
||||
|
||||
our $RunCGI = 0;
|
||||
do 'wiki.pl';
|
||||
|
||||
my $dir = $DataDir; # used for Mojolicious::Plugin::CGI setup
|
||||
|
||||
use Mojolicious::Lite;
|
||||
|
||||
# This needs to be in a different section, sometimes?
|
||||
plugin CGI => {
|
||||
support_semicolon_in_query_string => 1,
|
||||
};
|
||||
|
||||
plugin CGI => {
|
||||
route => '/wiki',
|
||||
# We need this for older versions of Mojolicious::Plugin::CGI
|
||||
script => 'wiki.pl',
|
||||
run => \&OddMuse::DoWikiRequest,
|
||||
before => sub {
|
||||
no warnings;
|
||||
$OddMuse::RunCGI = 0;
|
||||
# The default data directory is determined by the environment variable
|
||||
# WikiDataDir and falls back to the following
|
||||
# $OddMuse::DataDir = '/tmp/oddmuse';
|
||||
use warnings;
|
||||
require 'wiki.pl' unless defined &OddMuse::DoWikiRequest;
|
||||
},
|
||||
env => {},
|
||||
# path to where STDERR from cgi script goes
|
||||
errlog => "$dir/wiki.log",
|
||||
errlog => ($ENV{WikiDataDir} || '/tmp/oddmuse')
|
||||
. "/wiki.log",
|
||||
};
|
||||
|
||||
get '/' => sub {
|
||||
|
||||
25
t/basic.t
Normal file
25
t/basic.t
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright (C) 2016 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# editing pages
|
||||
test_page(get_page('Test'),
|
||||
'<title>Wiki: Test</title>',
|
||||
'Status: 404 NOT FOUND');
|
||||
test_page(update_page('Test', 'Muuu!', 'first edit', undef, undef,
|
||||
'username=Alex'),
|
||||
'<p>Muuu!</p>');
|
||||
2
t/git.t
2
t/git.t
@@ -23,6 +23,8 @@ SKIP: {
|
||||
|
||||
add_module('git.pl');
|
||||
|
||||
$ENV{LANG} = "en_US.UTF-8"; # test relies on English output
|
||||
|
||||
if (qx($GitBinary --version) !~ /git version/) {
|
||||
skip "$GitBinary not found", 16;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
|
||||
# Copyright (C) 2015-2016 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -18,8 +18,14 @@ use Test::More tests => 2;
|
||||
|
||||
add_module('pygmentize.pl');
|
||||
|
||||
$ENV{PATH} = '.'; # pygmentize is not installed in the current directory
|
||||
$page = apply_rules(newlines('{{{\ntest\n}}}\n'));
|
||||
test_page($page,
|
||||
'\bsh\b.*\bpygmentize\b.*\bnot found\b',
|
||||
'<pre>test</pre>');
|
||||
SKIP: {
|
||||
if (qx(pygmentize -V) !~ /Pygments version/) {
|
||||
skip "pygmentize not found", 2;
|
||||
}
|
||||
|
||||
$ENV{PATH} = '.'; # pygmentize is not installed in the current directory
|
||||
$page = apply_rules(newlines('{{{\ntest\n}}}\n'));
|
||||
test_page($page,
|
||||
'\bsh\b.*\bpygmentize\b.*\bnot found\b',
|
||||
'<pre>test</pre>');
|
||||
}
|
||||
|
||||
@@ -416,7 +416,6 @@ sub start_mojolicious_server {
|
||||
END {
|
||||
# kill server
|
||||
if ($pid) {
|
||||
warn "Killing server $pid\n";
|
||||
kill 'KILL', $pid or warn "Could not kill server $pid";
|
||||
}
|
||||
}
|
||||
|
||||
31
t/umlaut.t
Normal file
31
t/umlaut.t
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2016 Alex Schroeder <alex@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 3;
|
||||
use utf8;
|
||||
|
||||
my $dir = $ENV{WikiDataDir};
|
||||
$dir .= "-ä";
|
||||
utf8::encode($dir); # bytes
|
||||
$ENV{WikiDataDir} = $dir;
|
||||
|
||||
# editing pages
|
||||
test_page(get_page('Test'),
|
||||
'<title>Wiki: Test</title>',
|
||||
'Status: 404 NOT FOUND');
|
||||
test_page(update_page('Test', 'Muuu!', 'first edit', undef, undef,
|
||||
'username=Alex'),
|
||||
'<p>Muuu!</p>');
|
||||
1
wiki.pl
1
wiki.pl
@@ -305,7 +305,6 @@ sub InitVariables { # Init global session variables for mod_perl!
|
||||
$LastUpdate = $ts;
|
||||
unshift(@MyRules, \&MyRules) if defined(&MyRules) && (not @MyRules or $MyRules[0] != \&MyRules);
|
||||
@MyRules = sort {$RuleOrder{$a} <=> $RuleOrder{$b}} @MyRules; # default is 0
|
||||
ReportError(Ts('Cannot create %s', $DataDir) . ": $!", '500 INTERNAL SERVER ERROR') unless -d $DataDir;
|
||||
@IndexOptions = (['pages', T('Include normal pages'), 1, \&AllPagesList]);
|
||||
foreach my $sub (@MyInitVariables) {
|
||||
my $result = $sub->();
|
||||
|
||||
Reference in New Issue
Block a user