elexis-wiki-interface 0.4.6 → 0.4.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/History.txt +4 -0
- data/lib/elexis/wiki/interface/version.rb +1 -1
- data/lib/elexis/wiki/interface/workspace.rb +66 -58
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a27ca6c8e67c1799da5fb5f6176e29c0c95f2255
|
4
|
+
data.tar.gz: 58003985adff2d92617f3bb9589690c55c64c0b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 059bda68058a59f66691354485911467a8985f00d653fee16688eb99a5bf763b8c8616b0c47e08c211967983082acf8a31ff6c383a6a62cc27d0176516b69dae
|
7
|
+
data.tar.gz: 593654fe086c69ed7f3a4ddba20e68223f2989a249b5174ec90e0f2ccecaacdf112cbf04dafdddf7f4e175eb3b20d40506efcb5404cdea1e5e03615733c81696
|
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
@@ -113,6 +113,67 @@ module Elexis
|
|
113
113
|
puts $ws_errors
|
114
114
|
puts "Displayed #{$ws_errors.size} errors"
|
115
115
|
end
|
116
|
+
def push_plugin_or_feature(id, info)
|
117
|
+
docDir = File.join(@info.workspace_dir, id, 'doc')
|
118
|
+
to_push = Dir.glob("#{docDir}/*.mediawiki")
|
119
|
+
to_push.each{
|
120
|
+
|file|
|
121
|
+
# verify that locally committed file is newer than the page in the wiki
|
122
|
+
# verify that the content after the push matches the local content
|
123
|
+
my_new_content = File.new(file).read
|
124
|
+
to_verify = my_new_content.gsub(/\n+/,"\n").chomp
|
125
|
+
pagename = File.basename(file, '.mediawiki').capitalize
|
126
|
+
last_wiki_modification = get_page_modification_time(pagename)
|
127
|
+
last_git_modification = get_git_modification(file)
|
128
|
+
unless last_wiki_modification
|
129
|
+
puts "first upload #{File.basename(file)} last_git_modification is #{last_git_modification}" if $VERBOSE
|
130
|
+
@mw.create(pagename, my_new_content,{:overwrite => true, :summary => "pushed by #{File.basename(__FILE__)}" })
|
131
|
+
else
|
132
|
+
got = @mw.get(pagename).gsub(/\n+/,"\n")
|
133
|
+
if got == to_verify
|
134
|
+
puts "No changes to push for #{file}"
|
135
|
+
next
|
136
|
+
end
|
137
|
+
@mw.edit(pagename, to_verify,{:overwrite => true, :summary => "pushed by #{File.basename(__FILE__)}" })
|
138
|
+
puts "Uploaded #{file} to #{pagename}" if $VERBOSE
|
139
|
+
end
|
140
|
+
}
|
141
|
+
if to_push.size > 0 # then upload also all *.png files
|
142
|
+
images_to_push = Dir.glob("#{docDir}/*.png")
|
143
|
+
images_to_push.each{
|
144
|
+
|image|
|
145
|
+
if /:/.match(File.basename(image))
|
146
|
+
puts "You may not add a file containg ':' or it will break git for Windows. Remove/rename #{image}"
|
147
|
+
exit
|
148
|
+
end
|
149
|
+
|
150
|
+
git_mod = get_git_modification(image)
|
151
|
+
wiki_mod = get_image_modification_name(image)
|
152
|
+
|
153
|
+
if wiki_mod == nil
|
154
|
+
puts "first upload #{File.basename(image)} as last_git_modification is #{git_mod}" if $VERBOSE
|
155
|
+
else
|
156
|
+
to_verify = File.new(image, 'rb').read
|
157
|
+
got = @mw.get(File.basename(image))
|
158
|
+
if got == to_verify
|
159
|
+
puts "nothing to upload for #{image}" if $VERBOSE
|
160
|
+
next
|
161
|
+
end
|
162
|
+
end
|
163
|
+
begin
|
164
|
+
res = @mw.upload(image, 'filename' => File.basename(image))
|
165
|
+
puts "res für #{image} exists? #{File.exists?(image)} ist #{res.to_s}" if $VERBOSE
|
166
|
+
rescue MediaWiki::APIError => e
|
167
|
+
puts "rescue für #{image} #{e}" # if $VERBOSE
|
168
|
+
if /verification-error/.match(e.to_s)
|
169
|
+
puts "If you received API error: code 'verification-error', info 'This file did not pass file verification'"
|
170
|
+
puts "this means that the file type and content do not match, e.g. you have a *png file but in reality it is a JPEG file."
|
171
|
+
puts "In this case convert file.png file.png fixes this problem"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
}
|
175
|
+
end
|
176
|
+
end
|
116
177
|
def push
|
117
178
|
check_config_file
|
118
179
|
raise "must define wiki with user and password in #{@config_yml}" unless @user and @password and @wiki
|
@@ -121,66 +182,13 @@ module Elexis
|
|
121
182
|
|prj|
|
122
183
|
dir = File.dirname(prj)
|
123
184
|
}
|
185
|
+
@info.features.each{
|
186
|
+
|id, info|
|
187
|
+
push_plugin_or_feature(id, info)
|
188
|
+
}
|
124
189
|
@info.plugins.each{
|
125
190
|
|id,plugin|
|
126
|
-
|
127
|
-
to_push.each{
|
128
|
-
|file|
|
129
|
-
# verify that locally committed file is newer than the page in the wiki
|
130
|
-
# verify that the content after the push matches the local content
|
131
|
-
my_new_content = File.new(file).read
|
132
|
-
to_verify = my_new_content.gsub(/\n+/,"\n").chomp
|
133
|
-
pagename = File.basename(file, '.mediawiki').capitalize
|
134
|
-
last_wiki_modification = get_page_modification_time(pagename)
|
135
|
-
last_git_modification = get_git_modification(file)
|
136
|
-
unless last_wiki_modification
|
137
|
-
puts "first upload #{File.basename(file)} last_git_modification is #{last_git_modification}" if $VERBOSE
|
138
|
-
@mw.create(pagename, my_new_content,{:overwrite => true, :summary => "pushed by #{File.basename(__FILE__)}" })
|
139
|
-
else
|
140
|
-
got = @mw.get(pagename).gsub(/\n+/,"\n")
|
141
|
-
if got == to_verify
|
142
|
-
puts "No changes to push for #{file}"
|
143
|
-
next
|
144
|
-
end
|
145
|
-
@mw.edit(pagename, to_verify,{:overwrite => true, :summary => "pushed by #{File.basename(__FILE__)}" })
|
146
|
-
puts "Uploaded #{file} to #{pagename}" if $VERBOSE
|
147
|
-
end
|
148
|
-
}
|
149
|
-
if to_push.size > 0 # then upload also all *.png files
|
150
|
-
images_to_push = Dir.glob("#{plugin.jar_or_src}/doc/*.png")
|
151
|
-
images_to_push.each{
|
152
|
-
|image|
|
153
|
-
if /:/.match(File.basename(image))
|
154
|
-
puts "You may not add a file containg ':' or it will break git for Windows. Remove/rename #{image}"
|
155
|
-
exit
|
156
|
-
end
|
157
|
-
|
158
|
-
git_mod = get_git_modification(image)
|
159
|
-
wiki_mod = get_image_modification_name(image)
|
160
|
-
|
161
|
-
if wiki_mod == nil
|
162
|
-
puts "first upload #{File.basename(image)} as last_git_modification is #{git_mod}" if $VERBOSE
|
163
|
-
else
|
164
|
-
to_verify = File.new(image, 'rb').read
|
165
|
-
got = @mw.get(File.basename(image))
|
166
|
-
if got == to_verify
|
167
|
-
puts "nothing to upload for #{image}" if $VERBOSE
|
168
|
-
next
|
169
|
-
end
|
170
|
-
end
|
171
|
-
begin
|
172
|
-
res = @mw.upload(image, 'filename' => File.basename(image))
|
173
|
-
puts "res für #{image} exists? #{File.exists?(image)} ist #{res.to_s}" if $VERBOSE
|
174
|
-
rescue MediaWiki::APIError => e
|
175
|
-
puts "rescue für #{image} #{e}" # if $VERBOSE
|
176
|
-
if /verification-error/.match(e.to_s)
|
177
|
-
puts "If you received API error: code 'verification-error', info 'This file did not pass file verification'"
|
178
|
-
puts "this means that the file type and content do not match, e.g. you have a *png file but in reality it is a JPEG file."
|
179
|
-
puts "In this case convert file.png file.png fixes this problem"
|
180
|
-
end
|
181
|
-
end
|
182
|
-
}
|
183
|
-
end
|
191
|
+
push_plugin_or_feature(id, plugin)
|
184
192
|
}
|
185
193
|
end
|
186
194
|
|