wortsammler 2.0.0.dev1 → 2.0.0.dev2

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.
@@ -15,12 +15,12 @@ describe "Wortsammler generic issues" do
15
15
  it "provides a help", :exp => false do
16
16
  result = `#{wortsammler} -h`
17
17
  result.should include("Usage: Wortsammler [options]")
18
- $?.success?.should==true
18
+ $?.success?.should == true
19
19
  end
20
20
 
21
21
  it "runs silent", :exp => false do
22
22
  result = `#{wortsammler}`
23
- result.empty?.should==true
23
+ result.empty?.should == true
24
24
  end
25
25
 
26
26
  it "reports version numbers", :exp => false do
@@ -38,16 +38,16 @@ describe "Wortsammler generic issues" do
38
38
  it "can create a new project folder", :exp => false do
39
39
  FileUtils.rm_rf(testprojectdir)
40
40
  system "#{wortsammler} -n #{testprojectdir}"
41
- $?.success?.should==true
41
+ $?.success?.should == true
42
42
 
43
43
  Dir["#{testprojectdir}/**/*"].should include "#{testprojectdir}/001_Main"
44
44
  Dir["#{testprojectdir}/**/snippets.xlsx"].should include "#{testprojectdir}/900_snippets/snippets.xlsx"
45
45
  end
46
46
 
47
47
  it "does not initialize into an existing project folder" do
48
- tempdir=Dir.mktmpdir
48
+ tempdir = Dir.mktmpdir
49
49
  `#{wortsammler} -n #{tempdir}`
50
- $?.success?.should==false
50
+ $?.success?.should == false
51
51
  end
52
52
 
53
53
  it "controls the pandoc options by document class" do
@@ -58,7 +58,7 @@ end
58
58
  describe "Wortsammler options validator" do
59
59
  it "rejects no processing" do
60
60
  system "#{wortsammler} -i."
61
- $?.success?.should==false
61
+ $?.success?.should == false
62
62
  end
63
63
 
64
64
 
@@ -68,45 +68,45 @@ describe "Wortsammler beautifier features" do
68
68
 
69
69
 
70
70
  it "beautifies all markdown files in a folder" do
71
- tempdir=Dir.mktmpdir
72
- mdtext ="#this is headline\n\n lorem ipsum\n\nbla fasel"
71
+ tempdir = Dir.mktmpdir
72
+ mdtext = "#this is headline\n\n lorem ipsum\n\nbla fasel"
73
73
 
74
- cycles=10
74
+ cycles = 10
75
75
  cycles.times { |i|
76
76
  File.open("#{tempdir}/#{i}.md", "w") { |f| f.puts mdtext }
77
77
  }
78
78
 
79
79
  system "#{wortsammler} -bi #{tempdir}"
80
- $?.success?.should==true
80
+ $?.success?.should == true
81
81
 
82
82
  cycles.times { |i|
83
- beautified_result=File.open("#{tempdir}/#{i}.md").readlines.join
83
+ beautified_result = File.open("#{tempdir}/#{i}.md").readlines.join
84
84
  beautified_result.should include("# this is headline")
85
85
  }
86
86
  end
87
87
 
88
88
 
89
89
  it "beautifies a single file", exp: false do
90
- tempdir=Dir.mktmpdir
91
- mdfile ="#{tempdir}/single.md"
92
- mdtext ="#this is headline\n\n lorem ipsum\n\nbla fasel"
90
+ tempdir = Dir.mktmpdir
91
+ mdfile = "#{tempdir}/single.md"
92
+ mdtext = "#this is headline\n\n lorem ipsum\n\nbla fasel"
93
93
 
94
94
  File.open(mdfile, "w") { |f| f.puts mdtext }
95
95
  system "#{wortsammler} -bi #{mdfile}"
96
- $?.success?.should==true
96
+ $?.success?.should == true
97
97
 
98
- beautified_result=File.open(mdfile).readlines.join
98
+ beautified_result = File.open(mdfile).readlines.join
99
99
  beautified_result.should include("# this is headline")
100
100
  end
101
101
 
102
102
  it "recognizes if the specified manifest file is a directory", exp: false do
