gf-Soks 1.0.4
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/LICENSE.txt +66 -0
- data/README.txt +64 -0
- data/bin/soks-create-wiki.rb +193 -0
- data/contrib/diff/lcs.rb +1105 -0
- data/contrib/diff/lcs/array.rb +21 -0
- data/contrib/diff/lcs/block.rb +51 -0
- data/contrib/diff/lcs/callbacks.rb +322 -0
- data/contrib/diff/lcs/change.rb +169 -0
- data/contrib/diff/lcs/hunk.rb +257 -0
- data/contrib/diff/lcs/ldiff.rb +226 -0
- data/contrib/diff/lcs/string.rb +19 -0
- data/contrib/diff_licence.txt +76 -0
- data/contrib/easyprompt.rb +58 -0
- data/contrib/easyprompt_licence.txt +504 -0
- data/contrib/redcloth-3.0.3.rb +1113 -0
- data/contrib/redcloth_license.txt +27 -0
- data/lib/authenticators.rb +121 -0
- data/lib/helpers/counter-helpers.rb +132 -0
- data/lib/helpers/default-helpers.rb +416 -0
- data/lib/helpers/mail2wiki-helper.rb +105 -0
- data/lib/helpers/maintenance-helpers.rb +149 -0
- data/lib/helpers/rss2wiki-helper.rb +47 -0
- data/lib/helpers/wiki2html.rb +60 -0
- data/lib/soks-model.rb +271 -0
- data/lib/soks-servlet.rb +177 -0
- data/lib/soks-storage.rb +187 -0
- data/lib/soks-upgrade-0.0.2.rb +70 -0
- data/lib/soks-utils.rb +327 -0
- data/lib/soks-view.rb +399 -0
- data/lib/soks.rb +27 -0
- data/rakefile +109 -0
- data/templates/default/attachment/favicon.ico +0 -0
- data/templates/default/attachment/logo.jpg +0 -0
- data/templates/default/attachment/logo.png +0 -0
- data/templates/default/attachment/logo.tiff +0 -0
- data/templates/default/attachment/newpage.js +41 -0
- data/templates/default/attachment/print_stylesheet.css +2 -0
- data/templates/default/attachment/robots.txt +6 -0
- data/templates/default/attachment/rss.png +0 -0
- data/templates/default/attachment/stylesheet.css +219 -0
- data/templates/default/banned_titles.txt +67 -0
- data/templates/default/caches/readme.txt +1 -0
- data/templates/default/content/Api%20for%20classes%20to%20modify%20the%20wiki.textile +30 -0
- data/templates/default/content/Author.textile +16 -0
- data/templates/default/content/Automatic%20Summaries.textile +40 -0
- data/templates/default/content/Automatic%20counters.textile +22 -0
- data/templates/default/content/Automatic%20exporters.textile +23 -0
- data/templates/default/content/Automatic%20importers.textile +59 -0
- data/templates/default/content/Automatic%20linking.textile +7 -0
- data/templates/default/content/Automatic%20maintenance%20helpers.textile +39 -0
- data/templates/default/content/Bug%3A%20Competing%20edits.textile +22 -0
- data/templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +3 -0
- data/templates/default/content/Bug%3A%20Email%20adresses%20in%20page%20titles%20cause%20incorrec.textile +3 -0
- data/templates/default/content/Bug%3A%20GEM%20limits%20title%20lengths.textile +3 -0
- data/templates/default/content/Bug%3A%20Memory%20leak.textile +13 -0
- data/templates/default/content/Bug%3A%20Page%2Einserted%5Finto%20is%20never%20purged.textile +17 -0
- data/templates/default/content/Bug%3A%20Pages%20that%20link%20here%20may%20not%20appear%20on%20r.textile +13 -0
- data/templates/default/content/Bug%3A%20Textile%20mishandles%20paragraphs.textile +37 -0
- data/templates/default/content/Bug%3A%20Unanticipated%20Rollbacks.textile +23 -0
- data/templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +3 -0
- data/templates/default/content/Home%20Page.textile +22 -0
- data/templates/default/content/How%20to%20administrate%20this%20wiki.textile +57 -0
- data/templates/default/content/How%20to%20change%20the%20way%20this%20wiki%20looks.textile +32 -0
- data/templates/default/content/How%20to%20export%20a%20site%20from%20this%20wiki.textile +82 -0
- data/templates/default/content/How%20to%20get%20the%20latest%20Soks%20from%20cvs.textile +45 -0
- data/templates/default/content/How%20to%20hack%20soks.textile +66 -0
- data/templates/default/content/How%20to%20import%20a%20site%20from%20instiki.textile +15 -0
- data/templates/default/content/How%20to%20import%20data.textile +41 -0
- data/templates/default/content/How%20to%20install%20Soks.textile +33 -0
- data/templates/default/content/How%20to%20password%20protect%20your%20wiki.textile +53 -0
- data/templates/default/content/How%20to%20re%2Dbuild%20the%20page%20cache.textile +71 -0
- data/templates/default/content/How%20to%20report%20a%20bug.textile +9 -0
- data/templates/default/content/How%20to%20upgrade%20soks.textile +32 -0
- data/templates/default/content/How%20to%20use%20the%20Automatic%20Helper%20classes.textile +12 -0
- data/templates/default/content/How%20to%20use%20this%20wiki.textile +30 -0
- data/templates/default/content/List%20of%20changes.textile +10 -0
- data/templates/default/content/News%3A%20Version%201%2D0%2D0%20released.textile +19 -0
- data/templates/default/content/News%3A%20Version%201%2D0%2D1%20released.textile +12 -0
- data/templates/default/content/Pages%20to%20include%20in%20the%20distribution.textile +55 -0
- data/templates/default/content/Per%20Wiki%20Templates.textile +37 -0
- data/templates/default/content/Picture%20of%20a%20pair%20of%20soks.textile +1 -0
- data/templates/default/content/Planned%20Features.textile +74 -0
- data/templates/default/content/README.textile +64 -0
- data/templates/default/content/RSS%20feed.textile +9 -0
- data/templates/default/content/Recent%20changes%20to%20this%20site.textile +352 -0
- data/templates/default/content/SOKS%20features.textile +19 -0
- data/templates/default/content/Sidebar%20Page.textile +6 -0
- data/templates/default/content/Site%20Index.textile +241 -0
- data/templates/default/content/Soks%27s%20Licence.textile +66 -0
- data/templates/default/content/Tag%3A%20Include%20this%20page%20in%20the%20distribution.textile +6 -0
- data/templates/default/start.rb +90 -0
- data/templates/default/version.txt +1 -0
- data/templates/default/views/Page_content.rhtml +1 -0
- data/templates/default/views/Page_edit.rhtml +79 -0
- data/templates/default/views/Page_find.rhtml +35 -0
- data/templates/default/views/Page_linksfromrss.rhtml +24 -0
- data/templates/default/views/Page_listrss.rhtml +46 -0
- data/templates/default/views/Page_meta.rhtml +44 -0
- data/templates/default/views/Page_print.rhtml +6 -0
- data/templates/default/views/Page_revision.rhtml +39 -0
- data/templates/default/views/Page_revisions.rhtml +36 -0
- data/templates/default/views/Page_rss.rhtml +57 -0
- data/templates/default/views/Page_view.rhtml +8 -0
- data/templates/default/views/UploadPage_edit.rhtml +63 -0
- data/templates/default/views/frame.rhtml +63 -0
- data/templates/default/views/messages.yaml +7 -0
- data/test/html/2006Mar.html +66 -0
- data/test/html/poignant.html +36 -0
- data/test/html/poignant.textile +36 -0
- data/test/mock-objects.rb +69 -0
- data/test/test_counter-helper.rb +162 -0
- data/test/test_soks-helper-maintenance.rb +106 -0
- data/test/test_soks-helpers.rb +145 -0
- data/test/test_soks-model.rb +144 -0
- data/test/test_soks-servlet.rb +240 -0
- data/test/test_soks-storage.rb +108 -0
- data/test/test_soks-utils.rb +226 -0
- data/test/test_soks-view.rb +193 -0
- data/test/test_soks.rb +9 -0
- metadata +182 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
require 'soks-utils'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
class ToTimeUnitsMT < Test::Unit::TestCase
|
|
6
|
+
|
|
7
|
+
def test_seconds
|
|
8
|
+
assert_equal( 'fraction of a second', 0.4.to_time_units )
|
|
9
|
+
assert_equal( 'second', 0.8.to_time_units )
|
|
10
|
+
assert_equal( 'second', 1.3.to_time_units )
|
|
11
|
+
assert_equal( '5 seconds', 5.to_time_units )
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_minutes
|
|
15
|
+
assert_equal( 'minute', 46.to_time_units )
|
|
16
|
+
assert_equal( '10 minutes', (60*10.4).to_time_units )
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_hours
|
|
20
|
+
assert_equal( 'hour', (60*60*1.2).to_time_units )
|
|
21
|
+
assert_equal( '2 hours', (60*60*1.8).to_time_units )
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_days
|
|
25
|
+
assert_equal( 'day', (60*60*24*0.95).to_time_units )
|
|
26
|
+
assert_equal( '20 days', (60*60*24*20).to_time_units )
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_months
|
|
30
|
+
assert_equal( 'month', (60*60*24*30*1.1).to_time_units )
|
|
31
|
+
assert_equal( '10 months', (60*60*24*30*10).to_time_units )
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_years
|
|
35
|
+
assert_equal( 'year', (60*60*24*30*14).to_time_units )
|
|
36
|
+
assert_equal( '11 years', (60*60*24*365*11).to_time_units )
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class TimeSameDayTest < 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 StringToValidPageNameTest < 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 FileUniqueFilenameTest < 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_strip_everything_but_the_name
|
|
85
|
+
assert_equal( 'tamcpicture.jpg', File.unique_filename( folder,'/home/tamc/good\ stuff/tamc\ picture.jpg') )
|
|
86
|
+
assert_equal( 'bil_kleb1.jpg', File.unique_filename( folder,'C:\Documents and Settings\AB\Desktop\bil_kleb1.jpg') )
|
|
87
|
+
assert_equal( 'bil_kleb1.jpg', File.unique_filename( folder,'C:\Documents and Settings\AB\Desktop\bil_*$kleb1.jpg') )
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_collision
|
|
91
|
+
assert_equal( 'ok.txt', File.unique_filename( folder, 'ok.txt' ) )
|
|
92
|
+
create_file 'ok.txt', ''
|
|
93
|
+
assert_equal( 'ok1.txt', File.unique_filename( folder, 'ok.txt' ) )
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_numbered_collision
|
|
97
|
+
assert_equal( 'ok1.txt', File.unique_filename( folder, 'ok1.txt' ) )
|
|
98
|
+
create_file 'ok1.txt', ''
|
|
99
|
+
assert_equal( 'ok11.txt', File.unique_filename( folder, 'ok1.txt' ) )
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def test_high_number_collision
|
|
103
|
+
create_file 'ok.txt', ''
|
|
104
|
+
1.upto( 9 ) { |n| create_file "ok#{n}.txt", '' }
|
|
105
|
+
assert_equal( 'ok10.txt', File.unique_filename( folder, 'ok.txt' ) )
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
private
|
|
109
|
+
|
|
110
|
+
def create_file( name, content )
|
|
111
|
+
File.open( File.join( folder, name ), 'w') { |f| f.puts content }
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def files
|
|
115
|
+
Dir.entries( folder ).delete_if { |name| name =~ /^\.+$/ }
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def folder
|
|
119
|
+
@folder ||= make_folder
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def make_folder
|
|
123
|
+
mkdir( 'testcontent' )
|
|
124
|
+
'testcontent'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
class TimeNextText < Test::Unit::TestCase
|
|
130
|
+
|
|
131
|
+
def test_next_second
|
|
132
|
+
assert_equal( Time.local(2004,12,31,23,0,1), Time.local(2004,12,31,23,0,0).next(:sec) )
|
|
133
|
+
assert_equal( Time.local(2005,1,1), Time.local(2004,12,31,23,59,59).next(:sec) )
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def test_next_minute
|
|
137
|
+
assert_equal( Time.local(2004,12,31,23,1), Time.local(2004,12,31,23,0).next(:min) )
|
|
138
|
+
assert_equal( Time.local(2005,1,1), Time.local(2004,12,31,23,59).next(:min) )
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def test_next_hour
|
|
142
|
+
assert_equal( Time.local(2004,12,31,23,0), Time.local(2004,12,31,22,59).next(:hour) )
|
|
143
|
+
assert_equal( Time.local(2005,1,1), Time.local(2004,12,31,23).next(:hour) )
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def test_next_day
|
|
147
|
+
assert_equal( Time.local(2004,12,31,0,0), Time.local(2004,12,30,22,00).next(:day) )
|
|
148
|
+
assert_equal( Time.local(2005,1,1), Time.local(2004,12,31,23).next(:day) )
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def test_next_month
|
|
152
|
+
assert_equal( Time.local(2004,12), Time.local(2004,11,30,22,00).next(:month) )
|
|
153
|
+
assert_equal( Time.local(2005,1,1), Time.local(2004,12,31,23).next(:month) )
|
|
154
|
+
assert_equal( Time.local(2005,2,1), Time.local(2005,1,31).next(:month) )
|
|
155
|
+
assert_equal( Time.local(2005,2), Time.local(2005,1).next(:month) )
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def test_next_year
|
|
159
|
+
assert_equal( Time.local(2005), Time.local(2004,11,30,22,00).next(:year) )
|
|
160
|
+
assert_equal( Time.local(2005,1,1), Time.local(2004,12,31,23).next(:year) )
|
|
161
|
+
assert_equal( Time.local(2006), Time.local(2005).next(:year) )
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
class DaysFromTest < Test::Unit::TestCase
|
|
167
|
+
|
|
168
|
+
def test_days_from
|
|
169
|
+
t1 = Time.local( 2005,01,01,19,27)
|
|
170
|
+
assert_equal(0, t1.days_from( t1 ) )
|
|
171
|
+
assert_equal(-1, t1.days_from( Time.local( 2005,01,02 ) ) )
|
|
172
|
+
assert_equal(1, t1.days_from( Time.local( 2004,12,31 ) ) )
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
class RelativeDayTest < Test::Unit::TestCase
|
|
178
|
+
|
|
179
|
+
def test_today
|
|
180
|
+
assert_equal("Today", Time.now.relative_day )
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def test_yesterday
|
|
184
|
+
assert_equal(-1, (Time.now-24*60*60).days_from( Time.now ) )
|
|
185
|
+
assert_equal("Yesterday", (Time.now-24*60*60).relative_day)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def test_some_time_ago
|
|
189
|
+
some_time_ago = Time.now - (10*24*60*60)
|
|
190
|
+
assert_equal(some_time_ago.strftime('%d %b'), some_time_ago.relative_day)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def test_long_time_ago
|
|
194
|
+
some_time_ago = Time.now - (400*24*60*60)
|
|
195
|
+
assert_equal(some_time_ago.strftime('%d %b %Y'), some_time_ago.relative_day)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
class PeriodicNotificationTest < Test::Unit::TestCase
|
|
201
|
+
|
|
202
|
+
def test_seconds
|
|
203
|
+
time_at_last_call = Time.now
|
|
204
|
+
total_time_between_calls = 0
|
|
205
|
+
total_number_of_calls = 0
|
|
206
|
+
PeriodicNotification.new(:second) do |period|
|
|
207
|
+
total_time_between_calls = total_time_between_calls + (Time.now - time_at_last_call)
|
|
208
|
+
time_at_last_call = Time.now
|
|
209
|
+
total_number_of_calls += 1
|
|
210
|
+
end
|
|
211
|
+
sleep( 3 )
|
|
212
|
+
assert_equal( 3, total_number_of_calls )
|
|
213
|
+
assert_equal( 1, (total_time_between_calls/total_number_of_calls).round )
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
class StringDiffsTest < Test::Unit::TestCase
|
|
219
|
+
|
|
220
|
+
def test_simple
|
|
221
|
+
version_one = "A\nB\nC\n"
|
|
222
|
+
version_two = "A\nC\nC\n"
|
|
223
|
+
assert_equal( [[['-',1,'B'],['+',1,'C']]], version_two.changes_from( version_one ) )
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'mock-objects'
|
|
4
|
+
require 'generator'
|
|
5
|
+
|
|
6
|
+
class TestBruteMatch < Test::Unit::TestCase
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@match = BruteMatch.new
|
|
10
|
+
@match['one'] = :one
|
|
11
|
+
@match['two'] = :two
|
|
12
|
+
@match['one two'] = :one_two
|
|
13
|
+
@match['two three'] = :two_three
|
|
14
|
+
@match['three: four'] = :three_colon_four
|
|
15
|
+
@match['2005 Mar'] = :a_date
|
|
16
|
+
@match["l'equipe"] = :the_team
|
|
17
|
+
@match["Site Index" ] = :index
|
|
18
|
+
@match["Site Index A."] = :index_a
|
|
19
|
+
@match[".Site Index A."] = :dot_index_a
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_basic
|
|
23
|
+
assert_equal( [['three: four',:three_colon_four],['two',:two]], match('two three: four or more') )
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_case
|
|
27
|
+
assert_equal( [['One',:one]] , match('One') )
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_length
|
|
31
|
+
assert_equal( [['one two',:one_two]], match("a one two\nthree four") )
|
|
32
|
+
assert_equal( [['two three',:two_three],['one',:one]], match('a one two three four') )
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_fullwords
|
|
36
|
+
assert_equal( [['two',:two]], match('aone two!') )
|
|
37
|
+
assert_equal( [['two three',:two_three]], match('two three: fourormore') )
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_number_match
|
|
41
|
+
assert_equal( [['2005 Mar',:a_date]], match('forward to 2005 Mar >') )
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_single_quote
|
|
45
|
+
assert_equal( [["L'EQUIPE",:the_team]], match("Oh! L'EQUIPE? C'est...") )
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_index
|
|
49
|
+
assert_equal( :index_a, @match['site index a.'])
|
|
50
|
+
assert_equal( [['Site Index',:index]],match("Site Index B. ball") )
|
|
51
|
+
assert_equal( [['Site Index A.',:index_a]],match("Site Index A. ball") )
|
|
52
|
+
assert_equal( [['.Site Index A.',:dot_index_a]],match(".Site Index A. ball") )
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_do_not_match
|
|
56
|
+
assert_equal [], match("Oh! L'EQUIPE? C'est...", ["l'equipe"])
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def match( text, do_not_match = [] )
|
|
60
|
+
matches = []
|
|
61
|
+
@match.match( text, do_not_match ) { |m,p|
|
|
62
|
+
matches << [m,p]
|
|
63
|
+
"$1"
|
|
64
|
+
}
|
|
65
|
+
matches
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class TestView < Test::Unit::TestCase
|
|
70
|
+
include TearDownableWiki
|
|
71
|
+
|
|
72
|
+
def test_url_name_for_page_name
|
|
73
|
+
assert_equal('Testpage', @view.url_name_for_page_name('TestPage'))
|
|
74
|
+
assert_equal('APageWithPunctuation', @view.url_name_for_page_name('a, page! \'with PuNcTuation?'))
|
|
75
|
+
assert_equal('APageWithPunctuation-2', @view.url_name_for_page_name('!a, page! \'with PuNcTuation'))
|
|
76
|
+
assert_equal('APageWithPunctuation-3', @view.url_name_for_page_name('.a, page! \'with PuNcTuation'))
|
|
77
|
+
assert_equal("PunctuationOnlyInTitle", @view.url_name_for_page_name('!!!'))
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_page_name_for_url_name
|
|
81
|
+
assert_equal('UnknownPage', @view.page_name_for_url_name('UnknownPage'))
|
|
82
|
+
assert_equal('Unknown Page!', @view.page_name_for_url_name('Unknown Page!'))
|
|
83
|
+
@wiki.revise('Unknown Page!','hello world','urltest')
|
|
84
|
+
@wiki.revise('Unknown Page?','hello world','urltest')
|
|
85
|
+
assert_equal('Unknown Page!', @view.page_name_for_url_name('UnknownPage'))
|
|
86
|
+
assert_equal('Unknown Page?', @view.page_name_for_url_name('UnknownPage-2'))
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_moved_page_name_for_url_name
|
|
90
|
+
@wiki.revise('capital page','stuff','test')
|
|
91
|
+
assert_equal('capital page', @view.page_name_for_url_name('CapitalPage'))
|
|
92
|
+
@wiki.move('capital page','Capital Page','test')
|
|
93
|
+
assert_equal('Capital Page', @view.page_name_for_url_name('CapitalPage'))
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_render
|
|
97
|
+
@wiki.revise('test view','hello world','tamc2')
|
|
98
|
+
assert_equal('hello world', @wiki.page('test view').content )
|
|
99
|
+
assert_match( /<p>hello world<\/p>/, @view.render( 'test view' ) )
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
class TestErbHelper < Test::Unit::TestCase
|
|
104
|
+
include TearDownableWiki
|
|
105
|
+
|
|
106
|
+
def test_url
|
|
107
|
+
assert_equal( 'http://testsite.com/view/HomePage', @view.url( 'home page' ) )
|
|
108
|
+
assert_equal( 'http://testsite.com/edit/HomePage', @view.url( 'home page','edit' ) )
|
|
109
|
+
assert_equal( 'http://testsite.com/view/LHomePage', @view.url( "l'home page" ) )
|
|
110
|
+
assert_equal( 'http://testsite.com/view/LHomePage-2', @view.url( "l'home page?" ) )
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
class TestPagesTextile < Test::Unit::TestCase
|
|
115
|
+
include TearDownableWiki
|
|
116
|
+
|
|
117
|
+
def test_page
|
|
118
|
+
page = Page.new('test page')
|
|
119
|
+
page.revise('hello world!','test_person')
|
|
120
|
+
assert_equal('hello world!', page.textile )
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_image_page
|
|
124
|
+
page = ImagePage.new('test image page')
|
|
125
|
+
page.revise('/attached/hello.jpg','test_person')
|
|
126
|
+
assert_equal('!http://testsite.com/attached/hello.jpg!:http://testsite.com/view/TestImagePage', page.textile(@view) )
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def test_attachment_page
|
|
130
|
+
page = AttachmentPage.new('test attachment page')
|
|
131
|
+
page.revise('/attached/hello.jpg','test_person')
|
|
132
|
+
assert_equal("[[ test attachment page => http://testsite.com/attached/hello.jpg ]]\n", page.textile(@view) )
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class TestWikiRedCloth < Test::Unit::TestCase
|
|
137
|
+
include TearDownableWiki
|
|
138
|
+
|
|
139
|
+
def setup
|
|
140
|
+
super
|
|
141
|
+
AutomaticUpdateCrossLinks.new( @wiki, @view )
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def test_basics
|
|
145
|
+
@view.revise( 'textile basics', IO.readlines('test/html/Poignant.textile').join, '_why' )
|
|
146
|
+
wait_for_queue_to_empty
|
|
147
|
+
page = @wiki.page('textile basics')
|
|
148
|
+
desired_html = IO.readlines('test/html/Poignant.html').join.gsub( /\n+/, "\n" )
|
|
149
|
+
actual_html = @view.redcloth( page ).gsub( /\n+/, "\n" )
|
|
150
|
+
SyncEnumerator.new(desired_html,actual_html).each do |desired,actual|
|
|
151
|
+
assert_equal( desired, actual )
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def test_apostrophe_in_title
|
|
156
|
+
@view.revise("L'equipe",'a test page','tamc2')
|
|
157
|
+
@view.revise('test apostrophe',"go L'equipe!",'tamc2')
|
|
158
|
+
wait_for_queue_to_empty
|
|
159
|
+
assert_equal("<p>go <a href='http://testsite.com/view/LEquipe' class='automatic'>L'equipe</a>!</p>",html('test apostrophe'))
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def test_quotes_in_title
|
|
163
|
+
@view.revise('A "great page" of stuff','a test page','tamc2')
|
|
164
|
+
@view.revise('test quotes in title','A "great page" of stuff','tamc2')
|
|
165
|
+
wait_for_queue_to_empty
|
|
166
|
+
assert_equal( %q{<p><a href='http://testsite.com/view/AGreatPageOfStuff' class='automatic'>A "great page" of stuff</a></p>},html('test quotes in title'))
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def test_dont_match_the_page_title
|
|
170
|
+
@view.revise('Ruby','a page about ruby','tamc2')
|
|
171
|
+
@view.revise('not ruby','a page about ruby','tamc2')
|
|
172
|
+
wait_for_queue_to_empty
|
|
173
|
+
assert_equal( %q{<p>a page about <a href='http://testsite.com/view/Ruby' class='automatic'>ruby</a></p>},html('not ruby'))
|
|
174
|
+
assert_equal( %q{<p>a page about ruby</p>},html('ruby'))
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def test_wiki_links
|
|
178
|
+
@view.revise('test1','[[test => a wonderfull page?great=good ]]','tamc2')
|
|
179
|
+
@view.revise('test2','[[test => /edit/a wonderfull page?great =good ]]','tamc2')
|
|
180
|
+
@view.revise('test3','[[test => /revision/a wonderfull page?great=good?revision=1 ]]','tamc2')
|
|
181
|
+
wait_for_queue_to_empty
|
|
182
|
+
assert_equal( %q{<a href='http://testsite.com/view/AWonderfullPageGreatGood' class='missing'>test</a>},html('test1'))
|
|
183
|
+
assert_equal( %q{<a href='http://testsite.com/edit/AWonderfullPageGreatGood-2' class='missing'>test</a>},html('test2'))
|
|
184
|
+
assert_equal( %q{<a href='http://testsite.com/revision/AWonderfullPageGreatGood?revision=1' class='missing'>test</a>},html('test3'))
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
private
|
|
188
|
+
|
|
189
|
+
def html( page_name )
|
|
190
|
+
@view.redcloth(@view.page(page_name))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|
data/test/test_soks.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gf-Soks
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Tom Counsell
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-07-09 00:00:00 -07:00
|
|
13
|
+
default_executable: soks-create-wiki.rb
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: Another Ruby Wiki. See http://www.soks.org for details
|
|
17
|
+
email: tamc@rubyforge.org
|
|
18
|
+
executables:
|
|
19
|
+
- soks-create-wiki.rb
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- LICENSE.txt
|
|
24
|
+
- README.txt
|
|
25
|
+
files:
|
|
26
|
+
- LICENSE.txt
|
|
27
|
+
- bin/soks-create-wiki.rb
|
|
28
|
+
- contrib/diff/lcs.rb
|
|
29
|
+
- contrib/diff/lcs/array.rb
|
|
30
|
+
- contrib/diff/lcs/block.rb
|
|
31
|
+
- contrib/diff/lcs/callbacks.rb
|
|
32
|
+
- contrib/diff/lcs/change.rb
|
|
33
|
+
- contrib/diff/lcs/hunk.rb
|
|
34
|
+
- contrib/diff/lcs/ldiff.rb
|
|
35
|
+
- contrib/diff/lcs/string.rb
|
|
36
|
+
- contrib/diff_licence.txt
|
|
37
|
+
- contrib/easyprompt.rb
|
|
38
|
+
- contrib/easyprompt_licence.txt
|
|
39
|
+
- contrib/redcloth-3.0.3.rb
|
|
40
|
+
- contrib/redcloth_license.txt
|
|
41
|
+
- lib/authenticators.rb
|
|
42
|
+
- lib/helpers/counter-helpers.rb
|
|
43
|
+
- lib/helpers/default-helpers.rb
|
|
44
|
+
- lib/helpers/mail2wiki-helper.rb
|
|
45
|
+
- lib/helpers/maintenance-helpers.rb
|
|
46
|
+
- lib/helpers/rss2wiki-helper.rb
|
|
47
|
+
- lib/helpers/wiki2html.rb
|
|
48
|
+
- lib/soks-model.rb
|
|
49
|
+
- lib/soks-servlet.rb
|
|
50
|
+
- lib/soks-storage.rb
|
|
51
|
+
- lib/soks-upgrade-0.0.2.rb
|
|
52
|
+
- lib/soks-utils.rb
|
|
53
|
+
- lib/soks-view.rb
|
|
54
|
+
- lib/soks.rb
|
|
55
|
+
- rakefile
|
|
56
|
+
- templates/default/attachment/favicon.ico
|
|
57
|
+
- templates/default/attachment/logo.jpg
|
|
58
|
+
- templates/default/attachment/logo.png
|
|
59
|
+
- templates/default/attachment/logo.tiff
|
|
60
|
+
- templates/default/attachment/newpage.js
|
|
61
|
+
- templates/default/attachment/print_stylesheet.css
|
|
62
|
+
- templates/default/attachment/robots.txt
|
|
63
|
+
- templates/default/attachment/rss.png
|
|
64
|
+
- templates/default/attachment/stylesheet.css
|
|
65
|
+
- templates/default/banned_titles.txt
|
|
66
|
+
- templates/default/caches/readme.txt
|
|
67
|
+
- templates/default/content/Api%20for%20classes%20to%20modify%20the%20wiki.textile
|
|
68
|
+
- templates/default/content/Author.textile
|
|
69
|
+
- templates/default/content/Automatic%20Summaries.textile
|
|
70
|
+
- templates/default/content/Automatic%20counters.textile
|
|
71
|
+
- templates/default/content/Automatic%20exporters.textile
|
|
72
|
+
- templates/default/content/Automatic%20importers.textile
|
|
73
|
+
- templates/default/content/Automatic%20linking.textile
|
|
74
|
+
- templates/default/content/Automatic%20maintenance%20helpers.textile
|
|
75
|
+
- templates/default/content/Bug%3A%20Competing%20edits.textile
|
|
76
|
+
- templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile
|
|
77
|
+
- templates/default/content/Bug%3A%20Email%20adresses%20in%20page%20titles%20cause%20incorrec.textile
|
|
78
|
+
- templates/default/content/Bug%3A%20GEM%20limits%20title%20lengths.textile
|
|
79
|
+
- templates/default/content/Bug%3A%20Memory%20leak.textile
|
|
80
|
+
- templates/default/content/Bug%3A%20Page%2Einserted%5Finto%20is%20never%20purged.textile
|
|
81
|
+
- templates/default/content/Bug%3A%20Pages%20that%20link%20here%20may%20not%20appear%20on%20r.textile
|
|
82
|
+
- templates/default/content/Bug%3A%20Textile%20mishandles%20paragraphs.textile
|
|
83
|
+
- templates/default/content/Bug%3A%20Unanticipated%20Rollbacks.textile
|
|
84
|
+
- templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile
|
|
85
|
+
- templates/default/content/Home%20Page.textile
|
|
86
|
+
- templates/default/content/How%20to%20administrate%20this%20wiki.textile
|
|
87
|
+
- templates/default/content/How%20to%20change%20the%20way%20this%20wiki%20looks.textile
|
|
88
|
+
- templates/default/content/How%20to%20export%20a%20site%20from%20this%20wiki.textile
|
|
89
|
+
- templates/default/content/How%20to%20get%20the%20latest%20Soks%20from%20cvs.textile
|
|
90
|
+
- templates/default/content/How%20to%20hack%20soks.textile
|
|
91
|
+
- templates/default/content/How%20to%20import%20a%20site%20from%20instiki.textile
|
|
92
|
+
- templates/default/content/How%20to%20import%20data.textile
|
|
93
|
+
- templates/default/content/How%20to%20install%20Soks.textile
|
|
94
|
+
- templates/default/content/How%20to%20password%20protect%20your%20wiki.textile
|
|
95
|
+
- templates/default/content/How%20to%20re%2Dbuild%20the%20page%20cache.textile
|
|
96
|
+
- templates/default/content/How%20to%20report%20a%20bug.textile
|
|
97
|
+
- templates/default/content/How%20to%20upgrade%20soks.textile
|
|
98
|
+
- templates/default/content/How%20to%20use%20the%20Automatic%20Helper%20classes.textile
|
|
99
|
+
- templates/default/content/How%20to%20use%20this%20wiki.textile
|
|
100
|
+
- templates/default/content/List%20of%20changes.textile
|
|
101
|
+
- templates/default/content/News%3A%20Version%201%2D0%2D0%20released.textile
|
|
102
|
+
- templates/default/content/News%3A%20Version%201%2D0%2D1%20released.textile
|
|
103
|
+
- templates/default/content/Pages%20to%20include%20in%20the%20distribution.textile
|
|
104
|
+
- templates/default/content/Per%20Wiki%20Templates.textile
|
|
105
|
+
- templates/default/content/Picture%20of%20a%20pair%20of%20soks.textile
|
|
106
|
+
- templates/default/content/Planned%20Features.textile
|
|
107
|
+
- templates/default/content/README.textile
|
|
108
|
+
- templates/default/content/RSS%20feed.textile
|
|
109
|
+
- templates/default/content/Recent%20changes%20to%20this%20site.textile
|
|
110
|
+
- templates/default/content/SOKS%20features.textile
|
|
111
|
+
- templates/default/content/Sidebar%20Page.textile
|
|
112
|
+
- templates/default/content/Site%20Index.textile
|
|
113
|
+
- templates/default/content/Soks%27s%20Licence.textile
|
|
114
|
+
- templates/default/content/Tag%3A%20Include%20this%20page%20in%20the%20distribution.textile
|
|
115
|
+
- templates/default/start.rb
|
|
116
|
+
- templates/default/version.txt
|
|
117
|
+
- templates/default/views/Page_content.rhtml
|
|
118
|
+
- templates/default/views/Page_edit.rhtml
|
|
119
|
+
- templates/default/views/Page_find.rhtml
|
|
120
|
+
- templates/default/views/Page_linksfromrss.rhtml
|
|
121
|
+
- templates/default/views/Page_listrss.rhtml
|
|
122
|
+
- templates/default/views/Page_meta.rhtml
|
|
123
|
+
- templates/default/views/Page_print.rhtml
|
|
124
|
+
- templates/default/views/Page_revision.rhtml
|
|
125
|
+
- templates/default/views/Page_revisions.rhtml
|
|
126
|
+
- templates/default/views/Page_rss.rhtml
|
|
127
|
+
- templates/default/views/Page_view.rhtml
|
|
128
|
+
- templates/default/views/UploadPage_edit.rhtml
|
|
129
|
+
- templates/default/views/frame.rhtml
|
|
130
|
+
- templates/default/views/messages.yaml
|
|
131
|
+
- test/html/2006Mar.html
|
|
132
|
+
- test/html/poignant.html
|
|
133
|
+
- test/html/poignant.textile
|
|
134
|
+
- test/mock-objects.rb
|
|
135
|
+
- test/test_counter-helper.rb
|
|
136
|
+
- test/test_soks-helper-maintenance.rb
|
|
137
|
+
- test/test_soks-helpers.rb
|
|
138
|
+
- test/test_soks-model.rb
|
|
139
|
+
- test/test_soks-servlet.rb
|
|
140
|
+
- test/test_soks-storage.rb
|
|
141
|
+
- test/test_soks-utils.rb
|
|
142
|
+
- test/test_soks-view.rb
|
|
143
|
+
- test/test_soks.rb
|
|
144
|
+
- README.txt
|
|
145
|
+
has_rdoc: false
|
|
146
|
+
homepage: http://rubyforge.org/projects/soks/
|
|
147
|
+
post_install_message:
|
|
148
|
+
rdoc_options:
|
|
149
|
+
- --charset=UTF-8
|
|
150
|
+
require_paths:
|
|
151
|
+
- lib
|
|
152
|
+
- contrib
|
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
|
+
requirements:
|
|
155
|
+
- - ">="
|
|
156
|
+
- !ruby/object:Gem::Version
|
|
157
|
+
version: "0"
|
|
158
|
+
version:
|
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
|
+
requirements:
|
|
161
|
+
- - ">="
|
|
162
|
+
- !ruby/object:Gem::Version
|
|
163
|
+
version: "0"
|
|
164
|
+
version:
|
|
165
|
+
requirements: []
|
|
166
|
+
|
|
167
|
+
rubyforge_project:
|
|
168
|
+
rubygems_version: 1.2.0
|
|
169
|
+
signing_key:
|
|
170
|
+
specification_version: 3
|
|
171
|
+
summary: Yet another wiki.
|
|
172
|
+
test_files:
|
|
173
|
+
- test/mock-objects.rb
|
|
174
|
+
- test/test_counter-helper.rb
|
|
175
|
+
- test/test_soks-helper-maintenance.rb
|
|
176
|
+
- test/test_soks-helpers.rb
|
|
177
|
+
- test/test_soks-model.rb
|
|
178
|
+
- test/test_soks-servlet.rb
|
|
179
|
+
- test/test_soks-storage.rb
|
|
180
|
+
- test/test_soks-utils.rb
|
|
181
|
+
- test/test_soks-view.rb
|
|
182
|
+
- test/test_soks.rb
|