Soks 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.txt +4 -0
- data/lib/helpers/default-helpers.rb +94 -56
- data/lib/helpers/mail2wiki-helper.rb +8 -6
- data/lib/soks-servlet.rb +19 -16
- data/lib/soks-storage.rb +6 -7
- data/lib/soks-utils.rb +26 -0
- data/lib/soks-view.rb +4 -4
- data/lib/soks.rb +2 -1
- data/templates/default/attachment/newpage.js +2 -2
- data/templates/default/attachment/stylesheet.css +14 -3
- data/templates/default/content/A%20page%20with%20an%20umlaut%20%F6%20in%20its%20title.textile +1 -0
- data/templates/default/content/All%20News.textile +18 -1
- data/templates/default/content/Bil%20Kleb.textile +1 -0
- data/templates/default/content/Bil.textile +1 -0
- data/templates/default/content/Bill%20Wood.textile +3 -0
- data/templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +1 -0
- data/templates/default/content/Bug%3A%20Type%20a%20title%20here.textile +31 -0
- data/templates/default/content/How%20to%20use%20the%20keyboard%20shortcuts.textile +4 -2
- data/templates/default/content/Latest%20News.textile +19 -2
- data/templates/default/content/List%20of%20changes.textile +43 -0
- data/templates/default/content/New%20Recent%20Changes%20class.textile +10 -0
- data/templates/default/content/News%3A%20Version%200%2E0%2E6%20Released.textile +13 -0
- data/templates/default/content/Planned%20Features.textile +9 -8
- data/templates/default/content/README.textile +4 -0
- data/templates/default/content/Recent%20Changes%20to%20This%20Site.textile +282 -205
- data/templates/default/content/Skorgu.textile +3 -0
- data/templates/default/content/ctrl%2Dn.textile +1 -1
- data/templates/default/content/sandbox.textile +20 -0
- data/templates/default/start.rb +15 -5
- data/templates/default/version.txt +1 -1
- data/templates/default/views/Page_edit.rhtml +6 -3
- data/templates/default/views/frame.rhtml +3 -2
- data/test/test_soks-storage.rb +69 -0
- data/test/test_soks-utils.rb +84 -0
- data/test/test_soks-view.rb +43 -0
- metadata +14 -11
- data/templates/default/content/Attached%20ruby%20logo.textile +0 -1
- data/templates/default/content/Attached%20test%20thing.textile +0 -1
- data/templates/default/content/Known%20bugs.textile +0 -18
- data/templates/default/content/Picture%20of%20Type%20a%20title%20here.textile +0 -1
- data/templates/default/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile +0 -1
- data/templates/default/content/Picture%20of%20powered%20by%20ruby%20logo.textile +0 -1
- data/templates/default/content/Recent%20News.textile +0 -9
- data/templates/default/content/Type%20a%20title%20here.textile +0 -1
@@ -22,7 +22,9 @@
|
|
22
22
|
</ul>
|
23
23
|
</div>
|
24
24
|
|
25
|
-
<form class='editpage' method='post' action='<%= url pagename, "save" %>' >
|
25
|
+
<form class='editpage' method='post' action='<%= url pagename, "save" %>' >
|
26
|
+
<fieldset>
|
27
|
+
|
26
28
|
<div id='edittitle'>
|
27
29
|
Title:
|
28
30
|
<input name='newtitle'
|
@@ -37,10 +39,11 @@
|
|
37
39
|
<textarea name='content'
|
38
40
|
rows=30
|
39
41
|
cols=65
|
40
|
-
|
41
|
-
><%= page.content %></textarea>
|
42
|
+
onfocus="if( this.value == 'Type what you want here and click save' ) { this.value = '' }" ><%= page.content %></textarea>
|
42
43
|
</div>
|
43
44
|
|
45
|
+
</fieldset>
|
46
|
+
|
44
47
|
Hello <a href='<%= url person %>'><%= person %></a> (Quit browser to log out). Would you like to
|
45
48
|
<input name='action' value='Save Changes' type='submit' accesskey="S" /></form>,
|
46
49
|
<form class='editpage' method='post' action='<%= url pagename %>' >
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<input class='search'
|
28
28
|
name='regex'
|
29
29
|
value='Enter word & press return'
|
30
|
-
|
30
|
+
onfocus="this.value=this.value.replace('Enter word & press return','')"
|
31
31
|
size='17' />
|
32
32
|
</form>
|
33
33
|
|
@@ -39,6 +39,7 @@
|
|
39
39
|
|
40
40
|
<% if page %>
|
41
41
|
<% dynamic_links = page.links_to - sidebarpage.links_from - [ sidebarpage ] %>
|
42
|
+
<% dynamic_links.delete_if { |page| page.name =~ /^Site Index ([a-z]|Other)\./i } %>
|
42
43
|
<% unless dynamic_links.empty? %>
|
43
44
|
<h2>Pages that link here</h2>
|
44
45
|
<div class='linklist'>
|
@@ -57,6 +58,6 @@
|
|
57
58
|
</div>
|
58
59
|
|
59
60
|
<h2>Powered by <a href='http://www.soks.org'>Soks</a></h2>
|
60
|
-
</div> <!-- menu
|
61
|
+
</div> <!-- menu -->
|
61
62
|
</body>
|
62
63
|
</html>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'soks-storage'
|
4
|
+
|
5
|
+
class MockWiki
|
6
|
+
include WikiFlatFileStore
|
7
|
+
|
8
|
+
def initialize( folder )
|
9
|
+
@folder = folder
|
10
|
+
@pages = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def mutate( pagename )
|
14
|
+
p yield( @pages[pagename.downcase] ||= Page.new( pagename ) )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class TestWikiFlatFileStore < Test::Unit::TestCase
|
19
|
+
include FileUtils
|
20
|
+
|
21
|
+
def setup
|
22
|
+
@wiki = MockWiki.new(folder)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_rename
|
26
|
+
create_file 'a handy file.textile', 'hello world'
|
27
|
+
assert_equal( ['a handy file.textile'], files )
|
28
|
+
@wiki.move_files_if_names_are_not_url_encoded
|
29
|
+
assert_equal( ['a%20handy%20file.textile'], files )
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_remove_unwanted_characters
|
33
|
+
create_file 'a&b.textile', 'hello world'
|
34
|
+
assert_equal( ['a&b.textile'], files )
|
35
|
+
@wiki.move_files_if_names_are_not_url_encoded
|
36
|
+
assert_equal( ['ab.textile'], files )
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_avoid_overwriting_on_rename
|
40
|
+
create_file 'a&b.textile', 'hello world'
|
41
|
+
create_file 'ab.textile', 'hello world'
|
42
|
+
assert_equal( ['a&b.textile','ab.textile'], files )
|
43
|
+
@wiki.move_files_if_names_are_not_url_encoded
|
44
|
+
assert_equal( ['ab.textile','ab1.textile'], files )
|
45
|
+
end
|
46
|
+
|
47
|
+
def teardown
|
48
|
+
rmtree( folder )
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def create_file( name, content )
|
54
|
+
File.open( File.join( folder, name ), 'w') { |f| f.puts content }
|
55
|
+
end
|
56
|
+
|
57
|
+
def files
|
58
|
+
Dir.entries( folder ).delete_if { |name| name =~ /^\.+$/ }
|
59
|
+
end
|
60
|
+
|
61
|
+
def folder
|
62
|
+
@folder ||= make_folder
|
63
|
+
end
|
64
|
+
|
65
|
+
def make_folder
|
66
|
+
mkdir( 'testcontent' )
|
67
|
+
'testcontent'
|
68
|
+
end
|
69
|
+
end
|
data/test/test_soks-utils.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'soks-utils'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
class ToTimeUnitsMT < Test::Unit::TestCase
|
5
6
|
|
@@ -34,4 +35,87 @@ class ToTimeUnitsMT < Test::Unit::TestCase
|
|
34
35
|
assert_equal( 'year', (60*60*24*30*14).to_time_units )
|
35
36
|
assert_equal( '11 years', (60*60*24*365*11).to_time_units )
|
36
37
|
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class TimeSameDay < Test::Unit::TestCase
|
41
|
+
|
42
|
+
def test_simple
|
43
|
+
other_day = Time.local(2005,04,01,9,30)
|
44
|
+
assert( other_day.same_day?( Time.local(2005,04,01,23,59) ) )
|
45
|
+
assert( other_day.same_day?( Time.local(2005,04,01,0,0) ) )
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_not_match
|
49
|
+
other_day = Time.local(2005,04,01,9,30)
|
50
|
+
assert_equal( false, other_day.same_day?( Time.local(2004,04,02,9,30) ) )
|
51
|
+
assert_equal( false, other_day.same_day?( Time.local(2004,03,01,9,30) ) )
|
52
|
+
assert_equal( false, other_day.same_day?( Time.local(2003,04,01,9,30) ) )
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class StringToValidPageName < Test::Unit::TestCase
|
57
|
+
|
58
|
+
def test_punctuation
|
59
|
+
assert_equal( 'abcdefghijklm', 'a/b\\c[d]e?f{g}h&i^j`k<l>m'.to_valid_pagename )
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_trailing_space
|
63
|
+
assert_equal( 'abcdefghijklm', ' abcdefghijklm '.to_valid_pagename )
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class FileUniqueFilename < Test::Unit::TestCase
|
68
|
+
include FileUtils
|
69
|
+
|
70
|
+
def teardown
|
71
|
+
rmtree( folder )
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_no_collision
|
75
|
+
assert_equal( 'ok.txt', File.unique_filename( folder, 'ok.txt' ) )
|
76
|
+
create_file 'ok.jpg', ''
|
77
|
+
assert_equal( 'ok.txt', File.unique_filename( folder, 'ok.txt' ) )
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_whitespace
|
81
|
+
assert_equal( 'ok.txt', File.unique_filename( folder, 'o k.txt' ) )
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_collision
|
85
|
+
assert_equal( 'ok.txt', File.unique_filename( folder, 'ok.txt' ) )
|
86
|
+
create_file 'ok.txt', ''
|
87
|
+
assert_equal( 'ok1.txt', File.unique_filename( folder, 'ok.txt' ) )
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_numbered_collision
|
91
|
+
assert_equal( 'ok1.txt', File.unique_filename( folder, 'ok1.txt' ) )
|
92
|
+
create_file 'ok1.txt', ''
|
93
|
+
assert_equal( 'ok11.txt', File.unique_filename( folder, 'ok1.txt' ) )
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_high_number_collision
|
97
|
+
create_file 'ok.txt', ''
|
98
|
+
1.upto( 9 ) { |n| create_file "ok#{n}.txt", '' }
|
99
|
+
assert_equal( 'ok10.txt', File.unique_filename( folder, 'ok.txt' ) )
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def create_file( name, content )
|
105
|
+
File.open( File.join( folder, name ), 'w') { |f| f.puts content }
|
106
|
+
end
|
107
|
+
|
108
|
+
def files
|
109
|
+
Dir.entries( folder ).delete_if { |name| name =~ /^\.+$/ }
|
110
|
+
end
|
111
|
+
|
112
|
+
def folder
|
113
|
+
@folder ||= make_folder
|
114
|
+
end
|
115
|
+
|
116
|
+
def make_folder
|
117
|
+
mkdir( 'testcontent' )
|
118
|
+
'testcontent'
|
119
|
+
end
|
120
|
+
|
37
121
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'contrib/redcloth-3.0.3'
|
3
|
+
require 'soks-view'
|
4
|
+
|
5
|
+
class TestBruteMatch < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@match = BruteMatch.new
|
9
|
+
@match['one'] = :one
|
10
|
+
@match['two'] = :two
|
11
|
+
@match['one two'] = :one_two
|
12
|
+
@match['two three'] = :two_three
|
13
|
+
@match['three: four'] = :three_colon_four
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_basic
|
17
|
+
assert_equal( [['three: four',:three_colon_four],['two',:two]], match('two three: four or more') )
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_case
|
21
|
+
assert_equal( [['One',:one]] , match('One') )
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_length
|
25
|
+
assert_equal( [['one two',:one_two]], match("a one two\nthree four") )
|
26
|
+
assert_equal( [['two three',:two_three],['one',:one]], match('a one two three four') )
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_fullwords
|
30
|
+
assert_equal( [['two',:two]], match('aone two.') )
|
31
|
+
assert_equal( [['two three',:two_three]], match('two three: fourormore') )
|
32
|
+
end
|
33
|
+
|
34
|
+
def match( text )
|
35
|
+
matches = []
|
36
|
+
@match.match( text ) { |m,p|
|
37
|
+
matches << [m,p]
|
38
|
+
"$1"
|
39
|
+
}
|
40
|
+
matches
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
|
|
3
3
|
specification_version: 1
|
4
4
|
name: Soks
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2005-03-
|
6
|
+
version: 0.0.7
|
7
|
+
date: 2005-03-21
|
8
8
|
summary: Yet another wiki.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -12,7 +12,7 @@ require_paths:
|
|
12
12
|
email: tamc@rubyforge.org
|
13
13
|
homepage: http://rubyforge.org/projects/soks/
|
14
14
|
rubyforge_project:
|
15
|
-
description:
|
15
|
+
description: Another Ruby Wiki. See http://www.soks.org for details
|
16
16
|
autorequire: soks
|
17
17
|
default_executable:
|
18
18
|
bindir: bin
|
@@ -80,18 +80,22 @@ files:
|
|
80
80
|
- templates/default/attachment/rss.png
|
81
81
|
- templates/default/attachment/stylesheet.css
|
82
82
|
- templates/default/attachment/tiny-logo thumb.bmp
|
83
|
+
- templates/default/content/A%20page%20with%20an%20umlaut%20%F6%20in%20its%20title.textile
|
83
84
|
- templates/default/content/All%20News.textile
|
84
85
|
- templates/default/content/Api%20for%20classes%20to%20modify%20the%20wiki.textile
|
85
|
-
- templates/default/content/Attached%20ruby%20logo.textile
|
86
|
-
- templates/default/content/Attached%20test%20thing.textile
|
87
86
|
- templates/default/content/Author.textile
|
88
87
|
- templates/default/content/Automatic%20linking%20between%20pages.textile
|
89
88
|
- templates/default/content/Automatic%20Summaries.textile
|
89
|
+
- templates/default/content/Bil%20Kleb.textile
|
90
|
+
- templates/default/content/Bil.textile
|
91
|
+
- templates/default/content/Bill%20Wood.textile
|
90
92
|
- templates/default/content/bug%3A%20competing%20edits.textile
|
93
|
+
- templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile
|
91
94
|
- templates/default/content/Bug%3A%20GEM%20limits%20title%20lengths.textile
|
92
95
|
- templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile
|
93
96
|
- templates/default/content/Bug%3A%20RSS%20feed%20does%20not%20validate.textile
|
94
97
|
- templates/default/content/Bug%3A%20Textile%20mishandles%20paragraphs.textile
|
98
|
+
- templates/default/content/Bug%3A%20Type%20a%20title%20here.textile
|
95
99
|
- templates/default/content/Bug%3A%20Unanticipated%20Rollbacks.textile
|
96
100
|
- templates/default/content/ctrl%2Dn.textile
|
97
101
|
- templates/default/content/Home%20Page.textile
|
@@ -108,30 +112,27 @@ files:
|
|
108
112
|
- templates/default/content/How%20to%20use%20the%20keyboard%20shortcuts.textile
|
109
113
|
- templates/default/content/How%20to%20use%20this%20wiki.textile
|
110
114
|
- templates/default/content/Instructions%20and%20Howtos.textile
|
111
|
-
- templates/default/content/Known%20bugs.textile
|
112
115
|
- templates/default/content/Latest%20News.textile
|
113
116
|
- templates/default/content/let%20me%20know.textile
|
114
117
|
- templates/default/content/List%20of%20changes.textile
|
115
118
|
- templates/default/content/New%20page%20templates%20or%20categories%20code.textile
|
116
119
|
- templates/default/content/New%20Recent%20Changes%20class.textile
|
120
|
+
- templates/default/content/News%3A%20Version%200%2E0%2E6%20Released.textile
|
117
121
|
- templates/default/content/Per%20Wiki%20Templates.textile
|
118
|
-
- templates/default/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile
|
119
122
|
- templates/default/content/Picture%20of%20a%20pair%20of%20soks.textile
|
120
|
-
- templates/default/content/Picture%20of%20powered%20by%20ruby%20logo.textile
|
121
|
-
- templates/default/content/Picture%20of%20Type%20a%20title%20here.textile
|
122
123
|
- templates/default/content/Planned%20Features.textile
|
123
124
|
- templates/default/content/README.textile
|
124
125
|
- templates/default/content/Recent%20Blog%20Entries.textile
|
125
126
|
- templates/default/content/Recent%20Changes%20to%20This%20Site.textile
|
126
|
-
- templates/default/content/Recent%20News.textile
|
127
127
|
- templates/default/content/RSS%20feed.textile
|
128
128
|
- templates/default/content/Ruby.textile
|
129
|
+
- templates/default/content/sandbox.textile
|
129
130
|
- templates/default/content/Sidebar%20Page.textile
|
131
|
+
- templates/default/content/Skorgu.textile
|
130
132
|
- templates/default/content/SOKS%20features.textile
|
131
133
|
- templates/default/content/Soks%20Licence.textile
|
132
134
|
- templates/default/content/tamc.textile
|
133
135
|
- templates/default/content/tamc2.textile
|
134
|
-
- templates/default/content/Type%20a%20title%20here.textile
|
135
136
|
- templates/default/views/frame.rhtml
|
136
137
|
- templates/default/views/messages.yaml
|
137
138
|
- templates/default/views/Page_content.rhtml
|
@@ -143,7 +144,9 @@ files:
|
|
143
144
|
- templates/default/views/Page_search_results.rhtml
|
144
145
|
- templates/default/views/Page_view.rhtml
|
145
146
|
- templates/default/views/UploadPage_edit.rhtml
|
147
|
+
- test/test_soks-storage.rb
|
146
148
|
- test/test_soks-utils.rb
|
149
|
+
- test/test_soks-view.rb
|
147
150
|
- LICENSE.txt
|
148
151
|
- README.txt
|
149
152
|
test_files: []
|
@@ -1 +0,0 @@
|
|
1
|
-
page deleted
|
@@ -1 +0,0 @@
|
|
1
|
-
content moved to [[Attached ruby logo]]
|
@@ -1,18 +0,0 @@
|
|
1
|
-
h2. Known bugs
|
2
|
-
|
3
|
-
p{font-size: x-small;}. Known bugs was created automatically from pages whose title matches /^Bug:/i.
|
4
|
-
|
5
|
-
<automaticsummary>
|
6
|
-
|
7
|
-
* [[ Bug: Does not make use of if-modified-since request headers ]] revised on 2005 Jan 25 18:23 by AutomaticImport
|
8
|
-
* [[ Bug: GEM limits title lengths ]] revised on 2005 Jan 26 08:55 by tamc2
|
9
|
-
* [[ Bug: notextile does not prevent page inserts ]] revised on 2005 Feb 12 12:00 by tamc2
|
10
|
-
* [[ Bug: RSS feed does not validate ]] revised on 2005 Mar 15 16:24 by tamc2
|
11
|
-
* [[ Bug: Unanticipated Rollbacks ]] revised on 2005 Mar 08 05:50 by Bil Kleb
|
12
|
-
* [[ Bug: Textile mishandles paragraphs ]] revised on 2005 Mar 09 05:13 by tamc2
|
13
|
-
* [[ bug: competing edits ]] revised on 2005 Mar 10 14:47 by tamc2
|
14
|
-
|
15
|
-
|
16
|
-
</automaticsummary>
|
17
|
-
|
18
|
-
How to report a bug
|
@@ -1 +0,0 @@
|
|
1
|
-
page deleted
|
data/templates/default/content/Picture%20of%20a%20logo%20for%20the%20ruby%20language.textile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
/attachment/ruby.gif
|
@@ -1 +0,0 @@
|
|
1
|
-
content moved to [[Picture of a logo for the ruby language]]
|
@@ -1 +0,0 @@
|
|
1
|
-
content moved to [[Bug: Search textarea and button rendered w/o vertical separation?]]
|