clwiki 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cl_wiki/index.rb +15 -12
- data/lib/cl_wiki/page.rb +1 -1
- data/lib/cl_wiki/version.rb +1 -1
- data/lib/tasks/index.rake +26 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 414fdabdc5406f4b2527abedd8055725bbe0667fbd9ee38faf1b1a7df9921703
|
4
|
+
data.tar.gz: 57b042cf9eea3182e395c818bee40841881196e24f514b9929b8c21180a070aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 223e97e93fe030cf97c17efadc17bf7b62e1b481a484e57e7a85982ce309bc05b90b744a9f3b7589cf86c35661b7bd8698d2ee87441826124f6137252f485a4d
|
7
|
+
data.tar.gz: e5d1e709cc9ce76f71660e3a0d77388956da2af9b0ce857b133eeae82d188ebb8a059f4b1860f3fb248ac630c139985cc0f4a57501ff1ab569d9d508978178dd
|
data/lib/cl_wiki/index.rb
CHANGED
@@ -35,7 +35,7 @@ module ClWiki
|
|
35
35
|
|
36
36
|
def do_puts(text)
|
37
37
|
if @fn
|
38
|
-
File.open(@fn, 'a+') do |f|
|
38
|
+
::File.open(@fn, 'a+') do |f|
|
39
39
|
f.puts text
|
40
40
|
end
|
41
41
|
else
|
@@ -80,12 +80,7 @@ module ClWiki
|
|
80
80
|
else
|
81
81
|
formatter = ClWiki::PageFormatter.new(pg.raw_content, fullName)
|
82
82
|
formatter.formatLinks do |word|
|
83
|
-
|
84
|
-
word = formatter.expand_path(word, fullName)
|
85
|
-
else
|
86
|
-
word.downcase!
|
87
|
-
end
|
88
|
-
add_to_index(word, fullName)
|
83
|
+
add_to_index(word.downcase, fullName)
|
89
84
|
end
|
90
85
|
add_to_index(fullName, fullName)
|
91
86
|
add_to_pages(fullName)
|
@@ -110,19 +105,19 @@ module ClWiki
|
|
110
105
|
end
|
111
106
|
|
112
107
|
def hits_filename
|
113
|
-
::File.join(::File.expand_path(
|
108
|
+
::File.join(::File.expand_path($wiki_path), 'hits.dat')
|
114
109
|
end
|
115
110
|
|
116
111
|
def index_filename
|
117
|
-
::File.join(::File.expand_path(
|
112
|
+
::File.join(::File.expand_path($wiki_path), 'index.dat')
|
118
113
|
end
|
119
114
|
|
120
115
|
def recent_filename
|
121
|
-
::File.join(::File.expand_path(
|
116
|
+
::File.join(::File.expand_path($wiki_path), 'recent.dat')
|
122
117
|
end
|
123
118
|
|
124
119
|
def pages_filename
|
125
|
-
::File.join(::File.expand_path(
|
120
|
+
::File.join(::File.expand_path($wiki_path), 'pages.dat')
|
126
121
|
end
|
127
122
|
|
128
123
|
def remove_page_from_index(fullPageName)
|
@@ -314,10 +309,18 @@ module ClWiki
|
|
314
309
|
end
|
315
310
|
end
|
316
311
|
|
317
|
-
def
|
312
|
+
def reindex_page_and_save_async(fullPageName)
|
318
313
|
@indexer.reindex_and_save_async(fullPageName)
|
319
314
|
end
|
320
315
|
|
316
|
+
def reindex_page(full_page_name)
|
317
|
+
@indexer.reindex_page(full_page_name)
|
318
|
+
end
|
319
|
+
|
320
|
+
def save
|
321
|
+
@indexer.save
|
322
|
+
end
|
323
|
+
|
321
324
|
def search(term, titles_only=false)
|
322
325
|
hits = @indexer.search(term).flatten
|
323
326
|
if titles_only
|
data/lib/cl_wiki/page.rb
CHANGED
@@ -168,7 +168,7 @@ module ClWiki
|
|
168
168
|
wikiFile.content = newcontent
|
169
169
|
if $wiki_conf.useIndex != ClWiki::Configuration::USE_INDEX_NO
|
170
170
|
wikiIndexClient = ClWiki::IndexClient.new
|
171
|
-
wikiIndexClient.
|
171
|
+
wikiIndexClient.reindex_page_and_save_async(@full_name)
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
data/lib/cl_wiki/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def pct_done(done, total)
|
4
|
+
pct = ((done.to_f / total.to_f) * 100).to_i
|
5
|
+
pct.to_s.rjust(3) + '%'
|
6
|
+
end
|
7
|
+
|
8
|
+
task reindex: :environment do
|
9
|
+
indexer = ClWiki::IndexClient.new
|
10
|
+
|
11
|
+
entries = Dir[File.join($wiki_path, "*#{$wikiPageExt}")]
|
12
|
+
entries.each_with_index.map do |fn, idx|
|
13
|
+
if idx.divmod(100)[1].zero?
|
14
|
+
puts
|
15
|
+
print "#{pct_done(idx, entries.length)}: "
|
16
|
+
end
|
17
|
+
|
18
|
+
page_name = File.basename(fn, $wikiPageExt)
|
19
|
+
indexer.reindex_page(page_name)
|
20
|
+
print '.'
|
21
|
+
end
|
22
|
+
puts
|
23
|
+
puts '100%'
|
24
|
+
|
25
|
+
indexer.save
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clwiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrismo
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: clindex
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '2.0'
|
41
41
|
description: Old, tired, crappy wiki, reborn as a Rails 4 Engine.
|
42
42
|
email:
|
43
43
|
- chrismo@clabs.org
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/cl_wiki/tools/test/singlepagetest.rb
|
83
83
|
- lib/cl_wiki/tools/thunderbird.rb
|
84
84
|
- lib/cl_wiki/version.rb
|
85
|
+
- lib/tasks/index.rake
|
85
86
|
- test/dummy/README.rdoc
|
86
87
|
- test/dummy/Rakefile
|
87
88
|
- test/dummy/app/assets/javascripts/application.js
|