Soks 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. data/README.txt +2 -17
  2. data/lib/helpers/default-helpers.rb +42 -41
  3. data/lib/soks-utils.rb +7 -1
  4. data/lib/soks-view.rb +5 -2
  5. data/lib/soks.rb +2 -2
  6. data/templates/default/content/Author.textile +2 -1
  7. data/templates/default/content/{Automatic%20linking%20between%20pages.textile → Automatic%20linking.textile} +1 -1
  8. data/templates/default/content/Home%20Page.textile +2 -2
  9. data/templates/default/content/How%20to%20get%20the%20latest%20Soks%20from%20cvs.textile +33 -11
  10. data/templates/default/content/How%20to%20hack%20soks.textile +1 -1
  11. data/templates/default/content/List%20of%20changes.textile +5 -131
  12. data/templates/default/content/News%3A%20Version%201%2D0%2D1%20released.textile +1 -1
  13. data/templates/default/content/Pages%20to%20include%20in%20the%20distribution.textile +5 -2
  14. data/templates/default/content/Planned%20Features.textile +12 -2
  15. data/templates/default/content/README.textile +2 -17
  16. data/templates/default/content/Recent%20changes%20to%20this%20site.textile +150 -123
  17. data/templates/default/content/SOKS%20features.textile +8 -9
  18. data/templates/default/content/Sidebar%20Page.textile +3 -0
  19. data/templates/default/content/Site%20Index.textile +17 -2
  20. data/templates/default/content/{Soks%20Licence.textile → Soks%27s%20Licence.textile} +0 -0
  21. data/templates/default/version.txt +1 -1
  22. data/templates/default/views/frame.rhtml +2 -2
  23. data/test/test_counter-helper.rb +25 -21
  24. data/test/test_soks-helpers.rb +46 -5
  25. data/test/test_soks-view.rb +14 -2
  26. data/test/test_soks.rb +9 -0
  27. metadata +5 -5
  28. data/templates/default/content/How%20to%20use%20the%20keyboard%20shortcuts.textile +0 -17
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -17,9 +17,9 @@
17
17
 
18
18
  <div id='menu'>
19
19
 
20
- <h1><%= @wikiname %></h1>
20
+ <h1><%= self.name %></h1>
21
21
  <a href='<%= url 'Home Page' %>' accesskey='H' >
22
- <img width='149' src='<%= file 'logo.jpg' %>' alt='<%= @wikiname %>' />
22
+ <img width='149' src='<%= file 'logo.jpg' %>' alt='<%= self.name %>' />
23
23
  </a>
24
24
 
25
25
  <h2>Search</h2>
@@ -49,14 +49,16 @@ class TestViewCountHelper < Test::Unit::TestCase
49
49
  test_page_count
50
50
  @wiki.notify( :test_event )
51
51
  wait_for_queue_to_empty
52
- desired_content = "h1. Popular Pages\n\n"
53
- desired_content << "Count since #{start_time}. Updated on #{@wiki.page('Popular Pages').revised_on}\n\n"
54
- desired_content << "| count1 | 3 |\n"
55
- desired_content << "| count2 | 2 |\n"
56
- desired_content << "| 1 others | 1 |\n"
57
- desired_content << "| *Total* | *6* |\n"
58
- assert_equal( desired_content, @wiki.page('Popular Pages').content)
52
+ content = @wiki.page('Popular Pages').content.split "\n"
53
+ [ [ 0, "h1. Popular Pages" ],
54
+ [ 4, "| count1 | 3 |" ],
55
+ [ 5, "| count2 | 2 |" ],
56
+ [ 6, "| 1 others | 1 |" ],
57
+ [ 7, "| *Total* | *6* |" ] ].each do |i,line|
58
+ assert_equal line, content[i]
59
+ end
59
60
  end
61
+
60
62
  end
61
63
 
62
64
  class TestViewerCountHelper < Test::Unit::TestCase
@@ -103,13 +105,14 @@ class TestViewerCountHelper < Test::Unit::TestCase
103
105
  test_viewer_count
