elexis-wiki-interface 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +4 -0
- data/Gemfile +0 -8
- data/Gemfile.lock +17 -35
- data/History.txt +5 -0
- data/bin/wiki_pull_daily +1 -1
- data/lib/elexis/wiki/interface/version.rb +1 -1
- data/lib/elexis/wiki/interface/workspace.rb +69 -40
- data/spec/pull_spec.rb +2 -2
- data/spec/push_spec.rb +13 -11
- data/spec/update_images_spec.rb +33 -12
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTU1NzUzMmNiZGE4YjRiM2MxYzA3NTZkMjRmM2Y0ZDhhOTVhNzFjYg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6034df25bce2b462c608185293c9082d96ec3330
|
4
|
+
data.tar.gz: 67967459d7facf953f98a562854e3c8ed761227a
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjZmNTQwYWMwMDBlMjFhNWY4ZTI1ZmI2N2Q0OTk4ZDQ4MDUzYjE3ZGQ2MWY1
|
11
|
-
MmUxYWEwNTYxNzI4MGVhZGQ5MDJlMzIxNzdkZTQ4YTVlOWQzNGY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTk5ZDI3OTZlODQyMWU1OGFkYjM2MjYyNmQ3MTdhNTJjZDFmNTg1ZjU0OWVj
|
14
|
-
ZmFkNjE1MzdmOWExZjc2ODg0M2MyMzE1YTU4ZTgyNTNjZDNiYzk1MDE4MjIz
|
15
|
-
ZDdlYTAxODZjM2JkYzc3NTljZDA3YzczYjcyMGJhNmZhZTQ2ZDk=
|
6
|
+
metadata.gz: 8da98e582a5ab3f86403f77bc444352cce5e9d2e2a71d8d01466f9eb29cd4abbbd5904c8dc83601baf1cfbb7f429373670ff99f1fe2db15679d2a77d01b5fa21
|
7
|
+
data.tar.gz: a8aa66f023a3d00c2cf46a3841a11855af99530231a45727d176cfad346dbe9cde3d7768ecac7b070bfe49b48c9bb70200c9a45ab07fd546c62af68e87563179
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -9,7 +9,7 @@ GIT
|
|
9
9
|
PATH
|
10
10
|
remote: .
|
11
11
|
specs:
|
12
|
-
elexis-wiki-interface (0.4.
|
12
|
+
elexis-wiki-interface (0.4.2)
|
13
13
|
eclipse-plugin (>= 0.1)
|
14
14
|
mediawiki-gateway
|
15
15
|
rubyzip (< 1.0.0)
|
@@ -18,61 +18,44 @@ PATH
|
|
18
18
|
GEM
|
19
19
|
remote: https://rubygems.org/
|
20
20
|
specs:
|
21
|
-
coderay (1.1.0)
|
22
|
-
columnize (0.9.0)
|
23
|
-
debugger (1.6.8)
|
24
|
-
columnize (>= 0.3.1)
|
25
|
-
debugger-linecache (~> 1.2.0)
|
26
|
-
debugger-ruby_core_source (~> 1.3.5)
|
27
|
-
debugger-linecache (1.2.0)
|
28
|
-
debugger-ruby_core_source (1.3.8)
|
29
21
|
diff-lcs (1.2.5)
|
30
22
|
docile (1.1.5)
|
31
23
|
domain_name (0.5.24)
|
32
24
|
unf (>= 0.0.5, < 1.0.0)
|
33
25
|
http-cookie (1.0.2)
|
34
26
|
domain_name (~> 0.5)
|
27
|
+
json (1.8.3)
|
35
28
|
mediawiki-gateway (1.0.0)
|
36
29
|
rest-client (~> 1.7)
|
37
|
-
method_source (0.8.2)
|
38
30
|
mime-types (2.6.1)
|
39
31
|
mini_portile (0.6.2)
|
40
|
-
multi_json (1.10.1)
|
41
32
|
netrc (0.10.3)
|
42
33
|
nokogiri (1.6.6.2)
|
43
34
|
mini_portile (~> 0.6.0)
|
44
|
-
pry (0.10.1)
|
45
|
-
coderay (~> 1.1.0)
|
46
|
-
method_source (~> 0.8.1)
|
47
|
-
slop (~> 3.4)
|
48
|
-
pry-debugger (0.2.3)
|
49
|
-
debugger (~> 1.3)
|
50
|
-
pry (>= 0.9.10, < 0.11.0)
|
51
35
|
rake (10.4.2)
|
52
36
|
rest-client (1.8.0)
|
53
37
|
http-cookie (>= 1.0.2, < 2.0)
|
54
38
|
mime-types (>= 1.16, < 3.0)
|
55
39
|
netrc (~> 0.7)
|
56
|
-
rspec (3.
|
57
|
-
rspec-core (~> 3.
|
58
|
-
rspec-expectations (~> 3.
|
59
|
-
rspec-mocks (~> 3.
|
60
|
-
rspec-core (3.2
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-expectations (3.
|
40
|
+
rspec (3.3.0)
|
41
|
+
rspec-core (~> 3.3.0)
|
42
|
+
rspec-expectations (~> 3.3.0)
|
43
|
+
rspec-mocks (~> 3.3.0)
|
44
|
+
rspec-core (3.3.2)
|
45
|
+
rspec-support (~> 3.3.0)
|
46
|
+
rspec-expectations (3.3.1)
|
63
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
-
rspec-support (~> 3.
|
65
|
-
rspec-mocks (3.2
|
48
|
+
rspec-support (~> 3.3.0)
|
49
|
+
rspec-mocks (3.3.2)
|
66
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-support (3.
|
51
|
+
rspec-support (~> 3.3.0)
|
52
|
+
rspec-support (3.3.0)
|
69
53
|
rubyzip (0.9.9)
|
70
|
-
simplecov (0.
|
54
|
+
simplecov (0.10.0)
|
71
55
|
docile (~> 1.1.0)
|
72
|
-
|
73
|
-
simplecov-html (~> 0.
|
74
|
-
simplecov-html (0.
|
75
|
-
slop (3.6.0)
|
56
|
+
json (~> 1.8)
|
57
|
+
simplecov-html (~> 0.10.0)
|
58
|
+
simplecov-html (0.10.0)
|
76
59
|
unf (0.1.4)
|
77
60
|
unf_ext
|
78
61
|
unf_ext (0.0.7.1)
|
@@ -85,7 +68,6 @@ DEPENDENCIES
|
|
85
68
|
bundler (~> 1.10)
|
86
69
|
eclipse-plugin!
|
87
70
|
elexis-wiki-interface!
|
88
|
-
pry-debugger
|
89
71
|
rake (~> 10.0)
|
90
72
|
rspec
|
91
73
|
simplecov
|
data/History.txt
CHANGED
data/bin/wiki_pull_daily
CHANGED
@@ -19,7 +19,7 @@ files.each{
|
|
19
19
|
}
|
20
20
|
system("git add -f #{files.join(' ')}")
|
21
21
|
system("git status")
|
22
|
-
system("git commit --all -m '#{File.basename(__FILE__)}:
|
22
|
+
system("git commit --all -m '#{File.basename(__FILE__)}: #{Date.today.to_s} from #{workspace.wiki.sub(/api.php/i, '')}'")
|
23
23
|
system("git status")
|
24
24
|
system("git log -1")
|
25
25
|
# system("git push")
|
@@ -11,42 +11,52 @@ module Elexis
|
|
11
11
|
module Wiki
|
12
12
|
module Interface
|
13
13
|
ImagePrefix = /Datei:|Image:/i
|
14
|
-
ImagePattern = /(\[Datei:|\[Image:)([\w
|
15
|
-
|
14
|
+
ImagePattern = /(\[Datei:|\[Image:)([\w\.\:\/]*)/i
|
15
|
+
$ws_errors = []
|
16
|
+
|
17
|
+
# All images under wiki.elexis.info must have images corresponding to the following scheme
|
18
|
+
# directory: id of the plugin/feature (with feature.feature.group removed)
|
19
|
+
# imagename:
|
20
|
+
# Therefore you find und http://wiki.elexis.info/index.php?title=Ch.elexis.connect.mythic&action=edit the line
|
21
|
+
# [[Image:ch.elexis.connect.mythic_kabel.png|image]] [fig:kabel]
|
22
|
+
# and under http://wiki.elexis.info/index.php?title=Com.hilotec.elexis.opendocument.feature.feature.group&action=edit
|
23
|
+
# [[Image:com.hilotec.elexis.opendocument/anleitung_opendocument_1.png|frame|none]]
|
24
|
+
|
25
|
+
def Interface.return_canonical_image_name(pagename, filename)
|
26
|
+
pagename = pagename.sub('.feature.feature.group', '')
|
27
|
+
short = File.basename(filename.clone.sub(ImagePrefix, ''))
|
28
|
+
short = short.split(':')[-1]
|
29
|
+
return pagename + '/' + short
|
30
|
+
end
|
31
|
+
|
32
|
+
def Interface.fix_image_locations(filename, pagename)
|
16
33
|
return unless File.exists?(filename)
|
34
|
+
pagename = pagename.sub('.feature.feature.group', '')
|
17
35
|
lines = IO.readlines(filename)
|
18
36
|
dirName = File.dirname(filename)
|
19
37
|
newLines = []
|
38
|
+
showDetails = $VERBOSE
|
39
|
+
if /icpc.mediawiki/i.match(filename)
|
40
|
+
showDetails = true
|
41
|
+
end
|
20
42
|
lines.each{
|
21
43
|
|line|
|
22
44
|
unless m =ImagePattern.match(line)
|
23
45
|
newLines << line
|
24
46
|
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
47
|
+
new_name = Interface.return_canonical_image_name(pagename, m[2])
|
48
|
+
simpleName = File.join(dirName, File.basename(new_name))
|
49
|
+
if files = Dir.glob(simpleName, File::FNM_CASEFOLD) and files.size == 1
|
50
|
+
new_line = line.sub(m[2], new_name)
|
51
|
+
newLines << new_line
|
30
52
|
else
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
else
|
37
|
-
shortName = File.join(dirName, m[2].sub(/#{id}[_:\/]/i, ''))
|
38
|
-
if File.exists?(shortName)
|
39
|
-
puts "Image shortName #{shortName} found" if $VERBOSE
|
40
|
-
newLines << line.sub(m[2], m[2].sub(/[_:]/i, '/'))
|
41
|
-
next
|
42
|
-
else
|
43
|
-
puts "Could not find image for #{m[0]}"
|
44
|
-
newLines << line.sub(ImagePattern, "#{m[1]}#{m[2].sub(':', '_')}")
|
45
|
-
end
|
46
|
-
end
|
53
|
+
next if defined?(RSpec)
|
54
|
+
msg = "Could not find image for #{m[0]} searched for #{simpleName} in #{Dir.pwd}"
|
55
|
+
puts msg
|
56
|
+
$ws_errors << msg
|
57
|
+
newLines << line.sub(ImagePattern, "#{m[1]}#{m[2].sub(':', '_')}")
|
47
58
|
end
|
48
59
|
end
|
49
|
-
|
50
60
|
}
|
51
61
|
File.open(filename, "w+") {|f| f.puts newLines}
|
52
62
|
end
|
@@ -55,6 +65,7 @@ module Elexis
|
|
55
65
|
attr_reader :info, :mw, :wiki, :views_missing_documentation, :perspectives_missing_documentation, :plugins_missing_documentation, :features_missing_documentation,
|
56
66
|
:doc_project, :features, :info
|
57
67
|
def initialize(dir, wiki = 'http://wiki.elexis.info/api.php')
|
68
|
+
$ws_errors = []
|
58
69
|
@wiki = wiki
|
59
70
|
@mw = MediaWiki::Gateway.new(@wiki)
|
60
71
|
@info = Eclipse::Workspace.new(dir)
|
@@ -91,6 +102,8 @@ module Elexis
|
|
91
102
|
puts " #{perspectives_missing_documentation.inspect}" if details
|
92
103
|
end
|
93
104
|
end
|
105
|
+
puts $ws_errors
|
106
|
+
puts "Displayed #{$ws_errors.size} errors"
|
94
107
|
end
|
95
108
|
def push
|
96
109
|
check_config_file
|
@@ -149,7 +162,7 @@ module Elexis
|
|
149
162
|
end
|
150
163
|
begin
|
151
164
|
res = @mw.upload(image, 'filename' => File.basename(image))
|
152
|
-
puts "res für #{image} exists? #{File.exists?(image)} ist #{res.to_s}"
|
165
|
+
puts "res für #{image} exists? #{File.exists?(image)} ist #{res.to_s}" if $VERBOSE
|
153
166
|
rescue MediaWiki::APIError => e
|
154
167
|
puts "rescue für #{image} #{e}" # if $VERBOSE
|
155
168
|
if /verification-error/.match(e.to_s)
|
@@ -176,24 +189,35 @@ module Elexis
|
|
176
189
|
wiki_json_timestamp_to_time(json, pagename)
|
177
190
|
end
|
178
191
|
|
192
|
+
def remove_image_files_with_id(id, info, docDir = nil)
|
193
|
+
docDir ||= File.join(@info.workspace_dir, id, 'doc')
|
194
|
+
files = Dir.glob(File.join(docDir, "#{id}_*png")) +
|
195
|
+
Dir.glob(File.join(docDir, "#{id.capitalize}_*png"))
|
196
|
+
system("git rm #{files.join(' ')}") if files.size > 0
|
197
|
+
end
|
198
|
+
|
179
199
|
def pull
|
180
200
|
@doc_projects.each{
|
181
201
|
|prj|
|
182
202
|
dir = File.dirname(prj)
|
183
203
|
get_content_from_wiki(dir, File.basename(dir))
|
204
|
+
remove_image_files_with_id(File.basename(File.dirname(prj)), info, dir)
|
184
205
|
}
|
206
|
+
|
185
207
|
@info.plugins.each{
|
186
208
|
|id, info|
|
187
209
|
puts "Pulling for plugin #{id}" if $VERBOSE
|
188
210
|
pull_docs_views(info)
|
189
211
|
pull_docs_plugins(info)
|
190
212
|
pull_docs_perspectives(info)
|
213
|
+
remove_image_files_with_id(id, info)
|
191
214
|
}
|
192
215
|
@info.features.each{
|
193
216
|
|id, info|
|
194
|
-
next unless /
|
217
|
+
# next unless /icpc/i.match(id)
|
195
218
|
puts "Pulling for feature #{id}" if $VERBOSE
|
196
219
|
pull_docs_features(info)
|
220
|
+
remove_image_files_with_id(id, info)
|
197
221
|
}
|
198
222
|
saved = Dir.pwd
|
199
223
|
end
|
@@ -216,10 +240,6 @@ module Elexis
|
|
216
240
|
pageName
|
217
241
|
end
|
218
242
|
|
219
|
-
def shorten_wiki_image(image)
|
220
|
-
File.basename(image.split(/[\:\/_]/)[-1])
|
221
|
-
end
|
222
|
-
|
223
243
|
private
|
224
244
|
def wiki_json_timestamp_to_time(json, page_or_img)
|
225
245
|
return nil unless json
|
@@ -244,34 +264,44 @@ module Elexis
|
|
244
264
|
# http://wiki.elexis.info/api.php?action=query&format=json&list=allimages&ailimit=5&aiprop=timestamp&aiprefix=Ch.elexis.notes:config.png&*
|
245
265
|
def get_image_modification_name(image)
|
246
266
|
short_image = image.sub(ImagePrefix, '')
|
247
|
-
json_url = "#{@wiki}?action=query&format=json&list=allimages&ailimit=5&aiprop=timestamp&aiprefix=#{short_image}"
|
267
|
+
json_url = "#{@wiki}?action=query&format=json&list=allimages&ailimit=5&aiprop=timestamp&iiprop=url&aiprefix=#{short_image}"
|
248
268
|
json = RestClient.get(json_url)
|
249
269
|
wiki_json_timestamp_to_time(json, image)
|
250
270
|
end
|
251
271
|
|
252
272
|
# helper function, as mediawiki-gateway does not handle this situation correctly
|
253
|
-
def download_image_file(
|
254
|
-
|
273
|
+
def download_image_file(pageName, image)
|
274
|
+
downloaded_image = File.basename(Interface.return_canonical_image_name(pageName, image))
|
255
275
|
unless File.exist? downloaded_image
|
256
|
-
|
276
|
+
# first search by pagename and imagename
|
277
|
+
json_url = "#{@wiki}?action=query&format=json&list=allimages&ailimit=5&aiprefix=#{pageName}&aifrom=#{image.sub(ImagePrefix, '')}"
|
257
278
|
json = RestClient.get(json_url)
|
258
279
|
unless json
|
259
|
-
puts "JSON: Could not fetch for image #{image} using #{json_url}"
|
280
|
+
puts "JSON: Could not fetch for image #{image} for #{pageName} using #{json_url}"
|
260
281
|
return
|
261
282
|
end
|
262
283
|
begin
|
263
284
|
answer = JSON.parse(json)
|
264
285
|
image_url = nil
|
265
286
|
image_url = answer['query'].first[1].first['url'] if answer['query'] and answer['query'].size >= 1 and answer['query'].first[1].size > 0
|
287
|
+
unless image_url
|
288
|
+
# as we did not find it search imagename only
|
289
|
+
json_url = "#{@wiki}?action=query&format=json&list=allimages&ailimit=5&aifrom=#{image.sub(ImagePrefix, '')}"
|
290
|
+
json = RestClient.get(json_url)
|
291
|
+
if json
|
292
|
+
answer = JSON.parse(json)
|
293
|
+
image_url = answer['query'].first[1].first['url'] if answer['query'] and answer['query'].size >= 1 and answer['query'].first[1].size > 0
|
294
|
+
end
|
295
|
+
end
|
266
296
|
if image_url
|
267
297
|
File.open(downloaded_image, 'w') do |file|
|
268
298
|
file.write(open(image_url).read)
|
269
299
|
end
|
270
300
|
else
|
271
|
-
puts "skipping image #{image}"
|
301
|
+
puts "skipping image #{image} for page #{pageName}"
|
272
302
|
end
|
273
303
|
rescue => e
|
274
|
-
puts "JSON: Could not fetch for image #{image} using #{json_url}"
|
304
|
+
puts "JSON: Could not fetch for image #{image} for #{pageName} using #{json_url}"
|
275
305
|
puts " was '#{json}'"
|
276
306
|
puts " error was #{e.inspect}"
|
277
307
|
end
|
@@ -283,6 +313,7 @@ module Elexis
|
|
283
313
|
puts "get_content_from_wiki page #{pageName} -> #{out_dir}" if $VERBOSE
|
284
314
|
out_name = File.join(out_dir, pageName + '.mediawiki')
|
285
315
|
FileUtils.makedirs(out_dir) unless File.directory?(out_dir)
|
316
|
+
Dir.chdir(out_dir)
|
286
317
|
begin
|
287
318
|
content = @mw.get(pageName)
|
288
319
|
rescue MediaWiki::Gateway::Exception => e
|
@@ -293,9 +324,7 @@ module Elexis
|
|
293
324
|
ausgabe = File.open(out_name, 'w+') { |f| f.write content }
|
294
325
|
@mw.images(pageName).each{
|
295
326
|
|image|
|
296
|
-
|
297
|
-
downloaded_image = File.join(out_dir, shorten_wiki_image(image))
|
298
|
-
download_image_file(image, downloaded_image.sub(':', '_'))
|
327
|
+
download_image_file(pageName, image.gsub(' ', '_'))
|
299
328
|
break if defined?(RSpec) and not /icpc/i.match(pageName) # speed up RSpec
|
300
329
|
}
|
301
330
|
Elexis::Wiki::Interface.fix_image_locations(out_name, pageName)
|
data/spec/pull_spec.rb
CHANGED
@@ -82,9 +82,9 @@ describe 'Plugin' do
|
|
82
82
|
expect(Dir.glob(name).size).to eq 1
|
83
83
|
content = IO.read(name)
|
84
84
|
m = /(Image:[\w\.]+)[:_](\w+.png)/.match(content)
|
85
|
-
expect(m).to
|
85
|
+
expect(m).to eq nil
|
86
86
|
m = /(Image:[\w\.]+)\/(\w+.png)/.match(content)
|
87
|
-
expect(m[0]).to eq 'Image:
|
87
|
+
expect(m[0]).to eq 'Image:Ch.elexis.icpc/icpc0.png'
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should show all users" do
|
data/spec/push_spec.rb
CHANGED
@@ -14,16 +14,18 @@ describe 'Plugin' do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should push a test page to the wiki.elexis.info" do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
if ENV['TRAVIS']
|
18
|
+
puts "Skipping some tests under travis"
|
19
|
+
else
|
20
|
+
hasConfig = File.exists?('/etc/elexis-wiki-interface/config.yml') or File.exists?(File.join(Dir.pwd, 'config.yml'))
|
21
|
+
pending 'no config file' unless hasConfig
|
22
|
+
search = "#{@dataDir}/**/*.mediawiki"
|
23
|
+
mediawikis = Dir.glob(search)
|
24
|
+
expect mediawikis.size == 1
|
25
|
+
workspace = Elexis::Wiki::Interface::Workspace.new(@dataDir)
|
26
|
+
workspace.push
|
27
|
+
content = workspace.mw.get('test')
|
28
|
+
expect content != nil
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
data/spec/update_images_spec.rb
CHANGED
@@ -14,19 +14,36 @@ describe 'ImageHandling' do
|
|
14
14
|
FileUtils.cp_r(@originDir, @dataDir, :verbose => true, :preserve => true)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "should
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
it "should return corret canonical_names for a plugin" do
|
18
|
+
expected = "ch.elexis.icpc/icpc0.png"
|
19
|
+
["xxxx/icpc0.png",
|
20
|
+
"icpc0.png",
|
21
|
+
"ch.elexis.icpc/icpc0.png",
|
22
|
+
"ch.elexis.icpc_icpc0.png",
|
23
|
+
"ch.elexis.icpc:icpc0.png",
|
24
|
+
].each{ |variant|
|
25
|
+
res = Elexis::Wiki::Interface.return_canonical_image_name("ch.elexis.icpc", expected)
|
26
|
+
expect(res).to eq expected
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return corret canonical_names for a feature" do
|
31
|
+
expected = "com.hilotec.elexis.opendocument/anleitung_opendocument_1.png"
|
32
|
+
[ "xxx/anleitung_opendocument_1.png",
|
33
|
+
"com.hilotec.elexis.opendocument:anleitung_opendocument_1.png",
|
34
|
+
"com.hilotec.elexis.opendocument/anleitung_opendocument_1.png",
|
35
|
+
"com.hilotec.elexis.opendocument_anleitung_opendocument_1.png",
|
36
|
+
].each{ |variant|
|
37
|
+
res = Elexis::Wiki::Interface.return_canonical_image_name("com.hilotec.elexis.opendocument", expected)
|
38
|
+
expect(res).to eq expected
|
39
|
+
|
40
|
+
res2 = Elexis::Wiki::Interface.return_canonical_image_name("com.hilotec.elexis.opendocument.feature.feature.group", expected)
|
41
|
+
expect(res2).to eq expected
|
42
|
+
}
|
25
43
|
end
|
26
44
|
|
27
45
|
it "should adapt correctly the image name" do
|
28
46
|
wiki_file = File.join(@dataDir, 'ch.elexis.icpc', 'doc', 'test.mediawiki')
|
29
|
-
puts wiki_file
|
30
47
|
expect(File.exists?(wiki_file)).to eq true
|
31
48
|
before = ['tag_one [[Image:ch.elexis.icpc:icpc1.png|image]]',
|
32
49
|
'tag_two [[Image:ch.elexis.icpc:icpc2.png|image]]',
|
@@ -36,12 +53,16 @@ describe 'ImageHandling' do
|
|
36
53
|
]
|
37
54
|
original = IO.read(wiki_file)
|
38
55
|
before.each{|string| expect(original).to include string }
|
56
|
+
puts Dir.pwd
|
57
|
+
Dir.chdir(@dataDir)
|
58
|
+
puts Dir.pwd
|
59
|
+
|
39
60
|
Elexis::Wiki::Interface.fix_image_locations(wiki_file, 'ch.elexis.icpc')
|
40
|
-
after =
|
61
|
+
after =['tag_one [[Image:ch.elexis.icpc/icpc1.png|image]]',
|
41
62
|
'tag_two [[Image:ch.elexis.icpc/icpc2.png|image]]',
|
42
|
-
'tag_three [[Image:icpc3.png|image]]',
|
63
|
+
'tag_three [[Image:ch.elexis.icpc/icpc3.png|image]]',
|
43
64
|
'tag_four [[Datei:ch.elexis.icpc/icpc4.png|image]]',
|
44
|
-
'tag_five [[Datei:
|
65
|
+
'tag_five [[Datei:ch.elexis.icpc/icpc5.png|image]]',
|
45
66
|
]
|
46
67
|
changed = IO.read(wiki_file)
|
47
68
|
after.each{|string| expect(changed).to include string }
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elexis-wiki-interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklaus Giger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07
|
11
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - <
|
17
|
+
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - <
|
24
|
+
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unicode
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '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
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mediawiki-gateway
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: eclipse-plugin
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.10'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.10'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '10.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '10.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Support for pulling/pushing wiki content from source repository to elexis.wiki
|
@@ -132,8 +132,8 @@ executables:
|
|
132
132
|
extensions: []
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
|
-
- .gitignore
|
136
|
-
- .travis.yml
|
135
|
+
- ".gitignore"
|
136
|
+
- ".travis.yml"
|
137
137
|
- Gemfile
|
138
138
|
- Gemfile.lock
|
139
139
|
- History.txt
|
@@ -193,17 +193,17 @@ require_paths:
|
|
193
193
|
- lib
|
194
194
|
required_ruby_version: !ruby/object:Gem::Requirement
|
195
195
|
requirements:
|
196
|
-
- -
|
196
|
+
- - ">="
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
200
|
requirements:
|
201
|
-
- -
|
201
|
+
- - ">="
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.4.
|
206
|
+
rubygems_version: 2.4.5
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Interface between elexis source and wiki
|