olelo 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/{doc/LICENSE → LICENSE} +0 -0
- data/README.creole +127 -0
- data/Rakefile +2 -2
- data/bin/olelo +55 -2
- data/config.ru +21 -4
- data/config/aspects.rb +9 -7
- data/config/config.yml.default +1 -0
- data/lib/olelo.rb +1 -0
- data/lib/olelo/application.rb +25 -14
- data/lib/olelo/config.rb +1 -1
- data/lib/olelo/extensions.rb +0 -12
- data/lib/olelo/helper.rb +0 -4
- data/lib/olelo/initializer.rb +4 -7
- data/lib/olelo/locale.yml +0 -3
- data/lib/olelo/page.rb +1 -1
- data/lib/olelo/plugin.rb +5 -4
- data/lib/olelo/routing.rb +15 -12
- data/lib/olelo/user.rb +10 -24
- data/lib/olelo/util.rb +4 -11
- data/lib/olelo/version.rb +1 -1
- data/lib/olelo/virtualfs.rb +11 -19
- data/olelo.gemspec +5 -2
- data/plugins/aspects/locale.yml +5 -0
- data/plugins/aspects/main.rb +8 -4
- data/plugins/authentication/yamlfile.rb +1 -1
- data/plugins/blog/main.rb +5 -5
- data/plugins/editor/ace/init.js +17 -0
- data/plugins/editor/ace/main.rb +7 -0
- data/plugins/editor/markup/main.rb +1 -1
- data/plugins/editor/markup/script.js +8 -8
- data/plugins/editor/markup/script/init.js +3 -3
- data/plugins/editor/recaptcha.rb +2 -2
- data/plugins/filters/interwiki.rb +0 -1
- data/plugins/gallery/main.rb +1 -1
- data/plugins/login/persistent.rb +2 -2
- data/plugins/misc/fancybox/script.js +1 -1
- data/plugins/misc/fancybox/script/init.js +2 -2
- data/plugins/misc/variables.rb +2 -2
- data/plugins/tags/math.rb +6 -7
- data/plugins/tags/scripting.rb +1 -1
- data/plugins/tags/tabs.rb +1 -1
- data/plugins/treeview/script.js +2 -2
- data/plugins/treeview/script/init.js +26 -24
- data/plugins/utils/assets.rb +20 -14
- data/static/themes/atlantis/images/bg/header.jpg +0 -0
- data/static/themes/atlantis/images/bg/header_gray.jpg +0 -0
- data/views/layout.slim +0 -1
- data/views/login.slim +3 -2
- metadata +127 -34
- data/README.markdown +0 -104
- data/doc/AUTHORS +0 -7
- data/lib/rack/olelo_patches.rb +0 -33
- data/lib/yard/addons.rb +0 -1
- data/lib/yard/addons/hook_handler.rb +0 -25
- data/lib/yard/addons/override_tag.rb +0 -14
- data/lib/yard/addons/route_handler.rb +0 -33
- data/lib/yard/addons/sanitize_anchor.rb +0 -16
data/{doc/LICENSE → LICENSE}
RENAMED
File without changes
|
data/README.creole
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
= Ōlelo Wiki
|
2
|
+
|
3
|
+
Ōlelo is a wiki that stores pages in a [[http://git-scm.org/|Git]] repository, supports many markup styles and has an extensible, hackable architecture!
|
4
|
+
If you want to see a demo installation go to http://www.gitwiki.org/.
|
5
|
+
|
6
|
+
== Features
|
7
|
+
|
8
|
+
Ōlelo implements a plugin system. A lot of the features are implemented as plugins and can be activated or deactivated as you wish.
|
9
|
+
|
10
|
+
Core features:
|
11
|
+
* Edit, move or delete pages
|
12
|
+
* Page attribute editor
|
13
|
+
* Support for hierarchical wikis (directory structure)
|
14
|
+
* File upload
|
15
|
+
* History, commit and diff view
|
16
|
+
|
17
|
+
Features, implemented by plugins:
|
18
|
+
* Support for many markup languages (Creole, Markdown, Textile, ...)
|
19
|
+
* RSS/Atom changelog for whole wiki or pages
|
20
|
+
* Section editing for Creole and Markdown markup
|
21
|
+
* Embedded LaTeX formulas (Rendered as image or using [[http://mathjax.org/|MathJax]]
|
22
|
+
* Syntax highlighted embedded code blocks
|
23
|
+
* Image resizing, SVG to PNG/JPEG conversion
|
24
|
+
* Auto-generated table of contents
|
25
|
+
* Wiki syntax can be extended with tags
|
26
|
+
* Editor preview
|
27
|
+
* View pages as S5 presentation
|
28
|
+
* Privacy features: Access control lists, Private wiki which needs login, readonly wiki
|
29
|
+
|
30
|
+
== Quick start
|
31
|
+
|
32
|
+
The best way to install Ōlelo is via 'gem'.
|
33
|
+
|
34
|
+
{{{
|
35
|
+
$ gem install olelo
|
36
|
+
}}}
|
37
|
+
|
38
|
+
Go to a git repository via command line and start the Ōlelo webserver.
|
39
|
+
|
40
|
+
{{{
|
41
|
+
$ olelo
|
42
|
+
}}}
|
43
|
+
|
44
|
+
Point your web browser at http://localhost:8080/.
|
45
|
+
|
46
|
+
== Installation from source
|
47
|
+
|
48
|
+
Installation from source is especially useful if you want to do development or use the newest features.
|
49
|
+
|
50
|
+
Clone the git repository:
|
51
|
+
|
52
|
+
{{{
|
53
|
+
git clone git://github.com/minad/olelo.git
|
54
|
+
}}}
|
55
|
+
|
56
|
+
Now change to the Ōlelo source directory and use Bundler to install the dependencies.
|
57
|
+
|
58
|
+
{{{
|
59
|
+
$ cd olelo
|
60
|
+
$ bundle install
|
61
|
+
}}}
|
62
|
+
|
63
|
+
Start the Ōlelo webserver from the Ōlelo source directory.
|
64
|
+
|
65
|
+
{{{
|
66
|
+
$ bin/olelo
|
67
|
+
}}}
|
68
|
+
|
69
|
+
== Deployment
|
70
|
+
|
71
|
+
For production purposes, I recommend that you deploy the wiki with [[http://unicorn.bogomips.org|Unicorn]]. You should use the rackup configuration from the Ōlelo source or gem directory.
|
72
|
+
|
73
|
+
{{{
|
74
|
+
$ unicorn path-to/config.ru
|
75
|
+
}}}
|
76
|
+
|
77
|
+
Unicorn is a very flexible ruby application server and Ōlelo runs very well on it. You can adapt the number of Unicorn workers depending on the load you expect. It is
|
78
|
+
a good idea to observe the Unicorn workers as described in https://github.com/blog/519-unicorn-god and kill missbehaving workers if necessary.
|
79
|
+
|
80
|
+
== Configuration
|
81
|
+
|
82
|
+
For deployment you might want to tweak some settings. Ōlelo reads the files config/config.yml.default and config/config.yml in that order.
|
83
|
+
So just copy the default configuration config/config.yml.default to config/config.yml and make your modifications. If you installed Ōlelo
|
84
|
+
as gem this is not a good idea since you don't want to fiddle in the gem directory. For this purpose exists the environment variable OLELO_CONFIG which
|
85
|
+
can point to the configuration file that you want to use.
|
86
|
+
|
87
|
+
{{{
|
88
|
+
export OLELO_CONFIG=/home/olelo/olelo_config.yml
|
89
|
+
}}}
|
90
|
+
|
91
|
+
You can also use the OLELO_CONFIG environment variable if you want to run multiple Ōlelo instances with different configurations.
|
92
|
+
|
93
|
+
== Dependencies
|
94
|
+
|
95
|
+
If you use Bundler or installed Ōlelo as gem you don't really have to care about the dependencies. The standard installation provides the core dependencies and a good selection of optional dependencies.
|
96
|
+
|
97
|
+
Core dependencies:
|
98
|
+
* [[http://www.git-scm.com|Git]]
|
99
|
+
* [[http://slim-lang.com/|Slim template language]]
|
100
|
+
* [[http://libgit2.github.com/|Rugged git library]]
|
101
|
+
* [[http://rack.github.com/|Rack]]
|
102
|
+
* [[https://github.com/minad/mimemagic/|MimeMagic]]
|
103
|
+
|
104
|
+
Some dependencies are optional, for example depending on the markup you want to use.
|
105
|
+
* [[https://github.com/minad/creole|Creole markup library]]
|
106
|
+
* [[https://github.com/vmg/redcarpet|Redcarpet Markdown library]]
|
107
|
+
* [[http://redcloth.org/|RedCloth Textile markup library]]
|
108
|
+
* [[http://www.imagemagick.org/|ImageMagick for image resizing]]
|
109
|
+
* [[http://nokogiri.org/|Nokogiri for auto-generated table of contents]]
|
110
|
+
* [[http://pygments.org/|Pygments for syntax highlighting of code blocks]]
|
111
|
+
|
112
|
+
== Authors
|
113
|
+
|
114
|
+
Git-Wiki was originally developed by Simon Rozet. The development of Ōlelo to its current state was done by Daniel Mendler and contributors.
|
115
|
+
The current code base doesn't have much in common with the original Git-Wiki proof-of-concept.
|
116
|
+
|
117
|
+
Contributors:
|
118
|
+
* Alex Eagle
|
119
|
+
* Alex Wall
|
120
|
+
* Hrvoje
|
121
|
+
* Luca Greco
|
122
|
+
* Pavel Suchmann
|
123
|
+
* Raffael Schmid
|
124
|
+
|
125
|
+
== License
|
126
|
+
|
127
|
+
Ōlelo is released under the MIT license.
|
data/Rakefile
CHANGED
@@ -75,8 +75,8 @@ end
|
|
75
75
|
|
76
76
|
desc 'Generate documentation'
|
77
77
|
namespace :doc do
|
78
|
-
task :gen do; system("yard doc -o doc/api
|
79
|
-
task :server do; system('yard server --reload
|
78
|
+
task :gen do; system("yard doc -o doc/api 'lib/**/*.rb' 'plugins/**/*.rb'"); end
|
79
|
+
task :server do; system('yard server --reload'); end
|
80
80
|
task :check do; system("yardcheck 'lib/**/*.rb' 'plugins/**/*.rb'"); end
|
81
81
|
end
|
82
82
|
|
data/bin/olelo
CHANGED
@@ -1,5 +1,58 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rack'
|
4
|
-
|
5
|
-
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
help = %{Usage: olelo [OPTIONS] [PATH]
|
7
|
+
|
8
|
+
PATH The path to the git repository to serve from (default .).
|
9
|
+
|
10
|
+
Options:
|
11
|
+
}
|
12
|
+
|
13
|
+
options = {
|
14
|
+
:port => 8080,
|
15
|
+
:host => '0.0.0.0'
|
16
|
+
}
|
17
|
+
|
18
|
+
app_path = File.expand_path(File.join(__FILE__, '..', '..'))
|
19
|
+
|
20
|
+
opts = OptionParser.new do |opts|
|
21
|
+
opts.banner = help
|
22
|
+
|
23
|
+
opts.on('-p', '--port [PORT]', 'Bind port (default 8080).') do |port|
|
24
|
+
options[:port] = port.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on('-o', '--host [HOST]', 'Hostname or IP address to listen on (default 0.0.0.0).') do |host|
|
28
|
+
options[:host] = host
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on('-c', '--config [CONFIG]', 'Path to the Olelo configuration, sets the $OLELO_CONFIG environment variable.') do |config|
|
32
|
+
ENV['OLELO_CONFIG'] = File.expand_path(config)
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on('-v', '--version', 'Display current version.') do
|
36
|
+
require File.join(app_path, 'lib', 'olelo', 'version.rb')
|
37
|
+
puts "Olelo #{Olelo::VERSION}"
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
42
|
+
puts opts
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
end
|
46
|
+
opts.parse!(ARGV)
|
47
|
+
|
48
|
+
if ARGV.size == 1
|
49
|
+
Dir.chdir(ARGV.first)
|
50
|
+
elsif ARGV.size > 1
|
51
|
+
puts "Too many arguments: #{ARGV.join(' ')}"
|
52
|
+
puts opts
|
53
|
+
exit
|
54
|
+
end
|
55
|
+
|
56
|
+
Rack::Server.start(:Port => options[:port],
|
57
|
+
:Host => options[:host],
|
58
|
+
:config => File.join(app_path, 'config.ru'))
|
data/config.ru
CHANGED
@@ -7,7 +7,6 @@ $: << ::File.join(app_path, 'lib')
|
|
7
7
|
Encoding.default_external = Encoding::UTF_8
|
8
8
|
|
9
9
|
require 'fileutils'
|
10
|
-
require 'rack/olelo_patches'
|
11
10
|
require 'rack/relative_redirect'
|
12
11
|
require 'rack/static_cache'
|
13
12
|
require 'olelo'
|
@@ -43,14 +42,33 @@ else
|
|
43
42
|
puts 'No default data storage location defined, please create your own configuration!'
|
44
43
|
end
|
45
44
|
|
46
|
-
|
45
|
+
if config = ENV['OLELO_CONFIG'] || ENV['WIKI_CONFIG']
|
46
|
+
Olelo::Config.instance.load!(config)
|
47
|
+
else
|
48
|
+
Olelo::Config.instance.load(::File.join(app_path, 'config', 'config.yml'))
|
49
|
+
end
|
50
|
+
|
47
51
|
Olelo::Config.instance.freeze
|
48
52
|
|
49
53
|
FileUtils.mkpath ::File.dirname(Olelo::Config['log.file'])
|
50
54
|
logger = ::Logger.new(Olelo::Config['log.file'], :monthly, 10240000)
|
51
55
|
logger.level = ::Logger.const_get(Olelo::Config['log.level'])
|
52
56
|
|
53
|
-
|
57
|
+
# Doesn't work currently, rack issue #241
|
58
|
+
# if !Olelo::Config['production']
|
59
|
+
# # Rack::Lint injector
|
60
|
+
# module UseLint
|
61
|
+
# def use(middleware, *args, &block)
|
62
|
+
# super Rack::Lint if middleware != Rack::Lint
|
63
|
+
# super
|
64
|
+
# end
|
65
|
+
# def run(app)
|
66
|
+
# use Rack::Lint
|
67
|
+
# super
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
# class << self; include UseLint; end
|
71
|
+
# end
|
54
72
|
|
55
73
|
use Rack::Runtime
|
56
74
|
use Rack::ShowExceptions if !Olelo::Config['production']
|
@@ -70,7 +88,6 @@ end
|
|
70
88
|
|
71
89
|
use Rack::MethodOverride
|
72
90
|
use Rack::CommonLogger, LoggerOutput.new(logger)
|
73
|
-
|
74
91
|
use Olelo::Middleware::ForceEncoding
|
75
92
|
use Olelo::Middleware::Flash, :set_accessors => %w(error warn info)
|
76
93
|
use Rack::RelativeRedirect
|
data/config/aspects.rb
CHANGED
@@ -9,13 +9,15 @@
|
|
9
9
|
#
|
10
10
|
################################################################################
|
11
11
|
|
12
|
-
regexp :remove_comments, /<!--.*?-->/m,
|
13
|
-
regexp :tag_shortcuts, /\\\((.*?)\\\)/m,
|
14
|
-
/\\\[(.*?)\\\]/m,
|
15
|
-
/<<(.*?)(\|(.*?))?>>/,
|
16
|
-
|
17
|
-
|
18
|
-
regexp :
|
12
|
+
regexp :remove_comments, /<!--.*?-->/m, ''
|
13
|
+
regexp :tag_shortcuts, /\\\((.*?)\\\)/m, '<math display="inline">\1</math>',
|
14
|
+
/\\\[(.*?)\\\]/m, '<math display="block">\1</math>',
|
15
|
+
/<<(.*?)(\|(.*?))?>>/, '<include page="\1" \3/>',
|
16
|
+
/^~~~\s*(\w+)\s*$(.*?)^~~~$/m, '<code lang="\1">\2</code>',
|
17
|
+
/^```\s*(\w+)\s*$(.*?)^```$/m, '<code lang="\1">\2</code>'
|
18
|
+
regexp :creole_nowiki, /\{\{\{.*?\}\}\}/m, '<notags>\0</notags>'
|
19
|
+
regexp :textile_nowiki, /<pre>.*?<\/pre>/m, '<notags>\0</notags>'
|
20
|
+
regexp :mediawiki_nowiki, /<nowiki>.*?<\/nowiki>/m, '<notags>\0</notags>'
|
19
21
|
|
20
22
|
################################################################################
|
21
23
|
#
|
data/config/config.yml.default
CHANGED
data/lib/olelo.rb
CHANGED
data/lib/olelo/application.rb
CHANGED
@@ -15,11 +15,13 @@ module Olelo
|
|
15
15
|
:edit_buttons, :attributes_buttons, :upload_buttons
|
16
16
|
has_hooks :auto_login, :render, :menu, :head, :script
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def self.reserved_path?(path)
|
19
|
+
path = '/' + path.cleanpath
|
20
|
+
path.starts_with?('/static') ||
|
21
|
+
router.any? do |method, r|
|
22
|
+
r.any? do |name,pattern,keys,function|
|
23
|
+
name !~ /^\/\(?:path\)?$/ && pattern.match(path)
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -109,7 +111,7 @@ module Olelo
|
|
109
111
|
post '/signup' do
|
110
112
|
on_error :login
|
111
113
|
raise 'Sign-up is disabled' if !Config['authentication.enable_signup']
|
112
|
-
User.current = User.
|
114
|
+
User.current = User.signup(params[:user], params[:password],
|
113
115
|
params[:confirm], params[:email])
|
114
116
|
redirect build_path('/')
|
115
117
|
end
|
@@ -127,9 +129,13 @@ module Olelo
|
|
127
129
|
post '/profile' do
|
128
130
|
raise 'Anonymous users do not have a profile.' if !User.logged_in?
|
129
131
|
on_error :profile
|
130
|
-
User.
|
131
|
-
|
132
|
-
|
132
|
+
if User.supports?(:change_password) && !params[:password].blank?
|
133
|
+
User.current.change_password(params[:oldpassword], params[:password], params[:confirm])
|
134
|
+
end
|
135
|
+
if User.supports?(:update)
|
136
|
+
User.current.update do |u|
|
137
|
+
u.email = params[:email]
|
138
|
+
end
|
133
139
|
end
|
134
140
|
flash.info! :changes_saved.t
|
135
141
|
render :profile
|
@@ -259,20 +265,25 @@ module Olelo
|
|
259
265
|
|
260
266
|
def show_page
|
261
267
|
@menu_versions = true
|
262
|
-
|
268
|
+
render(:show, :locals => {:content => page.try(:content)})
|
263
269
|
end
|
264
270
|
|
265
|
-
get '/
|
271
|
+
get '/(:path)', :tail => true do
|
266
272
|
begin
|
267
|
-
@page = Page.find!(params[:path]
|
273
|
+
@page = Page.find!(params[:path])
|
268
274
|
cache_control :version => page.version
|
269
275
|
show_page
|
270
276
|
rescue NotFound
|
271
|
-
redirect build_path(params[:path], :action => :new)
|
272
|
-
raise
|
277
|
+
redirect build_path(params[:path], :action => :new)
|
273
278
|
end
|
274
279
|
end
|
275
280
|
|
281
|
+
get '/version/:version(/:path)' do
|
282
|
+
@page = Page.find!(params[:path], params[:version])
|
283
|
+
cache_control :version => page.version
|
284
|
+
show_page
|
285
|
+
end
|
286
|
+
|
276
287
|
post '/(:path)', :tail => true do
|
277
288
|
action, @close = params[:action].to_s.split('-', 2)
|
278
289
|
if respond_to? "post_#{action}"
|
data/lib/olelo/config.rb
CHANGED
data/lib/olelo/extensions.rb
CHANGED
@@ -49,18 +49,6 @@ class Module
|
|
49
49
|
end
|
50
50
|
include(Module.new { define_method(name, &block) })
|
51
51
|
end
|
52
|
-
|
53
|
-
if method(:const_defined?).arity == 1
|
54
|
-
# Ruby 1.8
|
55
|
-
def local_const_defined?(const)
|
56
|
-
const_defined?(const)
|
57
|
-
end
|
58
|
-
else
|
59
|
-
# Ruby 1.9
|
60
|
-
def local_const_defined?(const)
|
61
|
-
const_defined?(const, false)
|
62
|
-
end
|
63
|
-
end
|
64
52
|
end
|
65
53
|
|
66
54
|
class Hash
|
data/lib/olelo/helper.rb
CHANGED
data/lib/olelo/initializer.rb
CHANGED
@@ -15,7 +15,7 @@ module Olelo
|
|
15
15
|
init_locale
|
16
16
|
init_templates
|
17
17
|
init_plugins
|
18
|
-
|
18
|
+
show_routes if Olelo.logger.debug?
|
19
19
|
init_scripts
|
20
20
|
end
|
21
21
|
|
@@ -41,7 +41,7 @@ module Olelo
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def init_plugins
|
44
|
-
# Load locales
|
44
|
+
# Load locales provided by plugins
|
45
45
|
Plugin.after(:load) { Locale.load(File.join(File.dirname(file), 'locale.yml')) }
|
46
46
|
|
47
47
|
# Configure plugin system
|
@@ -52,16 +52,13 @@ module Olelo
|
|
52
52
|
Plugin.start
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
56
|
-
Application.reserved_paths = Application.router.map do |method, router|
|
57
|
-
router.head.map {|name, pattern, keys, function| pattern }
|
58
|
-
end.flatten
|
55
|
+
def show_routes
|
59
56
|
Application.router.each do |method, router|
|
60
57
|
Olelo.logger.debug method
|
61
58
|
router.each do |name, pattern, keys, function|
|
62
59
|
Olelo.logger.debug "#{name} -> #{pattern.inspect}"
|
63
60
|
end
|
64
|
-
end
|
61
|
+
end
|
65
62
|
end
|
66
63
|
|
67
64
|
def init_scripts
|