elexis-wiki-interface 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5baba0fd1711b2a15b723334288063147ba422d4
4
- data.tar.gz: 168ff2b578edd9fbeb81b0d7d233ebcbd94462a0
3
+ metadata.gz: 1af9634489e62b4b68be7683c5711ea4f29cf403
4
+ data.tar.gz: f8d6689239f46763698749f8b4dd0e2a575dcaf6
5
5
  SHA512:
6
- metadata.gz: d3265153c61faa03c0f5aaeee4d49c36c3cc1819fd558256d3c05bf204fbfce6dd98bd43472b5c3bbea782727e44b3c71796e8ebec34d0177f177081092c452e
7
- data.tar.gz: 469f8477d558afc9ab1064c5b98e5bf4caf8af1c482de768f34a056dbcedb3a0b31f1c87f06cecca5f025f51ea2d5c52108ee0cd3d9da4bd1e8bf336af06c14f
6
+ metadata.gz: 791b7f0da48c69730dabde66490ec12fdca8a509cdb5f1987c41e9216045615156e077f20aa9334cec519da207bbbb0054b12546dc031453105d43fadedf1551
7
+ data.tar.gz: 6c1ac1fdb2cd40507b3cfcd811d9d4df77311afcd70bb3c2c3b9e98d5731b7c7e4028f8919e5daf9d074023c4877736d5304b0f6cd35b4e5a8ef170e349dae0f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elexis-wiki-interface (0.4.5)
4
+ elexis-wiki-interface (0.4.6)
5
5
  eclipse-plugin (>= 0.1)
6
6
  mediawiki-gateway