103
103
  FileUtils.cd("testproject/30_Sources/ZSUPP_Tools") { |d|
104
- manifest="../ZSUPP_Manifests"
105
- cmd = "#{wortsammler} -bm #{manifest} 2>&1"
106
- r =`#{cmd}`
107
- r.include?("directory").should==true
104
+ manifest = "../ZSUPP_Manifests"
105
+ cmd = "#{wortsammler} -bm #{manifest} 2>&1"
106
+ r = `#{cmd}`
107
+ r.include?("directory").should == true
108
108
  }
109
- $?.success?.should==false
109
+ $?.success?.should == false
110
110
  end
111
111
  it "beautifies input files in a manifest" do
112
112
  FileUtils.cd("testproject/30_Sources/ZSUPP_Tools") { |d|
@@ -114,12 +114,12 @@ describe "Wortsammler beautifier features" do
114
114
  cmd = "#{wortsammler} -bm #{manifest}"
115
115
  system cmd
116
116
  }
117
- $?.success?.should==true
117
+ $?.success?.should == true
118
118
  end
119
119
 
120
120
  it "claims missing input" do
121
121
  system "#{wortsammler} -b"
122
- $?.success?.should==false
122
+ $?.success?.should == false
123
123
  end
124
124
 
125
125
 
@@ -148,50 +148,50 @@ end
148
148
  describe "Wortsammler conversion" do
149
149
 
150
150
  it "converts a single file to output format" do
151
- tempdir=Dir.mktmpdir
152
- mdfile ="#{tempdir}/single.md"
153
- mdtext ="#this is headline\n\n lorem ipsum\n\nbla fasel"
151
+ tempdir = Dir.mktmpdir
152
+ mdfile = "#{tempdir}/single.md"
153
+ mdtext = "#this is headline\n\n lorem ipsum\n\nbla fasel"
154
154
  File.open(mdfile, "w") { |f| f.puts mdtext }
155
155
  system "#{wortsammler} -pi #{mdfile} -o #{tempdir} -f latex:pdf:html:docx"
156
- $?.success?.should==true
156
+ $?.success?.should == true
157
157
 
158
158
 
