Pimki 1.7.092 → 1.8.092
Sign up to get free protection for your applications and to get access to all the features.
- data/README-PIMKI +182 -178
- data/app/controllers/wiki.rb +950 -942
- data/app/models/chunks/category.rb +33 -33
- data/app/models/chunks/category_test.rb +21 -21
- data/app/models/chunks/chunk.rb +20 -20
- data/app/models/chunks/engines.rb +48 -48
- data/app/models/chunks/include.rb +1 -1
- data/app/models/chunks/match.rb +1 -1
- data/app/models/chunks/nowiki.rb +1 -1
- data/app/models/chunks/nowiki_test.rb +5 -0
- data/app/models/chunks/todo.rb +1 -0
- data/app/models/chunks/wiki.rb +130 -130
- data/app/models/page.rb +124 -124
- data/app/models/revision.rb +92 -92
- data/app/models/web.rb +314 -316
- data/app/models/wiki_content.rb +2 -2
- data/app/models/wiki_service.rb +170 -166
- data/app/models/wiki_words.rb +28 -28
- data/app/views/error.rhtml +37 -37
- data/app/views/navigation.rhtml +1 -1
- data/app/views/static_style_sheet.rhtml +10 -5
- data/app/views/top.rhtml +1 -1
- data/app/views/wiki/adv_search.rhtml +61 -61
- data/app/views/wiki/bliki.rhtml +7 -6
- data/app/views/wiki/bliki_edit.rhtml +26 -37
- data/app/views/wiki/bliki_new.rhtml +58 -64
- data/app/views/wiki/bliki_revision.rhtml +5 -3
- data/app/views/wiki/edit.rhtml +44 -44
- data/app/views/wiki/edit_menu.rhtml +26 -19
- data/app/views/wiki/edit_web.rhtml +303 -305
- data/app/views/wiki/glossary.rhtml +35 -27
- data/app/views/wiki/list.rhtml +175 -174
- data/app/views/wiki/list.rhtml.bak +175 -0
- data/app/views/wiki/mind.rhtml +70 -70
- data/app/views/wiki/new.rhtml +34 -32
- data/app/views/wiki/published.rhtml +34 -49
- data/app/views/wiki/revision.rhtml +88 -87
- data/app/views/wiki/rollback.rhtml +36 -35
- data/app/views/wiki/todo.rhtml +2 -2
- data/app/views/wiki_words_help.rhtml +8 -8
- data/libraries/action_controller_servlet.rb +202 -202
- data/libraries/madeleine_service.rb +162 -162
- data/pimki.rb +181 -181
- metadata +11 -12
- data/README +0 -172
- data/app/models/chunks/acronym.rb +0 -19
- data/app/views/wiki/test.rhtml +0 -25
- data/libraries/secure_web_controller_server.rb +0 -106
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.11
|
3
3
|
specification_version: 1
|
4
4
|
name: Pimki
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date: 2005-
|
6
|
+
version: 1.8.092
|
7
|
+
date: 2005-09-15 00:00:00 +10:00
|
8
8
|
summary: "A Personal Information Manager (PIM) based on Instiki's Wiki technology."
|
9
9
|
require_paths:
|
10
10
|
- libraries
|
@@ -27,11 +27,12 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
27
27
|
version: 0.0.0
|
28
28
|
version:
|
29
29
|
platform: ruby
|
30
|
+
signing_key:
|
31
|
+
cert_chain:
|
30
32
|
authors:
|
31
33
|
- Assaph Mehr (based on work by David Heinemeier Hansson)
|
32
34
|
files:
|
33
35
|
- pimki.rb
|
34
|
-
- README
|
35
36
|
- README-PIMKI
|
36
37
|
- favicon.png
|
37
38
|
- "./pimki.rb"
|
@@ -39,8 +40,8 @@ files:
|
|
39
40
|
- app/models
|
40
41
|
- app/views
|
41
42
|
- app/controllers/wiki.rb
|
42
|
-
- app/models/author.rb
|
43
43
|
- app/models/chunks
|
44
|
+
- app/models/author.rb
|
44
45
|
- app/models/page.rb
|
45
46
|
- app/models/page_lock.rb
|
46
47
|
- app/models/page_set.rb
|
@@ -54,7 +55,6 @@ files:
|
|
54
55
|
- app/models/wiki_service_test.rb
|
55
56
|
- app/models/wiki_words.rb
|
56
57
|
- app/models/wiki_words_test.rb
|
57
|
-
- app/models/chunks/acronym.rb
|
58
58
|
- app/models/chunks/category.rb
|
59
59
|
- app/models/chunks/category_test.rb
|
60
60
|
- app/models/chunks/chunk.rb
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- app/models/chunks/wiki.rb
|
72
72
|
- app/models/chunks/wiki_symbols.rb
|
73
73
|
- app/models/chunks/wiki_test.rb
|
74
|
+
- app/views/wiki
|
74
75
|
- app/views/bottom.rhtml
|
75
76
|
- app/views/error.rhtml
|
76
77
|
- app/views/markdown_help.rhtml
|
@@ -81,8 +82,8 @@ files:
|
|
81
82
|
- app/views/style.rhtml
|
82
83
|
- app/views/textile_help.rhtml
|
83
84
|
- app/views/top.rhtml
|
84
|
-
- app/views/wiki
|
85
85
|
- app/views/wiki_words_help.rhtml
|
86
|
+
- app/views/wiki/list.rhtml.bak
|
86
87
|
- app/views/wiki/adv_search.rhtml
|
87
88
|
- app/views/wiki/authors.rhtml
|
88
89
|
- app/views/wiki/bliki.rhtml
|
@@ -110,26 +111,24 @@ files:
|
|
110
111
|
- app/views/wiki/rollback.rhtml
|
111
112
|
- app/views/wiki/rss_feed.rhtml
|
112
113
|
- app/views/wiki/search.rhtml
|
113
|
-
- app/views/wiki/test.rhtml
|
114
114
|
- app/views/wiki/tex.rhtml
|
115
115
|
- app/views/wiki/tex_web.rhtml
|
116
116
|
- app/views/wiki/todo.rhtml
|
117
117
|
- app/views/wiki/web_list.rhtml
|
118
|
+
- libraries/diff
|
118
119
|
- libraries/action_controller_servlet.rb
|
119
120
|
- libraries/bluecloth.rb
|
120
|
-
- libraries/diff
|
121
121
|
- libraries/erb.rb
|
122
|
-
- libraries/madeleine
|
123
122
|
- libraries/madeleine_service.rb
|
124
123
|
- libraries/rdocsupport.rb
|
125
124
|
- libraries/redcloth_2.0.11.rb
|
126
125
|
- libraries/redcloth_for_tex.rb
|
127
126
|
- libraries/redcloth_for_tex_test.rb
|
128
|
-
- libraries/secure_web_controller_server.rb
|
129
127
|
- libraries/view_helper.rb
|
130
128
|
- libraries/web_controller_server.rb
|
131
|
-
- libraries/
|
129
|
+
- libraries/madeleine
|
132
130
|
- libraries/diff/diff_test.rb
|
131
|
+
- libraries/diff/diff.rb
|
133
132
|
- libraries/madeleine/automatic.rb
|
134
133
|
- libraries/madeleine/clock.rb
|
135
134
|
- libraries/madeleine/files.rb
|
data/README
DELETED
@@ -1,172 +0,0 @@
|
|
1
|
-
===What is Instiki?
|
2
|
-
|
3
|
-
Admitted, it's YetAnotherWikiClone[http://c2.com/cgi/wiki?WikiWikiClones], but with a strong focus
|
4
|
-
on simplicity of installation and running:
|
5
|
-
|
6
|
-
Step 1. Download
|
7
|
-
|
8
|
-
Step 2. Run "instiki"
|
9
|
-
|
10
|
-
Step 3. Chuckle... "There's no step three!" (TM)
|
11
|
-
|
12
|
-
You're now running a perfectly suitable wiki on port 2500
|
13
|
-
that'll present you with one-step setup, followed by a textarea for the home page
|
14
|
-
on http://localhost:2500.
|
15
|
-
|
16
|
-
Instiki lowers the barriers of interest for when you might consider
|
17
|
-
using a wiki. It's so simple to get running that you'll find yourself
|
18
|
-
using it for anything -- taking notes, brainstorming, organizing a
|
19
|
-
gathering.
|
20
|
-
|
21
|
-
===Features:
|
22
|
-
* Regular expression search: Find deep stuff really fast
|
23
|
-
* Revisions: Follow the changes on every page from birth. Rollback to an earlier rev
|
24
|
-
* Export to HTML or markup in a zip: Take the entire wiki with you home or for reference
|
25
|
-
* RSS feeds to track recently revised pages
|
26
|
-
* Multiple webs: Create separate wikis with their own namespace
|
27
|
-
* Password-protected webs: Keep it private
|
28
|
-
* Authors: Each revision is associated with an author, so you can see who changed what
|
29
|
-
* Reference tracker: Which other pages are pointing to the current?
|
30
|
-
* Speed: Using Madelein[http://madeleine.sourceforge.net] for persistence (all pages are in memory)
|
31
|
-
* Three markup choices: Textile[http://www.textism.com/tools/textile]
|
32
|
-
(default / RedCloth[http://www.whytheluckystiff.net/ruby/redcloth]),
|
33
|
-
Markdown (BlueCloth[http://bluecloth.rubyforge.org]), and RDoc[http://rdoc.sourceforge.net/doc]
|
34
|
-
* Embedded webserver: Through WEBrick[http://www.webrick.org]
|
35
|
-
* Internationalization: Wiki words in any latin, greek, cyrillian, or armenian characters
|
36
|
-
* Color diffs: Track changes through revisions
|
37
|
-
|
38
|
-
===Missing:
|
39
|
-
* File attachments
|
40
|
-
|
41
|
-
===Install from gem:
|
42
|
-
* Install rubygems
|
43
|
-
* Run "gem install instiki"
|
44
|
-
* Change to a directory where you want Instiki to keep its data files (for example, ~/instiki/)
|
45
|
-
* Run "instiki" - this will create a "storage" directory (for example, ~/instiki/storage), and start a new Wiki service
|
46
|
-
|
47
|
-
Make sure that you always launch Instiki from the same working directory, or specify the storage directory in runtime parameters, such as:
|
48
|
-
instiki --storage ~/instiki/storage
|
49
|
-
|
50
|
-
===Command-line options:
|
51
|
-
* Run "instiki --help"
|
52
|
-
|
53
|
-
===History:
|
54
|
-
* 0.9.2: Rollback takes the user to an edit form. The form has to be submitted for the change to take place.
|
55
|
-
Changed to use inline style on published pages
|
56
|
-
Fixed "forward in time" on the last revision before current page
|
57
|
-
Instiki won't log bogus error messages when creating a new Wiki.
|
58
|
-
Fixed deprecation warning for Object.id (introduced in Ruby 1.8.2)
|
59
|
-
Madeleine upgraded to 0.7.1
|
60
|
-
Madeleine snapshots are compressed
|
61
|
-
Packaged as a gem
|
62
|
-
* 0.9.1: Added performance improvements for updating existing pages
|
63
|
-
Fixed IP logging and RSS feeds behind proxies [With help from Guan Yang]
|
64
|
-
Fixed default storage directory (borked running on Windows) [Spotted by Curt Hibbs]
|
65
|
-
* 0.9.0: Added aliased links such as [[HomePage|that nice home page]] [Mark Reid]
|
66
|
-
Added include other page content with [[!include TableOfContents]] [Mark Reid]
|
67
|
-
Added delete orphan pages from the Edit Web screen [by inspiration from Simon Arnaud]
|
68
|
-
Added logging of IP address for authors (who's behind the rollback wars)
|
69
|
-
Added Categories pages through backlinks (use "categories: news, instiki" on start of line) [Mark Reid]
|
70
|
-
Added option to use bracket-style wiki links only (and hence ban WikiWords)
|
71
|
-
Added command-line option to specify different storage path
|
72
|
-
Added print view without navigation
|
73
|
-
Added character and page (2275 characters including spaces) counter (important for student papers)
|
74
|
-
Off by default, activate it on the Edit Web screen
|
75
|
-
Added LaTeX/PDF integration on Textile installations with pdflatex installed on system (EXPERIMENTAL)
|
76
|
-
Use the home page as a table of contents with a unordered list to control sections
|
77
|
-
Added limit of 15 to the number of pages included in RSS feed
|
78
|
-
Moved static parts of stylesheet to separate file [Lau T�rnskov]
|
79
|
-
Fixed better semantics for revision movement [Ryan Singer]
|
80
|
-
Fixed color diffs to work much better [Xen/Mertz/Atkins]
|
81
|
-
Fixed performance problems for All Pages list [Dennis Mertz]
|
82
|
-
Fixed lots of rendering bugs [Mark Reid]
|
83
|
-
Upgraded to RedCloth 2.0.11 [integrating the fine work of Dennis Mertz]
|
84
|
-
* 0.8.9: Added color diffs to see changes between revisions [Bill Atkins]
|
85
|
-
They're aren't quite perfect yet as new paragraphs split the <ins> tags (hence 0.8.9, not 0.9.0)
|
86
|
-
Added redirect to edit if content of page generates an error
|
87
|
-
(so the page doesn't become unusable on bugs in the markup engines)
|
88
|
-
Fixed update Web with different address bug [Denis Metz]
|
89
|
-
Fixed a bunch of wiki word rendering issues by doing wiki word detection and replacment at once
|
90
|
-
Upgraded to BlueCloth 0.0.3b (should fix loads of problems on Markdown wikis)
|
91
|
-
* 0.8.5: Instiki can now serve as a CMS by running a password-protected web with a published front
|
92
|
-
Added version check at startup (Instiki needs Ruby 1.8.1)
|
93
|
-
* 0.8.1: Actually included RedCloth 2.0.7 in the release
|
94
|
-
* 0.8.0: NOTE: Single-web wikis created in versions prior to 0.8.0 have "instiki" as their system password
|
95
|
-
Accepts wiki words in bracket style. Ex: [[wiki word]], [[c]], [[We could'nt have done it!]]
|
96
|
-
Accepts camel-case wiki words in all latin, greek, cyrillian, and armenian unicode characters
|
97
|
-
Many thanks to Guan Yang for building the higher- and lower-case lookup tables
|
98
|
-
And thanks to Simon Arnaud for the initial patch that got the work started
|
99
|
-
Changed charset to UTF-8
|
100
|
-
Cut down on command-line options and replaced them with an per-web config screen
|
101
|
-
Added option to extend the stylesheet on a per-web basis to tweak the look in details
|
102
|
-
Added simple color options for variety
|
103
|
-
Added option to add/remove password protection on each web
|
104
|
-
Added the wiki name of the author locking a given page (instead of just "someone")
|
105
|
-
Removed single/multi-web distinction -- all Instikis are now multi-web
|
106
|
-
Load libraries from an unshifted load path, so that old installed libraries doesn't clash [Emiel van de Laar]
|
107
|
-
Keeps the author cookie forever, so you don't have to enter your name again and again
|
108
|
-
Fixed XHTML so it validates [Bruce D'Arcus]
|
109
|
-
Authors are no longer listed under orphan pages
|
110
|
-
Added export to markup (great for backups, potentially for switching wiki engine)
|
111
|
-
Don't link wiki words that proceeds from either /, = or ?
|
112
|
-
(http://c2.com/cgi/wiki?WikiWikiClones, /show/HomePage, cgi.pl?show=WikiWord without escaping)
|
113
|
-
Accessing an unexisting page redirects to a different url (/new/PageName)
|
114
|
-
Increased snapshot time to just once a day (cuts down on disk storage requirements)
|
115
|
-
Made RDoc support work better with 1.8.1 [Mauricio Fern�ndez]
|
116
|
-
Added convinient redirect from /wiki/ to /wiki/show/HomePage
|
117
|
-
Fixed BlueCloth bug with backticks at start of line
|
118
|
-
Updated to RedCloth 2.0.7 (and linked to the new Textile reference)
|
119
|
-
* 0.7.0: Added Markdown (BlueCloth) and RDoc [Mauricio Fern�ndez] as command-line markup choices
|
120
|
-
Added wanted and orphan page lists to All pages (only show up if there's actually orphan or wanted pages)
|
121
|
-
Added ISO-8859-1 as XML encoding in RSS feeds (makes FeedReader among others happy for special entities)
|
122
|
-
Added proper links in the RSS feed (but the body links are still relative, which NNW and others doesn't grok)
|
123
|
-
Added access keys: E => Edit, H => HomePage, A => All Pages, U => Recently Revised, X => Export
|
124
|
-
Added password-login through URL (so you can subscribe to feed on a protected web)
|
125
|
-
Added web passwords to the feed links for protected webs, so they work without manual login
|
126
|
-
Added the web name in small letters above all pages within a web
|
127
|
-
Polished authors and recently revised
|
128
|
-
Updated to RedCloth 2.0.6
|
129
|
-
Changed content type for RSS feeds to text/xml (makes Mozilla Aggreg8 happy)
|
130
|
-
Changed searching to be case insensitive
|
131
|
-
Changed HomePage to display the name of the web instead
|
132
|
-
Changed exported HTML pages to be valid XHTML (which can be preprocessed by XSLT)
|
133
|
-
Fixed broken recently revised
|
134
|
-
* 0.6.0: Fixed Windows compatibility [Florian]
|
135
|
-
Fixed bug that would prevent Madeleine from taking snapshots in Daemon mode
|
136
|
-
Added export entire web as HTML in a zip file
|
137
|
-
Added RSS feeds
|
138
|
-
Added proper getops support for the growing number of options [Florian]
|
139
|
-
Added safe mode that forbids style options in RedCloth [Florian]
|
140
|
-
Updated RedCloth to 2.0.5
|
141
|
-
* 0.5.0: NOTE: 0.5.0 is NOT compatible with databases from earlier versions
|
142
|
-
Added revisions
|
143
|
-
Added multiple webs
|
144
|
-
Added password protection for webs on multi-web setups
|
145
|
-
Added the notion of authors (that are saved in a cookie)
|
146
|
-
Added command-line option for not running as a Daemon on Unix
|
147
|
-
* 0.3.1: Added option to escape wiki words with \
|
148
|
-
* 0.3.0: Brought all files into common style (including Textile help on the edit page)
|
149
|
-
Added page locking (if someone already is editing a page there's a warning)
|
150
|
-
Added daemon abilities on Unix (keep Instiki running after you close the terminal)
|
151
|
-
Made port 2500 the default port, so Instiki can be launched by dobbelt-click
|
152
|
-
Added Textile cache to speed-up rendering of large pages
|
153
|
-
Made WikiWords look like "Wiki Words"
|
154
|
-
Updated RedCloth to 2.0.4
|
155
|
-
* 0.2.5: Upgraded to RedCloth 2.0.2 and Madeleine 0.6.1, which means the
|
156
|
-
Windows problems are gone. Also fixed a problem with wikiwords
|
157
|
-
that used part of other wikiwords.
|
158
|
-
* 0.2.0: First public release
|
159
|
-
|
160
|
-
===Download latest from:
|
161
|
-
* http://rubyforge.org/project/showfiles.php?group_id=186
|
162
|
-
|
163
|
-
===Visit the official Instiki wiki:
|
164
|
-
* http://www.instiki.org
|
165
|
-
|
166
|
-
===License:
|
167
|
-
* same as Ruby's
|
168
|
-
|
169
|
-
---
|
170
|
-
Author:: David Heinemeier Hansson
|
171
|
-
Email:: david@loudthinking.com
|
172
|
-
Weblog:: http://www.loudthinking.com
|
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
# This chunk is supposed to pick up acronyms that have been defined on another
|
3
|
-
# page and define them on this page. See glossary for more details.
|
4
|
-
class Acronym < Chunk::Abstract
|
5
|
-
def self.pattern() %r{([A-Z]+)(<\/acronym>)?} end
|
6
|
-
|
7
|
-
def initialize(match_data, revision)
|
8
|
-
super(match_data, revision)
|
9
|
-
@acronym, @defined = match_data[1], match_data[2]
|
10
|
-
end
|
11
|
-
|
12
|
-
def unmask(content)
|
13
|
-
return self if @defined
|
14
|
-
|
15
|
-
definitions = revision.page.web.glossary_items.inject({}) { |hsh, (ac,df), pg| hsh[ac] = df }
|
16
|
-
return self if content.gsub!( Regexp.new(mask(content)), "<acronym title='#{definitions[@acronym]}'>#{@acronym}</acronym>" )
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
data/app/views/wiki/test.rhtml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<script>
|
4
|
-
function getPageName(elem) {
|
5
|
-
if (document.getElementById(elem).value) {
|
6
|
-
document.getElementById(elem).style.color = 'red;' ;
|
7
|
-
} else {
|
8
|
-
document.getElementById(elem).style.color = 'blue;' ;
|
9
|
-
};
|
10
|
-
var xmlhttp=false;
|
11
|
-
xmlhttp = new XMLHttpRequest();
|
12
|
-
|
13
|
-
xmlhttp.open("GET", "/pimki/show/HomePage", true);
|
14
|
-
xmlhttp.onreadystatechange=function() {
|
15
|
-
for(i=0; i< 100000;i++);
|
16
|
-
if (xmlhttp.readyState==4) {
|
17
|
-
document.getElementById(elem).style.color = 'green;' ;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
xmlhttp.send(null);
|
21
|
-
}
|
22
|
-
</script>
|
23
|
-
|
24
|
-
<input type="checkbox" id="todo" name="todo" onClick='getPageName("green");' /><span id='green'>Super green!</span>
|
25
|
-
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'webrick'
|
2
|
-
require 'webrick/https'
|
3
|
-
include WEBrick
|
4
|
-
|
5
|
-
# Terminology:
|
6
|
-
# * Static controller: Is a controller that has all it's show_* and do_* methods mounted by the server
|
7
|
-
# at server start, so the server will handle request rejection of invalid requests
|
8
|
-
# * Dynamic controller: Is a controller that's mounted with a responsibility to handle all the request mapping
|
9
|
-
# itself. Hence, the server will never reject a request that's below the controller in the path.
|
10
|
-
class WebControllerServer
|
11
|
-
STATIC_MOUNTING = 1
|
12
|
-
DYNAMIC_MOUNTING = 2
|
13
|
-
|
14
|
-
MOUNT_TYPE = DYNAMIC_MOUNTING
|
15
|
-
|
16
|
-
SERVER_TYPE = (RUBY_PLATFORM =~ /mswin/ ? SimpleServer : Daemon)
|
17
|
-
|
18
|
-
def WebControllerServer.the_active_server
|
19
|
-
@the_active_server
|
20
|
-
end
|
21
|
-
def WebControllerServer.the_active_server= server
|
22
|
-
@the_active_server = server
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize(port, server_type, controller_path)
|
26
|
-
# Note: This requires Ruby/OpenSSL.
|
27
|
-
@server = WEBrick::HTTPServer.new(
|
28
|
-
:Port => port,
|
29
|
-
:ServerType => server_type || SERVER_TYPE,
|
30
|
-
:SSLEnable => true,
|
31
|
-
:SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
|
32
|
-
:SSLCertName => [ ["C","JP"], ["O","pimki.rubyforge.org"], ["CN", "A Pimki certificate. Only trust web-sites you know!"] ]
|
33
|
-
)
|
34
|
-
|
35
|
-
WebControllerServer::the_active_server = @server
|
36
|
-
@server.logger.info "Your WEBrick server is now running on http://localhost:#{port}"
|
37
|
-
@controller_path = controller_path
|
38
|
-
mount_controllers
|
39
|
-
start_server
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
# Mounts all the controllers in the controller_path according to the mount type
|
44
|
-
def mount_controllers
|
45
|
-
require_controller_files
|
46
|
-
|
47
|
-
case MOUNT_TYPE
|
48
|
-
when STATIC_MOUNTING then controller_names.each { |name| mount_static_controller(name) }
|
49
|
-
when DYNAMIC_MOUNTING then controller_names.each { |name| mount_dynamic_controller(name) }
|
50
|
-
end
|
51
|
-
|
52
|
-
@server.mount('/favicon.ico', FavIconHandler)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Mounts the controller specified by <tt>controller_name</tt> to accept all requests below it's path.
|
56
|
-
# If more than one controller is mounted by this WebControllerServer, the controller is mounted by name,
|
57
|
-
# such that fx WikiController would get the requests of "/wiki/something" and "/wiki/some/thing/else".
|
58
|
-
# If only one controller is mounted, all requests to this WebControllerServer is handled by that controller
|
59
|
-
def mount_dynamic_controller(controller_name)
|
60
|
-
mount_path = mounting_multiple_controllers? ? "/#{controller_name}" : "/"
|
61
|
-
@server.mount(mount_path, controller_class(controller_name))
|
62
|
-
end
|
63
|
-
|
64
|
-
# Mount all public show_* and do_* methods as actions tied to the controller specified by <tt>controller_name</tt>.
|
65
|
-
# If more than one controller is mounted by this WebControllerServer, the actions are mounted below the controller
|
66
|
-
# in the path, such as "/wiki/page" or "/wiki/list". If only one controller is mounted, they're mounted directly on
|
67
|
-
# the root, such as "/page" or "/list"
|
68
|
-
def mount_static_controller(controller_name)
|
69
|
-
controller_class(controller_name).public_instance_methods(false).each { |method|
|
70
|
-
mount_path = (mounting_multiple_controllers? ? "/#{controller_name}" : "") + "/#{method}"
|
71
|
-
@server.mount(mount_path, controller_class(controller_name))
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
# Requires all the controller files that are present in the controller_path
|
76
|
-
def require_controller_files
|
77
|
-
controller_names.each { |controller| require @controller_path + controller }
|
78
|
-
end
|
79
|
-
|
80
|
-
# Returns true if more than one controller exists in the controller_path
|
81
|
-
def mounting_multiple_controllers?
|
82
|
-
controller_names.length > 1
|
83
|
-
end
|
84
|
-
|
85
|
-
# Returns a list of controller names in lower-case from the controller path
|
86
|
-
def controller_names
|
87
|
-
Dir.entries(@controller_path).delete_if { |file| file !~ /rb$/ }.collect{ |c| c[0..-4] }
|
88
|
-
end
|
89
|
-
|
90
|
-
# Returns the class of the controller specified by the <tt>controller_name</tt>
|
91
|
-
def controller_class(controller_name)
|
92
|
-
eval(controller_name.capitalize + "Controller")
|
93
|
-
end
|
94
|
-
|
95
|
-
public
|
96
|
-
|
97
|
-
# Start accepting requests to the defined mount points
|
98
|
-
def start_server
|
99
|
-
@server.start
|
100
|
-
end
|
101
|
-
|
102
|
-
# Stops accepting requests to the defined mount points
|
103
|
-
def shutdown
|
104
|
-
@server.shutdown
|
105
|
-
end
|
106
|
-
end
|