104
106
  @wiki.notify( :test_event )
105
107
  wait_for_queue_to_empty
106
- desired_content = "h1. Popular Pages\n\n"
107
- desired_content << "Count since #{start_time}. Updated on #{@wiki.page('Popular Pages').revised_on}\n\n"
108
- desired_content << "| Author1 | 3 |\n"
109
- desired_content << "| Author2 | 2 |\n"
110
- desired_content << "| 1 others | 1 |\n"
111
- desired_content << "| *Total* | *6* |\n"
112
- assert_equal( desired_content, @wiki.page('Popular Pages').content)
108
+ content = @wiki.page('Popular Pages').content.split "\n"
109
+ [ [ 0, "h1. Popular Pages" ],
110
+ [ 4, "| Author1 | 3 |" ],
111
+ [ 5, "| Author2 | 2 |" ],
112
+ [ 6, "| 1 others | 1 |" ],
113
+ [ 7, "| *Total* | *6* |" ] ].each do |i,line|
114
+ assert_equal line, content[i]
115
+ end
113
116
  end
114
117
  end
115
118
 
@@ -147,12 +150,13 @@ class TestAuthorCountHelper < Test::Unit::TestCase
147
150
  test_author_count
148
151
  @wiki.notify( :test_event )
149
152
  wait_for_queue_to_empty
150
- desired_content = "h1. Principal Authors\n\n"
151
- desired_content << "Count since #{start_time}. Updated on #{@wiki.page('Popular Pages').revised_on}\n\n"
152
- desired_content << "| t1 | 3 |\n"
153
- desired_content << "| t2 | 2 |\n"
154
- desired_content << "| 1 others | 1 |\n"
155
- desired_content << "| *Total* | *6* |\n"
156
- assert_equal( desired_content, @wiki.page('Principal Authors').content)
153
+ content = @wiki.page('Principal Authors').content.split "\n"
154
+ [ [ 0, "h1. Principal Authors" ],
155
+ [ 4, "| t1 | 3 |" ],
156
+ [ 5, "| t2 | 2 |" ],
157
+ [ 6, "| 1 others | 1 |" ],
158
+ [ 7, "| *Total* | *6* |" ] ].each do |i,line|
159
+ assert_equal line, content[i]
160
+ end
157
161
  end
158
162
  end
@@ -4,6 +4,47 @@ require 'mock-objects'
4
4
  require 'helpers/default-helpers'
5
5
  require 'generator'
6
6
 
7
+ class TestAutomaticSummary < Test::Unit::TestCase
8
+ include TearDownableWiki
9
+
10
+ def test_basics
11
+ AutomaticSummary.new( @wiki, 'automatic summary' ) { |page| page.name =~ /hello/i }
12
+ @wiki.revise 'hello world', 'hello world', 'test author'
13
+ @wiki.revise 'hello john', 'hello john', 'test author'
14
+ @wiki.revise 'hello frank', 'hello frank', 'test author'
15
+ @wiki.revise 'hello frank', 'page deleted', 'test author'
16
+ @wiki.revise 'goodbye world', 'goodbye world', 'test author'
17
+ wait_for_queue_to_empty
18
+ content = @wiki.page('automatic summary').content
19
+ assert_match /hello world/, content
20
+ assert_match /hello john/, content
21
+ assert_no_match /goodbye world/, content
22
+ assert_no_match /hello frank/, content
23
+ end
24
+
25
+ def test_updates_on_revision
26
+ as = AutomaticSummary.new( @wiki, 'update on revision test' ) { |page| page.name =~ /summarise/i }
27
+ @wiki.revise('summarise 1','initial content','test author')
28
+ wait_for_queue_to_empty
29
+ assert_match(/initial content/,@wiki.page('update on revision test').content )
30
+ @wiki.revise('summarise 1','updated content','test author')
31
+ wait_for_queue_to_empty
32
+ assert_match(/updated content/,@wiki.page('update on revision test').content )
33
+ end
34
+
35
+ def test_removes_when_no_longer_true
36
+ AutomaticSummary.new( @wiki, 'remove when not true test' ) { |page| page.content =~ /hello/i }
37
+ @wiki.revise('summarise 1','hello','test author')
38
+ wait_for_queue_to_empty
39
+ assert_match(/hello/,@wiki.page('remove when not true test').content )
40
+ @wiki.revise('summarise 1','bye','test author')
41
+ wait_for_queue_to_empty
42
+ assert_no_match(/hello/,@wiki.page('remove when not true test').content )
43
+ assert_no_match(/bye/,@wiki.page('remove when not true test').content )
44
+ end
45
+
46
+ end
47
+
7
48
  class TestRecentChanges < Test::Unit::TestCase