159
- Dir["#{tempdir}/*"].map { |f| File.basename(f) }.should== ["single.docx",
160
- "single.html",
161
- "single.latex",
162
- "single.log",
163
- "single.md",
164
- "single.pdf"
159
+ Dir["#{tempdir}/*"].map { |f| File.basename(f) }.sort.should == ["single.docx",
160
+ "single.html",
161
+ "single.latex",
162
+ "single.log",
163
+ "single.md",
164
+ "single.pdf"
165
165
  ]
166
166
  end
167
167
 
168
168
  it "converts a single file to default output format" do
169
- tempdir=Dir.mktmpdir
170
- mdfile ="#{tempdir}/single.md"
171
- mdtext ="#this is headline\n\n lorem ipsum\n\nbla fasel"
169
+ tempdir = Dir.mktmpdir
170
+ mdfile = "#{tempdir}/single.md"
171
+ mdtext = "#this is headline\n\n lorem ipsum\n\nbla fasel"
172
172
  File.open(mdfile, "w") { |f| f.puts mdtext }
173
173
  system "#{wortsammler} -pi #{mdfile} -o #{tempdir}"
174
- $?.success?.should==true
174
+ $?.success?.should == true
175
175
 
176
176
 
177
- Dir["#{tempdir}/*"].map { |f| File.basename(f) }.should== ["single.log",
178
- "single.md",
179
- "single.pdf"
177
+ Dir["#{tempdir}/*"].map { |f| File.basename(f) }.sort.should == ["single.log",
178
+ "single.md",
179
+ "single.pdf"
180
180
  ]
181
181
  end
182
182
 
183
183
 
184
184
  it "handles chapters up to 6 levels", exp: false do
185
- tempdir="#{specdir}/../testoutput"
186
- mdfile ="#{tempdir}/chapternesting.md"
187
- mdtext ="#this is headline\n\n lorem ipsum\n\nbla fasel"
185
+ tempdir = "#{specdir}/../testoutput"
186
+ mdfile = "#{tempdir}/chapternesting.md"
187
+ mdtext = "#this is headline\n\n lorem ipsum\n\nbla fasel"
188
188
 
189
189
  def lorem(j)
190
190
  (1.upto 100).map { |i| "text_#{j} lorem ipsum #{i} dolor " }.join(" ")
191
191
  end
192
192
 
193
193
  def chapter(i, depth)
194
- ["\n\n", "##########"[1..depth], " this is example on level #{i} .. #{depth}\n\n",
194
+ ["\n\n", "##########"[1 .. depth], " this is example on level #{i} .. #{depth}\n\n",
195
195
  lorem(i),
196
196
  ].join("")
197
197
  end
@@ -205,27 +205,27 @@ describe "Wortsammler conversion" do
205
205
  }
206
206
 
207
207
  system "#{wortsammler} -pbi '#{mdfile}' -o '#{tempdir}' -f pdf:latex"
208
- $?.success?.should==true
208
+ $?.success?.should == true
209
209
 
210
- Dir["#{tempdir}/chapternesting*"].map { |f| File.basename(f) }.sort.should== ["chapternesting.md",
211
- "chapternesting.pdf",
212
- "chapternesting.latex",
213
- "chapternesting.log",
214
- "chapternesting.md.bak"
210
+ Dir["#{tempdir}/chapternesting*"].map { |f| File.basename(f) }.sort.should == ["chapternesting.md",
211
+ "chapternesting.pdf",
212
+ "chapternesting.latex",
213
+ "chapternesting.log",
214
+ "chapternesting.md.bak"
215
215
  ].sort
216
216
  end
217
217
 
218
218
  it "handles lists up to 9 levels", exp: false do
219
- tempdir="#{specdir}/../testoutput"
220
- mdfile ="#{tempdir}/listnesting.md"
221
- mdtext ="#this is headline\n\n lorem ipsum\n\nbla fasel"
219
+ tempdir = "#{specdir}/../testoutput"
220
+ mdfile = "#{tempdir}/listnesting.md"
221
+ mdtext = "#this is headline\n\n lorem ipsum\n\nbla fasel"
222
222
 
223
223
  def lorem(j)
224
224
  (1.upto 100).map { |i| "text_#{j} lorem ipsum #{i} dolor " }.join(" ")
225
225
  end
226
226
 
227
227
  def chapter(i, depth)
228
- ["\n\n", "##########"[1..depth], " this is example on level #{i} .. #{depth}\n\n",
228
+ ["\n\n", "##########"[1 .. depth], " this is example on level #{i} .. #{depth}\n\n",
229
229
  lorem(i),
230
230
  ].join("")
231
231
  end
@@ -237,24 +237,24 @@ describe "Wortsammler conversion" do
237
237
  f.puts ""
238
238
 
239
239
  0.upto 8 do |i|
240
- f.puts [" "*i, "- this is list level #{i}"].join
240
+ f.puts [" " * i, "- this is list level #{i}"].join
241
241
  end
242
242
  }
243
243
 
244
244
  system "#{wortsammler} -pbi '#{mdfile}' -o '#{tempdir}' -f pdf:latex"
245
- $?.success?.should==true
245
+ $?.success?.should == true
246
246
 
247
- Dir["#{tempdir}/listnesting*"].map { |f| File.basename(f) }.sort.should== ["listnesting.md",
248
- "listnesting.pdf",
249
- "listnesting.latex",
250
- "listnesting.log",
251
- "listnesting.md.bak"
247
+ Dir["#{tempdir}/listnesting*"].map { |f| File.basename(f) }.sort.should == ["listnesting.md",
248
+ "listnesting.pdf",
249
+ "listnesting.latex",
250
+ "listnesting.log",
251
+ "listnesting.md.bak"
252
252
  ].sort
253
253
  end
254
254
 
255
255
  it "converts all files within a folder to output format" do
256
- tempdir =Dir.mktmpdir
257
- mdtext ="# Header\n\n lorem ipsum\n"
256
+ tempdir = Dir.mktmpdir
257
+ mdtext = "# Header\n\n lorem ipsum\n"
258
258
  basefiles = ["f1", "f2", "f3"]
259
259
  outfiles = basefiles.map { |f| ["#{f}.md", "#{f}.latex"] }.flatten.sort
260
260
  basefiles.each { |f|
@@ -262,54 +262,61 @@ describe "Wortsammler conversion" do
262
262
  }
263
263
 
264
264
  system "#{wortsammler} -pi #{tempdir} -o #{tempdir} -f latex"
265
- $?.success?.should==true
265
+ $?.success?.should == true
266
266
 
267
- Dir["#{tempdir}/*"].map { |f| File.basename(f) }.sort.should== outfiles
267
+ Dir["#{tempdir}/*"].map { |f| File.basename(f) }.sort.should == outfiles
268
268
 
269
269
  end
270
270
 
271
271
  it "processes a manifest" do
272
272
  FileUtils.cd("testproject/30_Sources/ZSUPP_Tools") { |d|
273
- manifest="../ZSUPP_Manifests/sample_the-sample-document.yaml"
274
- cmd = "#{wortsammler} -pm #{manifest}"
273
+ manifest = "../ZSUPP_Manifests/sample_the-sample-document.yaml"
274
+ cmd = "#{wortsammler} -pm #{manifest}"
275
275
  system cmd
276
276
  }
277
- $?.success?.should==true
277
+ $?.success?.should == true
278
278
  end
279
279
 
280
280
  it "investigates the existence of a manifest" do
281
- manifest="testproject/30_Sources/ZSUPP_Manifests/xxthis-path-does-not-exist.yaml"
281
+ manifest = "testproject/30_Sources/ZSUPP_Manifests/xxthis-path-does-not-exist.yaml"
282
282
  system "#{wortsammler} -m #{manifest}"
283
- $?.success?.should==false
283
+ $?.success?.should == false
284
284
  end
285
285
 
286
286
  it "extracts the traceables according to a manifest", :exp => false do
287
- manifest="testproject/30_Sources/ZSUPP_Manifests/sample_the-sample-document.yaml"
287
+ manifest = "testproject/30_Sources/ZSUPP_Manifests/sample_the-sample-document.yaml"
288
+ tracefile = "testproject/30_Sources/ZGEN_RequirementsTracing/RS_Main.traces.md"
289
+ FileUtils.rm(tracefile) if File.exists?(tracefile)
290
+
288
291
  system "#{wortsammler} -cm #{manifest}"
289
- $?.success?.should==true
292
+ result = File.read("testproject/30_Sources/ZGEN_RequirementsTracing/RS_Main.traces.md")
293
+
294
+ require 'pry';binding.pry
295
+ expect(result).to include("\\[RS\\_Comp\\_001\\] **Flexibler Dokumentumfang** { }()")
296
+ $?.success?.should == true
290
297
  end
291
298
 
292
299
 
293
300
  it "extracts plantuml according to a manifest", :exp => false do
294
- manifest="testproject/30_Sources/ZSUPP_Manifests/sample_the-sample-document.yaml"
301
+ manifest = "testproject/30_Sources/ZSUPP_Manifests/sample_the-sample-document.yaml"
295
302
  system "#{wortsammler} -um #{manifest}"
296
- $?.success?.should==true
303
+ $?.success?.should == true
297
304
  end
298
305
 
299
306
  it "extracts plantuml from a single file", :exp => false do
300
- outfile="#{testoutput}/authentification.png"
307
+ outfile = "#{testoutput}/authentification.png"
301
308
  FileUtils.rm(outfile) if File.exists?(outfile)
302
309
  system "#{wortsammler} -ui \"#{specdir}/TC_EXP_002.md\""
303
- $?.success?.should==true
304
- File.exist?(outfile).should==true
310
+ $?.success?.should == true
311
+ File.exist?(outfile).should == true
305
312
  end
306
313
 
307
314
  it "extracts plantuml from a folder", :exp => false do
308
- outfile="#{testoutput}/authentification.png"
315
+ outfile = "#{testoutput}/authentification.png"
309
316
  FileUtils.rm(outfile) if File.exists?(outfile)
310
317
  system "#{wortsammler} -ui \"#{specdir}\""
311
- $?.success?.should==true
312
- File.exist?(outfile).should==true
318
+ $?.success?.should == true
319
+ File.exist?(outfile).should == true
313
320
  end
314
321
 
315
322
 
@@ -331,17 +338,17 @@ describe "Wortsammler conversion" do
331
338
  cmd = "rake sample"
332
339
  system cmd
333
340
  }
334
- Dir["testproject/30_Sources/ZGEN_Documents/*.*"].count.should==15
335
- $?.success?.should==true
341
+ Dir["testproject/30_Sources/ZGEN_Documents/*.*"].count.should == 15
342
+ $?.success?.should == true
336
343
  end
337
344
 
338
345
  it "compiles all documents", exp: false do
339
346
  FileUtils.cd("testproject/30_Sources/ZSUPP_Tools") { |d|
340
- path =ENV['PATH']
341
- ENV['PATH']="#{wortsammlerbin}:#{path}"
347
+ path = ENV['PATH']
348
+ ENV['PATH'] = "#{wortsammlerbin}:#{path}"
342
349
  puts ENV['PATH']
343
350
  #system 'wortsammler -h'
344
- cmd= "rake all"
351
+ cmd = "rake all"
345
352
  #system cmd
346
353
  }
347
354
  end
@@ -375,27 +382,27 @@ end
375
382
 
376
383
  describe "Wortsammler syntax extensions", :exp => false do
377
384
  it "[RS_Comp_012] supports embedded images" do
378
- tempdir ="#{specdir}/../testoutput"
379
- imagefile ="floating-image.pdf"
385
+ tempdir = "#{specdir}/../testoutput"
386
+ imagefile = "floating-image.pdf"
380
387
 
381
388
  FileUtils.cd(tempdir) { |c|
382
389
  FileUtils.cp("#{specdir}/#{imagefile}", ".")
383
390
 
384
- mdfile="embedded-image.md"
385
-
386
- mdtext=["#this is headline",
387
- (5..100).to_a.map { |oi|
388
- ["\n\n",
389
- "this is image\n\n~~EMBED \"#{imagefile}\" o 40mm 60mm~~",
390
- (1..20).to_a.map { |ii|
391
- "#{oi} und #{ii} lorem ipsum und blafasel"
392
- }.join(" "),
393
- "\n\n",
394
- (5..15+oi).to_a.map { |ii|
395
- "#{oi} und #{ii} lorem ipsum und blafasel"
396
- }.join(" "),
397
- "\n\n"]
398
- }
391
+ mdfile = "embedded-image.md"
392
+
393
+ mdtext = ["#this is headline",
394
+ (5 .. 100).to_a.map { |oi|
395
+ ["\n\n",
396
+ "this is image\n\n~~EMBED \"#{imagefile}\" o 40mm 60mm~~",
397
+ (1 .. 20).to_a.map { |ii|
398
+ "#{oi} und #{ii} lorem ipsum und blafasel"
399
+ }.join(" "),
400
+ "\n\n",
401
+ (5 .. 15 + oi).to_a.map { |ii|
402
+ "#{oi} und #{ii} lorem ipsum und blafasel"
403
+ }.join(" "),
404
+ "\n\n"]
405
+ }
399
406
  ].flatten.join("\n")
400
407
 
401
408
  File.open(mdfile, "w") { |f| f.puts mdtext }
@@ -403,7 +410,7 @@ describe "Wortsammler syntax extensions", :exp => false do
403
410
  system "#{wortsammler} -pi '#{mdfile}' -o '.' -f pdf:latex:html:docx"
404
411
  FileUtils.rm imagefile
405
412
  }
406
- $?.success?.should==true
413
+ $?.success?.should == true
407
414
  end
408
415
 
409
416
  it "TC_EXP_001 expands expected results from testcases", exp: false do
@@ -413,7 +420,7 @@ describe "Wortsammler syntax extensions", :exp => false do
413
420
  File.unlink(outfile) if File.exists?(outfile)
414
421
  proc.prepareFile("#{specdir}/TC_EXP_001.md", outfile)
415
422
 
416
- a=File.open(outfile, "r").readlines.join
423
+ a = File.open(outfile, "r").readlines.join
417
424
  a.should include("TC-DES-003-01")
418
425
  end
419
426
 
@@ -425,32 +432,32 @@ describe "Wortsammler syntax extensions", :exp => false do
425
432
  proc.prepareFile("#{specdir}/TC_EXP_002.md", outfile)
426
433
 
427
434
  a = File.open(outfile, "r").readlines.join
428
- a.include?(".plantuml").should==false
435
+ a.include?(".plantuml").should == false
429
436
  end
430
437
 
431
- it "TC_EXP_003 handles Markdown inlays", exp: true do
432
- tempdir ="#{specdir}/../testoutput"
433
- mdinlayfile ="TC_EXP_003_1.md"
434
- mdinlayfile_1 ="TC_EXP_003_2.md"
435
- mdfile ="tc_exp_003"
438
+ it "TC_EXP_003x handles Markdown inlays", exp: true do
439
+ tempdir = "#{specdir}/../testoutput"
440
+ mdinlayfile = "TC_EXP_003_1.md"
441
+ mdinlayfile_1 = "TC_EXP_003_2.md"
442
+ mdfile = "tc_exp_003"
436
443
 
437
444
  FileUtils.cd(tempdir) { |c|
438
445
  FileUtils.cp("#{specdir}/#{mdinlayfile}", ".")
439
446
  FileUtils.cp("#{specdir}/#{mdinlayfile_1}", ".")
440
447
 
441
448
 
442
- mdtext=["#this is headline",
443
- "",
444
- "~~~~",
445
- "", "now verbatim by indent inclucde #{mdinlayfile}", "",
446
- " ~~MD \"#{mdinlayfile}\"~~",
447
- "~~~~",
448
- "",
449
- "", "now full format inclucde #{mdinlayfile}", "",
450
- "~~MD \"#{mdinlayfile}\"~~",
451
- "",
452
- "", "now full format inclucde #{mdinlayfile_1}", "",
453
- "~~MD \"#{mdinlayfile_1}\"~~",
449
+ mdtext = ["#this is headline",
450
+ "",
451
+ "~~~~",
452
+ "", "now verbatim by indent inclucde #{mdinlayfile}", "",
453
+ " ~~MD \"#{mdinlayfile.gsub('_', '\_')}\"~~",
454
+ "~~~~",
455
+ "",
456
+ "", "now full format inclucde #{mdinlayfile}", "",
457
+ "~~MD \"#{mdinlayfile}\"~~",
458
+ "",
459
+ "", "now full format inclucde #{mdinlayfile_1}", "",
460
+ "~~MD \"#{mdinlayfile_1}\"~~",
454
461
  ].flatten.join("\n")
455
462
 
456
463
  File.open("#{mdfile}.md", "w") { |f| f.puts mdtext }
@@ -471,8 +478,8 @@ describe "Wortsammler syntax extensions", :exp => false do
471
478
  system "pdftotext \"#{testoutput}/test_mkindex.pdf\""
472
479
  the_time = Time.now.strftime("%B %-d, %Y")
473
480
  ref = File.open("#{specdir}/test_mkindex_reference.txt", encoding: "ISO-8859-1").read
474
- result = File.open("#{testoutput}/test_mkindex.txt", encoding: "ISO-8859-1").read
475
- result = result.gsub(the_time, "January 5, 2019") # adapt this if you update the reference
481
+ result = File.open("#{testoutput}/test_mkindex.txt", encoding: "ISO-8859-1").read
482
+ result = result.gsub(the_time, "January 5, 2019") # adapt this if you update the reference
476
483
  expect(result).to eq ref
477
484
  end
478
485
 
@@ -480,7 +487,7 @@ describe "Wortsammler syntax extensions", :exp => false do
480
487
  system %Q{wortsammler -pi '#{specdir}/test_mkindex.md' -f pdf:latex -o '#{testoutput}' >> '#{testoutput}/test_mkindex.lst'}
481
488
  system "pdftotext \"#{testoutput}/test_mkindex.pdf\""
482
489
  result = File.open("#{testoutput }/test_mkindex.lst").read
483
- result.include?("[WARN]").should==true
490
+ result.include?("[WARN]").should == true
484
491
  end
485
492
 
486
493