elexis-wiki-interface 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.textile +1 -1
- data/history.textile +6 -0
- data/lib/elexis/wiki/images.rb +6 -2
- data/lib/elexis/wiki/interface.rb +15 -5
- data/lib/elexis/wiki/version.rb +1 -1
- data/lib/elexis/wiki/workspace.rb +7 -2
- data/spec/images_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 291384c9cc7a771163d3852d2e385f453a07ef04
|
4
|
+
data.tar.gz: fb1ae9a6f28c11accef947fed4a0589cec24aa57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e2d1634af029853509980f403d3192ddb8bccedfaa6952dacf22318692b338826d14912b5f72474bc05236126e38c4beaa24d55d91dda12ee499d099bf1cf28
|
7
|
+
data.tar.gz: 1e0449c892a184e296ebb54ef91cfac61fb48136f35d31a1be985200a3206eb8100aadd9a19ba4a520cdb563555b2f343c5ddbddf288d12b3bb580f1a8f47c60
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elexis-wiki-interface (0.5.
|
4
|
+
elexis-wiki-interface (0.5.1)
|
5
5
|
eclipse-plugin (>= 0.1)
|
6
6
|
mediawiki-gateway
|
7
7
|
mediawiki_api
|
@@ -17,12 +17,12 @@ GEM
|
|
17
17
|
columnize (0.9.0)
|
18
18
|
diff-lcs (1.2.5)
|
19
19
|
docile (1.1.5)
|
20
|
-
domain_name (0.5.
|
20
|
+
domain_name (0.5.25)
|
21
21
|
unf (>= 0.0.5, < 1.0.0)
|
22
22
|
eclipse-plugin (0.3)
|
23
23
|
nokogiri
|
24
24
|
rubyzip (< 1.0.0)
|
25
|
-
faraday (0.9.
|
25
|
+
faraday (0.9.2)
|
26
26
|
multipart-post (>= 1.2, < 3)
|
27
27
|
faraday-cookie_jar (0.0.6)
|
28
28
|
faraday (>= 0.7.4)
|
@@ -36,7 +36,7 @@ GEM
|
|
36
36
|
faraday (~> 0.9, >= 0.9.0)
|
37
37
|
faraday-cookie_jar (~> 0.0, >= 0.0.6)
|
38
38
|
method_source (0.8.2)
|
39
|
-
mime-types (2.6.
|
39
|
+
mime-types (2.6.2)
|
40
40
|
mini_portile (0.6.2)
|
41
41
|
multipart-post (2.0.0)
|
42
42
|
netrc (0.10.3)
|
data/README.textile
CHANGED
@@ -33,7 +33,7 @@ h3. using some built-in helpers (mainly for the jenkins-CI)
|
|
33
33
|
Each of the helper script below should work if you have a ruby installation >= 1.9.2 and executed @gem install bundler && bundle install@ in directory where
|
34
34
|
|
35
35
|
bc. wiki_pull
|
36
|
-
|
36
|
+
wiki_pull_and_commit
|
37
37
|
wiki_push
|
38
38
|
|
39
39
|
h3. in a ruby script
|
data/history.textile
CHANGED
data/lib/elexis/wiki/images.rb
CHANGED
@@ -43,11 +43,15 @@ module Elexis
|
|
43
43
|
@docs = Dir.glob('**/doc').reject{|x| x.match(/(^vendor|\/vendor)\//) } # doc_fr is mostly a duplicate of doc_de
|
44
44
|
@docs.each{
|
45
45
|
|doc_dir|
|
46
|
-
pngs = Dir.glob("#{doc_dir}/**/*.{png,jpg}")
|
46
|
+
pngs = Dir.glob("#{doc_dir}/**/*.{png,jpg}", File::FNM_CASEFOLD)
|
47
47
|
puts "#{doc_dir} has #{pngs.size} png" if $VERBOSE
|
48
48
|
next if pngs.size == 0
|
49
49
|
pngs.each {
|
50
50
|
|png|
|
51
|
+
if File.size(png) == 0
|
52
|
+
FileUtils.rm_f(png, :verbose => true)
|
53
|
+
next
|
54
|
+
end
|
51
55
|
sha256 = Digest::SHA256.hexdigest(IO.read(png))
|
52
56
|
pict = { :sha256 => sha256,
|
53
57
|
:name => File.basename(png),
|
@@ -58,6 +62,7 @@ module Elexis
|
|
58
62
|
# break if pngs.size > 1
|
59
63
|
}
|
60
64
|
@sha_2_png = {}
|
65
|
+
@pictures.uniq! { |elem| elem[:path].downcase }
|
61
66
|
@pictures.each {
|
62
67
|
|picture|
|
63
68
|
if @sha_2_png[picture[:sha256]]
|
@@ -242,7 +247,6 @@ module Elexis
|
|
242
247
|
return unless @add_changes_to_git
|
243
248
|
res = system(git_cmd)
|
244
249
|
unless res
|
245
|
-
binding.pry
|
246
250
|
raise "Running #{git_cmd} failed"
|
247
251
|
end
|
248
252
|
@actions << git_cmd
|
@@ -48,7 +48,7 @@ module Elexis
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def images(page)
|
51
|
-
|
51
|
+
imgs = @mw_gw.images(page).collect{|x| x.gsub(' ','_') }
|
52
52
|
end
|
53
53
|
|
54
54
|
def users
|
@@ -118,10 +118,20 @@ module Elexis
|
|
118
118
|
else
|
119
119
|
json_url = "#{@wiki_url}?action=query&format=json&list=allimages&ailimit=1&aifrom=#{image.sub(File.extname(image), '')}"
|
120
120
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
121
|
+
begin
|
122
|
+
json = RestClient.get(json_url)
|
123
|
+
unless json
|
124
|
+
msg = "Could not fetch for image #{image} for #{pageName} using #{json_url}"
|
125
|
+
puts "JSON: #{msg}"
|
126
|
+
$ws_errors << msg
|
127
|
+
return
|
128
|
+
end
|
129
|
+
rescue => e
|
130
|
+
msg = "download_image_file #{image} failed #{e}"
|
131
|
+
puts msg
|
132
|
+
puts e.backtrace.join("\n") if $VERBOSE
|
133
|
+
$ws_errors << msg
|
134
|
+
raise msg
|
125
135
|
end
|
126
136
|
begin
|
127
137
|
answer = JSON.parse(json)
|
data/lib/elexis/wiki/version.rb
CHANGED
@@ -236,8 +236,13 @@ module Elexis
|
|
236
236
|
image_name = File.basename(image)
|
237
237
|
m = Wiki::ImagePattern.match(image_name)
|
238
238
|
image_name = m[2] if m and not image_name.index('-')
|
239
|
-
|
240
|
-
|
239
|
+
begin
|
240
|
+
@if.download_image_file(image_name, image_name, pageName)
|
241
|
+
rescue => e
|
242
|
+
msg = "Failed download #{image_name}"
|
243
|
+
puts msg
|
244
|
+
$ws_errors << msg
|
245
|
+
end
|
241
246
|
break if defined?(RSpec) and not /matrix|icpc|ehc/i.match(pageName) # speed up RSpec
|
242
247
|
}
|
243
248
|
else
|
data/spec/images_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elexis-wiki-interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
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-10-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -371,3 +371,4 @@ test_files:
|
|
371
371
|
- spec/interface_spec.rb
|
372
372
|
- spec/pull_spec.rb
|
373
373
|
- spec/spec_helper.rb
|
374
|
+
has_rdoc:
|