8
49
  include TearDownableWiki
9
50
 
@@ -12,7 +53,7 @@ class TestRecentChanges < Test::Unit::TestCase
12
53
  @wiki.revise( 'testpage','B','normal person')
13
54
  @wiki.revise( 'testpage2','A','normal person')
14
55
  wait_for_queue_to_empty
15
- assert_equal(2, rc.pages_in_summary.to_a.size)
56
+ assert_equal(2, rc.summary.to_a.size)
16
57
  assert_match( /normal person/i, rctextile )
17
58
  end
18
59
 
@@ -21,7 +62,7 @@ class TestRecentChanges < Test::Unit::TestCase
21
62
  @wiki.revise( 'testpage','B','normal person')
22
63
  @wiki.revise( 'testpage','A','normal person')
23
64
  wait_for_queue_to_empty
24
- assert_equal(1, rc.pages_in_summary.to_a.size)
65
+ assert_equal(1, rc.summary.to_a.size)
25
66
  assert_match( /normal person/i, rctextile )
26
67
  end
27
68
 
@@ -30,7 +71,7 @@ class TestRecentChanges < Test::Unit::TestCase
30
71
  @wiki.revise( 'testpage','B','p1')
31
72
  @wiki.revise( 'testpage','A','p2')
32
73
  wait_for_queue_to_empty
33
- assert_equal(2, @rc.pages_in_summary.to_a.size)
74
+ assert_equal(2, @rc.summary.to_a.size)
34
75
  assert_match( /p1/i, rctextile )
35
76
  assert_match( /p2/i, rctextile )
36
77
  end
@@ -41,7 +82,7 @@ class TestRecentChanges < Test::Unit::TestCase
41
82
  @wiki.revise( 'testpage2','A','normal person')
42
83
  rc = AutomaticRecentChanges.new( @wiki)
43
84
  assert_equal(['recent changes to this site','testpage','testpage2'],@wiki.map{|name,page| name }.sort)
44
- assert_equal(2, rc.pages_in_summary.to_a.size)
85
+ assert_equal(2, rc.summary.to_a.size)
45
86
  assert_match( /normal person/i, rctextile )
46
87
  assert_no_match( /AutomaticPageMover/i, rctextile )
47
88
  end
@@ -53,7 +94,7 @@ class TestRecentChanges < Test::Unit::TestCase
53
94
  @wiki.revise( 'testpage2','A','normal person')
54
95
  wait_for_queue_to_empty
55
96
  assert_equal(['recent changes to this site','testpage','testpage2'],@wiki.map{|name,page| name }.sort)
56
- assert_equal(2, rc.pages_in_summary.to_a.size)
97
+ assert_equal(2, rc.summary.to_a.size)
57
98
  assert_match( /normal person/i, rctextile )
58
99
  assert_no_match( /AutomaticPageMover/i, rctextile )
59
100
  end
@@ -52,9 +52,13 @@ class TestBruteMatch < Test::Unit::TestCase
52
52
  assert_equal( [['.Site Index A.',:dot_index_a]],match(".Site Index A. ball") )
53
53
  end
54
54
 
55
- def match( text )
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 = [] )
56
60
  matches = []