7
7
  rubyzip (< 1.0.0)
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.4.6 / 15.08.2015
2
+
3
+ * Replace [[Datei:|[[Image: by [[File:
4
+ * Cleanup readme.textile
5
+ * Avoid adding an EOL at the end of the file
6
+
1
7
  === 0.4.5 / 14.08.2015
2
8
 
3
9
  * Don't report plugin without documenteation, as only features are required to have one
data/README.textile CHANGED
@@ -45,7 +45,6 @@ workspace.pull # get actual mediawiki content and place it under doc inside the
45
45
  workspace.info.show
46
46
  pp workspace.views_missing_documentation # returns an array of plugin-ids
47
47
  pp workspace.perspectives_missing_documentation # returns an array of plugin-ids
48
- pp workspace.plugins_missing_documentation # returns an array of plugis
49
48
  workspace.push # push doc/*.mediwiki files to the wiki
50
49
 
51
50
  Or you can inspire you from the spec/*_spec.rb files to see tested examples.
@@ -69,13 +68,20 @@ h3. Conventions
69
68
 
70
69
  * You must create a directory config with a file hosts.yml containing the mediawiki-gateway configuration (host, username, password)
71
70
 
71
+ * Use tag File
72
+ We decided to use only the tag file as https://www.mediawiki.org/wiki/Help:Images/de recommends, even when the legacy tag Image is still supported.
73
+ Also we don't use the tag Datei, as this one is not supported by the Mylin Wikitext extension of Eclipse.
74
+
72
75
  * The push/pull methods use the convention
73
76
  ** in page names all '.' are removed
74
77
  ** a plugin plugin.name has a page plugin.name
75
78
  ** a view view.name with a localized name localized_name has a page <plugin.name>Views<localized_name>
76
79
  ** a perspective perspective.name with a localized name localized_name has a page P_<localized_name>
80
+ ** an image file must be lowercase (files which differ only by the case will be deleted)
81
+ ** use syntax @[[File:@, not [[Datei: or @[[Image:@
77
82
  ** png files should start with their plugin/feature-name followed by '/' by a name or a globally unique name
78
83
  ** png files resides inside the 'doc' sub-directory of each plugin/feature
84
+ ** inside the doc directoy we create a logical link of the plugin|feature name to the directory. This allows us to edit and preview the mediawiki files using the Mylin Wikitext extension of Eclipse.
79
85
 
80
86
  h3. Limitations/TODO
81
87
 
@@ -89,9 +95,6 @@ h3. Limitations/TODO
89
95
  *** ch.elexis.core.application/plugin.xml: name="%elexis.articleSelectorView">
90
96
  ** Missing line [[Datei:Ch.elexis:Artikelauswahl.png]] in http://wiki.elexis.info/ChElexisViewsArtikelArtikelselektor
91
97
  * Perspektives: were not uploaded to doc_de
92
- * No images are pulled/pushed at the moment.
93
- * Check whether a link to the view exists on the wiki.elexis.info/Hauptseite
94
- * No support for features at the moment
95
98
  * No multilingual support at the moment
96
99
 
97
100
 
@@ -1,7 +1,7 @@
1
1
  module Elexis
2
2
  module Wiki
3
3
  module Interface
4
- VERSION = "0.4.5"
4
+ VERSION = "0.4.6"
5
5
  end
6
6
  end
7
7
  end
@@ -15,14 +15,6 @@ module Elexis
15
15
  TestPattern = /[\._]test[s]*$/i
16
16
  $ws_errors = []
17
17
 
18
- # All images under wiki.elexis.info must have images corresponding to the following scheme
19
- # directory (optional): id of the plugin/feature (with feature.feature.group removed)
20
- # imagename:
21
- # Therefore you find und http://wiki.elexis.info/index.php?title=Ch.elexis.connect.mythic&action=edit the line
22
- # [[Image:ch.elexis.connect.mythic_kabel.png|image]] [fig:kabel]
23
- # and under http://wiki.elexis.info/index.php?title=Com.hilotec.elexis.opendocument.feature.feature.group&action=edit
24
- # [[Image:com.hilotec.elexis.opendocument/anleitung_opendocument_1.png|frame|none]]
25
-
26
18
  def Interface.return_canonical_image_name(pagename, filename)
27
19
  pagename = pagename.sub('.feature.feature.group', '')
28
20
  short = File.basename(filename.downcase.sub(ImagePrefix, ''))
@@ -30,12 +22,23 @@ module Elexis
30
22
  /[:\/]/.match(filename) ? pagename + '/' + short : short
31
23
  end
32
24
 
25
+ def Interface.remove_image_ignoring_case(filename)
26
+ files = Dir.glob(filename, File::FNM_CASEFOLD)
27
+ return if files.size == 1
28
+ files.each{
29
+ |file|
30
+ next if File.basename(file).eql?(File.basename(filename))
31
+ cmd = "git rm -f #{file}"
32
+ res = system(cmd)
33
+ }
34
+ end
35
+
33
36
  def Interface.fix_image_locations(filename, pagename)
34
37
  return unless File.exists?(filename)
35
38
  pagename = pagename.sub('.feature.feature.group', '')
36
39
  lines = IO.readlines(filename)
37
40
  dirName = File.dirname(filename)
38
- newLines = []
41
+ newLines = ''
39
42
  showDetails = $VERBOSE
40
43
  if /icpc.mediawiki/i.match(filename)
41
44
  showDetails = true
@@ -43,26 +46,27 @@ module Elexis
43
46
  lines.each{
44
47
  |line|
45
48
  unless m =ImagePattern.match(line)
46
- newLines << line
49
+ newLines += line
47
50
  else
48
51
  new_name = Interface.return_canonical_image_name(pagename, m[2])
49
52
  unless new_name.eql?(File.basename(new_name))
50
53
  FileUtils.ln_s('.', File.dirname(new_name), :verbose => true) unless File.exists?(File.dirname(new_name))
51
54
  end
52
55
  simpleName = File.join(dirName, File.basename(new_name))
53
- if files = Dir.glob(simpleName, File::FNM_CASEFOLD) and files.size == 1
56
+ if files = Dir.glob(simpleName, File::FNM_CASEFOLD) and files.size >= 1
54
57
  new_line = line.sub(m[2], new_name)
55
- newLines << new_line
58
+ newLines += new_line
59
+ Interface.remove_image_ignoring_case(simpleName)
56
60
  else
57
61
  next if defined?(RSpec)
58
- msg = "Could not find image for #{m[0]} searched for #{simpleName} in #{Dir.pwd}"
62
+ msg = "Could not find image for #{m[0]} searched for #{simpleName} in #{Dir.pwd}. files are #{files}"
59
63
  puts msg
60
64
  $ws_errors << msg
61
- newLines << line.sub(ImagePattern, "#{m[1]}#{m[2].sub(':', '_')}")
65
+ newLines += line.sub(ImagePattern, "#{m[1]}#{m[2].sub(':', '_')}")
62
66
  end
63
67
  end
64
68
  }
65
- File.open(filename, "w+") {|f| f.puts newLines}
69
+ File.open(filename, "w") {|f| f.write newLines.gsub(/\[\[Datei:|\[\[Image:/i, '[[File:')}
66
70
  end
67
71
 
68
72
  class Workspace
@@ -195,8 +199,9 @@ module Elexis
195
199
 
196
200
  def remove_image_files_with_id(id, info, docDir = nil)
197
201
  docDir ||= File.join(@info.workspace_dir, id, 'doc')
198
- files = Dir.glob(File.join(docDir, "#{id}_*png")) +
199
- Dir.glob(File.join(docDir, "#{id.capitalize}_*png"))
202
+ files = Dir.glob(File.join(docDir, "#{id}_*jpg"), File::FNM_CASEFOLD) +
203
+ Dir.glob(File.join(docDir, "#{id}_*gif"), File::FNM_CASEFOLD) +
204
+ Dir.glob(File.join(docDir, "#{id}_*png"), File::FNM_CASEFOLD)
200
205
  system("git rm #{files.join(' ')}") if files.size > 0
201
206
  end
202
207
 
@@ -316,11 +321,7 @@ module Elexis
316
321
  file.write(open(image_url).read)
317
322
  end
318
323
  files = Dir.glob(downloaded_image, File::FNM_CASEFOLD)
319
- files.each{
320
- |file|
321
- next if file.eql?(downloaded_image)
322
- FileUtils.rm_f(file, :verbose => true)
323
- }
324
+ Interface.remove_image_ignoring_case(downloaded_image)
324
325
  else
325
326
  puts "skipping image #{image} for page #{pageName}"
326
327
  end
@@ -0,0 +1,19 @@
1
+ [[Kategorie:Basis-System]]
2
+ == View: Bestellblatt==
3
+ {{PluginInfo
4
+ |plugin=ch.elexis
5
+ | category=ch.elexis.datenKategorie
6
+ | wikiName=ChElexisViewsBestellblatt
7
+ | Iatrix-Hilfe=nicht vorhanden
8
+ | view_name=View
9
+ | name=elexis
10
+ | description=Elexis Basismodul
11
+ | category=invisible
12
+ | license=EPL
13
+ | first_commit_date=2007-06-24
14
+ | first_commit_author=rgw_ch
15
+ | responsible=weirich@elexis.ch
16
+ | type=Basis-System
17
+
18
+
19
+ }}
data/spec/pull_spec.rb CHANGED
@@ -80,10 +80,10 @@ describe 'Plugin' do
80
80
  name = File.join(@dataDir, "ch.elexis.icpc", "doc", "Ch.elexis.icpc.mediawiki")
81
81
  expect(Dir.glob(name).size).to eq 1
82
82
  content = IO.read(name)
83
- m = /(Image:[\w\.]+)[:_](\w+.png)/.match(content)
83
+ m = /(File:[\w\.]+)[:_](\w+.png)/.match(content)
84
84
  expect(m).to eq nil
85
- m = /(Image:[\w\.]+)\/(icpc0.png)/i.match(content)
86
- expect(m[0]).to eq 'Image:Ch.elexis.icpc/icpc0.png'
85
+ m = /(File:[\w\.]+)\/(icpc0.png)/i.match(content)
86
+ expect(m[0]).to eq 'File:Ch.elexis.icpc/icpc0.png'
87
87
  end
88
88
 
89
89
  it "should show all users" do
@@ -11,7 +11,7 @@ describe 'ImageHandling' do
11
11
  @dataDir = File.expand_path(File.join(File.dirname(__FILE__), 'run', 'push'))
12
12
  FileUtils.rm_rf(@dataDir)
13
13
  FileUtils.makedirs(@dataDir)
14
- FileUtils.cp_r(@originDir, @dataDir, :verbose => true, :preserve => true)
14
+ FileUtils.cp_r(@originDir, @dataDir, :preserve => true)
15
15
  end
16
16
 
17
17
  it "should return corret canonical_names for a plugin" do
@@ -53,18 +53,13 @@ describe 'ImageHandling' do
53
53
  ]
54
54
  original = IO.read(wiki_file)
55
55
  before.each{|string| expect(original).to include string }
56
- end
57
-
58
- it "should adapt correctly the image name being in #{@dataDir}" do
59
- wiki_file = File.join(@dataDir, 'ch.elexis.icpc', 'doc', 'test.mediawiki')
60
- Dir.chdir(@dataDir)
61
56
 
62
57
  Elexis::Wiki::Interface.fix_image_locations(wiki_file, 'ch.elexis.icpc')
63
- after =['tag_one [[Image:ch.elexis.icpc/icpc1.png|image]]',
64
- 'tag_two [[Image:ch.elexis.icpc/icpc2.png|image]]',
65
- 'tag_three [[Image:icpc3.png|image]]',
66
- 'tag_four [[Datei:ch.elexis.icpc/icpc4.png|image]]',
67
- 'tag_five [[Datei:ch.elexis.icpc/icpc5.png|image]]',
58
+ after =['tag_one [[File:ch.elexis.icpc/icpc1.png|image]]',
59
+ 'tag_two [[File:ch.elexis.icpc/icpc2.png|image]]',
60
+ 'tag_three [[File:icpc3.png|image]]',
61
+ 'tag_four [[File:ch.elexis.icpc/icpc4.png|image]]',
62
+ 'tag_five [[File:ch.elexis.icpc/icpc5.png|image]]',
68
63
  ]
69
64
  changed = IO.read(wiki_file)
70
65
  after.each{|string| expect(changed).to include string }
@@ -75,11 +70,26 @@ describe 'ImageHandling' do
75
70
  Dir.chdir(@dataDir)
76
71
 
77
72
  Elexis::Wiki::Interface.fix_image_locations(wiki_file, 'ch.elexis.icpc')
78
- after =['tag_three [[Image:icpc3.png|image]]',
73
+ after =['tag_three [[File:icpc3.png|image]]',
79
74
  ]
80
75
  changed = IO.read(wiki_file)
81
76
  after.each{|string| expect(changed).to include string }
82
77
  end
83
78
 
79
+ it "should not add an EOL if nothing changed" do
80
+ id = 'ch.elexis.core.application'
81
+ @originDir = File.expand_path(File.join(File.dirname(__FILE__), 'data', 'push', id))
82
+ @dataDir = File.expand_path(File.join(File.dirname(__FILE__), 'run', 'push'))
83
+ FileUtils.rm_rf(@dataDir)
84
+ FileUtils.makedirs(@dataDir)
85
+ FileUtils.cp_r(@originDir, @dataDir, :preserve => true)
86
+ wiki_file = File.join(@dataDir, id, 'doc', 'ChElexisViewsBestellblatt.mediawiki')
87
+ orig_content = IO.read(wiki_file)
88
+ Dir.chdir(@dataDir)
89
+ Elexis::Wiki::Interface.fix_image_locations(wiki_file, id)
90
+ changed = IO.read(wiki_file)
91
+ expect(changed).to eql orig_content
92
+ end
93
+
84
94
  end
85
95
 
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.4.5
4
+ version: 0.4.6
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-08-14 00:00:00.000000000 Z
11
+ date: 2015-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -171,6 +171,7 @@ files:
171
171
  - spec/data/pull/ch.elexis.notes/plugin_en.properties
172
172
  - spec/data/pull/ch.elexis.notes/plugin_fr.properties
173
173
  - spec/data/pull/doc_de/.project
174
+ - spec/data/push/ch.elexis.core.application/doc/ChElexisViewsBestellblatt.mediawiki
174
175
  - spec/data/push/ch.elexis.icpc/.project
175
176
  - spec/data/push/ch.elexis.icpc/META-INF/MANIFEST.MF
176
177
  - spec/data/push/ch.elexis.icpc/doc/ch.elexis.icpc_icpc1.png
@@ -185,9 +186,6 @@ files:
185
186
  - spec/data/push/ch.elexis.icpc/plugin.xml
186
187
  - spec/pull_spec.rb
187
188
  - spec/push_spec.rb
188
- - spec/run/push/ch.elexis.icpc/doc/icpc3.png
189
- - spec/run/push/ch.elexis.icpc/doc/icpc4.png
190
- - spec/run/push/ch.elexis.icpc/doc/icpc5.png
191
189
  - spec/spec_helper.rb
192
190
  - spec/update_images_spec.rb
193
191
  - spec/user_spec.rb
@@ -240,6 +238,7 @@ test_files:
240
238
  - spec/data/pull/ch.elexis.notes/plugin_en.properties
241
239
  - spec/data/pull/ch.elexis.notes/plugin_fr.properties
242
240
  - spec/data/pull/doc_de/.project
241
+ - spec/data/push/ch.elexis.core.application/doc/ChElexisViewsBestellblatt.mediawiki
243
242
  - spec/data/push/ch.elexis.icpc/.project
244
243
  - spec/data/push/ch.elexis.icpc/META-INF/MANIFEST.MF
245
244
  - spec/data/push/ch.elexis.icpc/doc/ch.elexis.icpc_icpc1.png
@@ -254,9 +253,6 @@ test_files:
254
253
  - spec/data/push/ch.elexis.icpc/plugin.xml
255
254
  - spec/pull_spec.rb
256
255
  - spec/push_spec.rb
257
- - spec/run/push/ch.elexis.icpc/doc/icpc3.png
258
- - spec/run/push/ch.elexis.icpc/doc/icpc4.png
259
- - spec/run/push/ch.elexis.icpc/doc/icpc5.png
260
256
  - spec/spec_helper.rb
261
257
  - spec/update_images_spec.rb
262
258
  - spec/user_spec.rb