instiki 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +165 -0
- data/README +68 -172
- data/app/controllers/admin_controller.rb +94 -0
- data/app/controllers/application.rb +131 -0
- data/app/controllers/file_controller.rb +129 -0
- data/app/controllers/wiki_controller.rb +354 -0
- data/{libraries/view_helper.rb → app/helpers/application_helper.rb} +68 -33
- data/app/models/author.rb +3 -3
- data/app/models/chunks/category.rb +33 -31
- data/app/models/chunks/chunk.rb +86 -20
- data/app/models/chunks/engines.rb +54 -38
- data/app/models/chunks/include.rb +41 -29
- data/app/models/chunks/literal.rb +31 -19
- data/app/models/chunks/nowiki.rb +28 -31
- data/app/models/chunks/test.rb +18 -18
- data/app/models/chunks/uri.rb +182 -97
- data/app/models/chunks/wiki.rb +141 -82
- data/app/models/file_yard.rb +58 -0
- data/app/models/page.rb +112 -86
- data/app/models/page_lock.rb +22 -23
- data/app/models/page_set.rb +89 -64
- data/app/models/revision.rb +123 -90
- data/app/models/web.rb +176 -89
- data/app/models/wiki_content.rb +207 -105
- data/app/models/wiki_service.rb +233 -83
- data/app/models/wiki_words.rb +23 -25
- data/app/views/{wiki/new_system.rhtml → admin/create_system.rhtml} +83 -78
- data/app/views/{wiki/new_web.rhtml → admin/create_web.rhtml} +69 -64
- data/app/views/admin/edit_web.rhtml +136 -0
- data/app/views/file/file.rhtml +19 -0
- data/app/views/file/import.rhtml +23 -0
- data/app/views/layouts/default.rhtml +85 -0
- data/app/views/markdown_help.rhtml +12 -16
- data/app/views/mixed_help.rhtml +7 -0
- data/app/views/navigation.rhtml +30 -19
- data/app/views/rdoc_help.rhtml +12 -16
- data/app/views/textile_help.rhtml +24 -28
- data/app/views/wiki/authors.rhtml +11 -13
- data/app/views/wiki/edit.rhtml +39 -31
- data/app/views/wiki/export.rhtml +12 -14
- data/app/views/wiki/feeds.rhtml +14 -10
- data/app/views/wiki/list.rhtml +64 -57
- data/app/views/wiki/locked.rhtml +23 -14
- data/app/views/wiki/login.rhtml +14 -11
- data/app/views/wiki/new.rhtml +31 -27
- data/app/views/wiki/page.rhtml +115 -81
- data/app/views/wiki/print.rhtml +14 -16
- data/app/views/wiki/published.rhtml +9 -10
- data/app/views/wiki/recently_revised.rhtml +27 -30
- data/app/views/wiki/revision.rhtml +103 -81
- data/app/views/wiki/rollback.rhtml +14 -9
- data/app/views/wiki/rss_feed.rhtml +22 -22
- data/app/views/wiki/search.rhtml +38 -15
- data/app/views/wiki/tex.rhtml +22 -22
- data/app/views/wiki/tex_web.rhtml +34 -34
- data/app/views/wiki/web_list.rhtml +18 -13
- data/app/views/wiki_words_help.rhtml +9 -8
- data/config/environment.rb +82 -0
- data/config/environments/development.rb +5 -0
- data/config/environments/production.rb +4 -0
- data/config/environments/test.rb +17 -0
- data/config/routes.rb +18 -0
- data/instiki +6 -67
- data/instiki.rb +3 -0
- data/lib/active_record_stub.rb +31 -0
- data/{libraries/diff → lib}/diff.rb +444 -475
- data/lib/instiki_errors.rb +15 -0
- data/{libraries → lib}/rdocsupport.rb +151 -155
- data/lib/redcloth_for_tex.rb +736 -0
- data/natives/osx/desktop_launcher/AppDelegate.h +18 -0
- data/natives/osx/desktop_launcher/AppDelegate.mm +109 -0
- data/natives/osx/desktop_launcher/Credits.html +16 -0
- data/natives/osx/desktop_launcher/English.lproj/InfoPlist.strings +0 -0
- data/natives/osx/desktop_launcher/English.lproj/MainMenu.nib/classes.nib +13 -0
- data/natives/osx/desktop_launcher/English.lproj/MainMenu.nib/info.nib +24 -0
- data/natives/osx/desktop_launcher/English.lproj/MainMenu.nib/objects.nib +0 -0
- data/natives/osx/desktop_launcher/Info.plist +13 -0
- data/natives/osx/desktop_launcher/Instiki.xcode/project.pbxproj +592 -0
- data/natives/osx/desktop_launcher/Instiki_Prefix.pch +7 -0
- data/natives/osx/desktop_launcher/MakeDMG.sh +9 -0
- data/natives/osx/desktop_launcher/main.mm +14 -0
- data/natives/osx/desktop_launcher/version.plist +16 -0
- data/public/404.html +6 -0
- data/public/500.html +6 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/javascripts/edit_web.js +52 -0
- data/public/javascripts/prototype.js +336 -0
- data/{app/views/static_style_sheet.rhtml → public/stylesheets/instiki.css} +221 -198
- data/script/breakpointer +4 -0
- data/script/server +93 -0
- metadata +59 -32
- data/app/controllers/wiki.rb +0 -389
- data/app/models/chunks/match.rb +0 -19
- data/app/views/bottom.rhtml +0 -4
- data/app/views/top.rhtml +0 -49
- data/app/views/wiki/edit_web.rhtml +0 -138
- data/libraries/action_controller_servlet.rb +0 -177
- data/libraries/erb.rb +0 -490
- data/libraries/madeleine_service.rb +0 -68
- data/libraries/redcloth_for_tex.rb +0 -869
- data/libraries/web_controller_server.rb +0 -81
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'webrick'
|
2
|
-
include WEBrick
|
3
|
-
|
4
|
-
# Terminology:
|
5
|
-
# * Static controller: Is a controller that has all it's show_* and do_* methods mounted by the server
|
6
|
-
# at server start, so the server will handle request rejection of invalid requests
|
7
|
-
# * Dynamic controller: Is a controller that's mounted with a responsibility to handle all the request mapping
|
8
|
-
# itself. Hence, the server will never reject a request that's below the controller in the path.
|
9
|
-
class WebControllerServer
|
10
|
-
STATIC_MOUNTING = 1
|
11
|
-
DYNAMIC_MOUNTING = 2
|
12
|
-
|
13
|
-
MOUNT_TYPE = DYNAMIC_MOUNTING
|
14
|
-
|
15
|
-
SERVER_TYPE = (RUBY_PLATFORM =~ /mswin/ ? SimpleServer : Daemon)
|
16
|
-
|
17
|
-
def initialize(port, server_type, controller_path)
|
18
|
-
@server = WEBrick::HTTPServer::new(:Port => port, :ServerType => server_type || SERVER_TYPE)
|
19
|
-
@server.logger.info "Your WEBrick server is now running on http://localhost:#{port}"
|
20
|
-
@controller_path = controller_path
|
21
|
-
mount_controllers
|
22
|
-
start_server
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
# Mounts all the controllers in the controller_path according to the mount type
|
27
|
-
def mount_controllers
|
28
|
-
require_controller_files
|
29
|
-
|
30
|
-
case MOUNT_TYPE
|
31
|
-
when STATIC_MOUNTING then controller_names.each { |name| mount_static_controller(name) }
|
32
|
-
when DYNAMIC_MOUNTING then controller_names.each { |name| mount_dynamic_controller(name) }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Mounts the controller specified by <tt>controller_name</tt> to accept all requests below it's path.
|
37
|
-
# If more than one controller is mounted by this WebControllerServer, the controller is mounted by name,
|
38
|
-
# such that fx WikiController would get the requests of "/wiki/something" and "/wiki/some/thing/else".
|
39
|
-
# If only one controller is mounted, all requests to this WebControllerServer is handled by that controller
|
40
|
-
def mount_dynamic_controller(controller_name)
|
41
|
-
mount_path = mounting_multiple_controllers? ? "/#{controller_name}" : "/"
|
42
|
-
@server.mount(mount_path, controller_class(controller_name))
|
43
|
-
end
|
44
|
-
|
45
|
-
# Mount all public show_* and do_* methods as actions tied to the controller specified by <tt>controller_name</tt>.
|
46
|
-
# If more than one controller is mounted by this WebControllerServer, the actions are mounted below the controller
|
47
|
-
# in the path, such as "/wiki/page" or "/wiki/list". If only one controller is mounted, they're mounted directly on
|
48
|
-
# the root, such as "/page" or "/list"
|
49
|
-
def mount_static_controller(controller_name)
|
50
|
-
controller_class(controller_name).public_instance_methods(false).each { |method|
|
51
|
-
mount_path = (mounting_multiple_controllers? ? "/#{controller_name}" : "") + "/#{method}"
|
52
|
-
@server.mount(mount_path, controller_class(controller_name))
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
|
-
# Requires all the controller files that are present in the controller_path
|
57
|
-
def require_controller_files
|
58
|
-
controller_names.each { |controller| require @controller_path + controller }
|
59
|
-
end
|
60
|
-
|
61
|
-
# Returns true if more than one controller exists in the controller_path
|
62
|
-
def mounting_multiple_controllers?
|
63
|
-
controller_names.length > 1
|
64
|
-
end
|
65
|
-
|
66
|
-
# Returns a list of controller names in lower-case from the controller path
|
67
|
-
def controller_names
|
68
|
-
Dir.entries(@controller_path).delete_if { |file| file !~ /rb$/ }.collect{ |c| c[0..-4] }
|
69
|
-
end
|
70
|
-
|
71
|
-
# Returns the class of the controller specified by the <tt>controller_name</tt>
|
72
|
-
def controller_class(controller_name)
|
73
|
-
eval(controller_name.capitalize + "Controller")
|
74
|
-
end
|
75
|
-
|
76
|
-
# Start accepting requests to the defined mount points
|
77
|
-
def start_server
|
78
|
-
trap("INT") { @server.shutdown }
|
79
|
-
@server.start
|
80
|
-
end
|
81
|
-
end
|