57
- @match.match( text ) { |m,p|
61
+ @match.match( text, do_not_match ) { |m,p|
58
62
  matches << [m,p]
59
63
  "$1"
60
64
  }
@@ -162,6 +166,14 @@ class TestWikiRedCloth < Test::Unit::TestCase
162
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'))
163
167
  end
164
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
+
165
177
  def test_wiki_links
166
178
  @view.revise('test1','[[test => a wonderfull page?great=good ]]','tamc2')
167
179
  @view.revise('test2','[[test => /edit/a wonderfull page?great =good ]]','tamc2')
data/test/test_soks.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+ require 'soks'
3
+
4
+ class TestSoks < Test::Unit::TestCase
5
+
6
+ def test_version_number
7
+ assert_match /^\d+\.\d+\.\d+$/, SOKS_VERSION
8
+ end
9
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: Soks
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2005-08-09 00:00:00 +01:00
6
+ version: 1.0.2
7
+ date: 2005-09-27 00:00:00 +01:00
8
8
  summary: Yet another wiki.
9
9
  require_paths:
10
10
  - lib
@@ -84,7 +84,7 @@ files:
84
84
  - templates/default/content/Automatic%20counters.textile
85
85
  - templates/default/content/Automatic%20exporters.textile
86
86
  - templates/default/content/Automatic%20importers.textile
87
- - templates/default/content/Automatic%20linking%20between%20pages.textile
87
+ - templates/default/content/Automatic%20linking.textile
88
88
  - templates/default/content/Automatic%20maintenance%20helpers.textile
89
89
  - templates/default/content/Automatic%20Summaries.textile
90
90
  - templates/default/content/Bug%3A%20Competing%20edits.textile
@@ -111,7 +111,6 @@ files:
111
111
  - templates/default/content/How%20to%20report%20a%20bug.textile
112
112
  - templates/default/content/How%20to%20upgrade%20soks.textile
113
113
  - templates/default/content/How%20to%20use%20the%20Automatic%20Helper%20classes.textile
114
- - templates/default/content/How%20to%20use%20the%20keyboard%20shortcuts.textile
115
114
  - templates/default/content/How%20to%20use%20this%20wiki.textile
116
115
  - templates/default/content/List%20of%20changes.textile
117
116
  - templates/default/content/News%3A%20Version%201%2D0%2D0%20released.textile
@@ -126,7 +125,7 @@ files:
126
125
  - templates/default/content/Sidebar%20Page.textile
127
126
  - templates/default/content/Site%20Index.textile
128
127
  - templates/default/content/SOKS%20features.textile
129
- - templates/default/content/Soks%20Licence.textile
128
+ - templates/default/content/Soks%27s%20Licence.textile
130
129
  - templates/default/content/Tag%3A%20Include%20this%20page%20in%20the%20distribution.textile
131
130
  - templates/default/views/frame.rhtml
132
131
  - templates/default/views/messages.yaml
@@ -152,6 +151,7 @@ files:
152
151
  - test/test_soks-storage.rb
153
152
  - test/test_soks-utils.rb
154
153
  - test/test_soks-view.rb
154
+ - test/test_soks.rb
155
155
  - test/html/2006Mar.html
156
156
  - test/html/poignant.html
157
157
  - test/html/poignant.textile
@@ -1,17 +0,0 @@
1
- h1. Keyboard Shortcuts
2
-
3
- Soks has a number of keyboard short cuts. Depending on your browser, only some of them will work:
4
-
5
- * ctrl-n : New page. Will use whatever text you had selected as the title of the new page (definitely only works on a few browsers[1])
6
- * ctrl-e: Edit page, and if you are editing:
7
- ** ctrl-s saves the page
8
- ** ctrl-c cancels the editing
9
- ** ctrl-u undos the previous edit
10
- ** ctrl-a shows all the previous changes
11
- * ctrl-h: Home page
12
-
13
- *Note:* On Linux/Firefox and WindowsXP/IE6.0, substitute "meta" or "alt" for "ctrl". And for WindowsXP/IE6.0, these will only move you to the link on the page -- you then have to hit enter to proceed.
14
-
15
- fn1. Does not work on Linux/Firefox1.0 or WindowsXP/IE6.0
16
-
17
- Tag: Include this page in the distribution