metanorma-iso 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ require "pathname"
5
5
  require "open-uri"
6
6
  require "pp"
7
7
  require "isodoc"
8
+ require "fileutils"
8
9
 
9
10
  module Asciidoctor
10
11
  module ISO
@@ -28,11 +29,11 @@ module Asciidoctor
28
29
  unless node.attr("nodoc") || !node.attr("docfile")
29
30
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
30
31
  html_converter_alt(node).convert(@filename + ".xml")
31
- system "mv #{@filename}.html #{@filename}_alt.html"
32
+ FileUtils.mv "#{@filename}.html", "#{@filename}_alt.html"
32
33
  html_converter(node).convert(@filename + ".xml")
33
34
  doc_converter(node).convert(@filename + ".xml")
34
35
  end
35
- @files_to_delete.each { |f| system "rm #{f}" }
36
+ @files_to_delete.each { |f| FileUtils.rm f }
36
37
  ret
37
38
  end
38
39
 
@@ -259,6 +259,9 @@
259
259
  </define>
260
260
  <define name="uri">
261
261
  <element name="uri">
262
+ <optional>
263
+ <attribute name="type"/>
264
+ </optional>
262
265
  <data type="anyURI"/>
263
266
  </element>
264
267
  </define>
@@ -444,6 +447,9 @@
444
447
  <ref name="BibItemType"/>
445
448
  </attribute>
446
449
  </optional>
450
+ <optional>
451
+ <ref name="fetched"/>
452
+ </optional>
447
453
  <choice>
448
454
  <oneOrMore>
449
455
  <ref name="btitle"/>
@@ -523,6 +529,11 @@
523
529
  <ref name="FormattedString"/>
524
530
  </element>
525
531
  </define>
532
+ <define name="fetched">
533
+ <element name="fetched">
534
+ <data type="dateTime"/>
535
+ </element>
536
+ </define>
526
537
  <define name="validity">
527
538
  <element name="validity">
528
539
  <optional>
@@ -599,6 +610,7 @@
599
610
  <value>issued</value>
600
611
  <value>transmitted</value>
601
612
  <value>copied</value>
613
+ <value>unchanged</value>
602
614
  </choice>
603
615
  </attribute>
604
616
  <choice>
@@ -69,6 +69,9 @@
69
69
  <ref name="BibItemType"/>
70
70
  </attribute>
71
71
  </optional>
72
+ <optional>
73
+ <ref name="fetched"/>
74
+ </optional>
72
75
  <choice>
73
76
  <oneOrMore>
74
77
  <ref name="btitle"/>
@@ -788,13 +791,15 @@
788
791
  </define>
789
792
  <define name="editorialgroup">
790
793
  <element name="editorialgroup">
791
- <ref name="technical-committee"/>
792
- <optional>
794
+ <oneOrMore>
795
+ <ref name="technical-committee"/>
796
+ </oneOrMore>
797
+ <zeroOrMore>
793
798
  <ref name="subcommittee"/>
794
- </optional>
795
- <optional>
799
+ </zeroOrMore>
800
+ <zeroOrMore>
796
801
  <ref name="workgroup"/>
797
- </optional>
802
+ </zeroOrMore>
798
803
  <optional>
799
804
  <ref name="secretariat"/>
800
805
  </optional>
@@ -146,9 +146,11 @@ module Asciidoctor
146
146
 
147
147
  def locality_erefs_validate(root)
148
148
  root.xpath("//eref[locality]").each do |t|
149
- unless /^IEV$|:[ ]?(\d+{4}|--)$/.match t["citeas"]
150
- warn "ISO: undated reference #{t['citeas']} should not contain "\
151
- "specific elements"
149
+ if /^(ISO|IEC)/.match t["citeas"]
150
+ unless /^:[ ]?(\d+{4}|--)$/.match t["citeas"]
151
+ warn "ISO: undated reference #{t['citeas']} should not contain "\
152
+ "specific elements"
153
+ end
152
154
  end
153
155
  end
154
156
  end
@@ -178,7 +178,7 @@ module Asciidoctor
178
178
  "//references[title = 'Normative References']/bibitem".freeze
179
179
 
180
180
  def asset_title_style(root)
181
- root.xpath("//figure[image][not(title)]").each do |node|
181
+ root.xpath("//figure[image][not(name)]").each do |node|
182
182
  style_warning(node, "Figure should have title", nil)
183
183
  end
184
184
  root.xpath("//table[not(name)]").each do |node|
@@ -658,7 +658,7 @@ div.example {
658
658
  margin-left:70.9pt;
659
659
  text-indent:-70.9pt;
660
660
  }
661
- p.example, li.example, div.example, td.example, td.example p
661
+ p.example, li.example, div.example, td.example
662
662
  { margin:0in;
663
663
  margin-bottom:.0001pt;
664
664
  mso-pagination:none;
@@ -408,14 +408,14 @@ p.Terms {
408
408
  ul li {
409
409
  list-style: none;
410
410
  }
411
-
412
- ul > li > p:before {
413
- content: "—";
414
- display: inline-block;
415
- width: 1em;
416
- margin-left: -1.5em;
417
- margin-right: 0.5em;
418
- }
411
+
412
+ ul > li > p:first-child:before {
413
+ content: "—";
414
+ display: inline-block;
415
+ width: 1em;
416
+ margin-left: -1.5em;
417
+ margin-right: 0.5em;
418
+ }
419
419
 
420
420
  li p {
421
421
  /* display: inline-block; */
@@ -251,13 +251,13 @@ h2 p {
251
251
  list-style: none;
252
252
  }
253
253
 
254
- ul > li > p:before {
255
- content: "—";
256
- display: inline-block;
257
- width: 1em;
258
- margin-left: -1.5em;
259
- margin-right: 0.5em;
260
- }
254
+ ul > li > p:first-child:before {
255
+ content: "—";
256
+ display: inline-block;
257
+ width: 1em;
258
+ margin-left: -1.5em;
259
+ margin-right: 0.5em;
260
+ }
261
261
 
262
262
  li p {
263
263
  /* display: inline-block; */
@@ -108,6 +108,72 @@ p.MsoBlockText, li.MsoBlockText, div.MsoBlockText
108
108
  mso-themecolor:accent1;
109
109
  mso-ansi-language:EN-AU;
110
110
  font-style:italic;}
111
+ p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
112
+ {mso-style-priority:34;
113
+ mso-style-unhide:no;
114
+ mso-style-qformat:yes;
115
+ margin-top:0cm;
116
+ margin-right:0cm;
117
+ margin-bottom:0cm;
118
+ /* do not put in margin-left, it is specific to list level */
119
+ margin-bottom:.0001pt;
120
+ mso-add-space:auto;
121
+ mso-pagination:widow-orphan;
122
+ font-size:11.0pt;
123
+ font-family:$bodyfont;
124
+ mso-ansi-language:EN-AU;
125
+ mso-fareast-language:EN-US;}
126
+ p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
127
+ {mso-style-priority:34;
128
+ mso-style-unhide:no;
129
+ mso-style-qformat:yes;
130
+ mso-style-type:export-only;
131
+ margin-top:0cm;
132
+ margin-right:0cm;
133
+ margin-bottom:0cm;
134
+ /* do not put in margin-left, it is specific to list level */
135
+ margin-bottom:.0001pt;
136
+ mso-add-space:auto;
137
+ mso-pagination:widow-orphan;
138
+ font-size:11.0pt;
139
+ font-family:$bodyfont;
140
+ mso-ansi-language:EN-AU;
141
+ mso-fareast-language:EN-US;}
142
+ p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
143
+ {mso-style-priority:34;
144
+ mso-style-unhide:no;
145
+ mso-style-qformat:yes;
146
+ mso-style-type:export-only;
147
+ margin-top:0cm;
148
+ margin-right:0cm;
149
+ margin-bottom:0cm;
150
+ /* do not put in margin-left, it is specific to list level */
151
+ margin-bottom:.0001pt;
152
+ mso-add-space:auto;
153
+ mso-pagination:widow-orphan;
154
+ font-size:11.0pt;
155
+ font-family:$bodyfont;
156
+ mso-ansi-language:EN-AU;
157
+ mso-fareast-language:EN-US;}
158
+ p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
159
+ {mso-style-priority:34;
160
+ mso-style-unhide:no;
161
+ mso-style-qformat:yes;
162
+ mso-style-type:export-only;
163
+ margin-top:0cm;
164
+ margin-right:0cm;
165
+ margin-bottom:0cm;
166
+ /* do not put in margin-left, it is specific to list level */
167
+ margin-bottom:12.0pt;
168
+ mso-add-space:auto;
169
+ mso-pagination:widow-orphan;
170
+ font-size:11.0pt;
171
+ font-family:$bodyfont;
172
+ mso-ansi-language:EN-AU;
173
+ mso-fareast-language:EN-US;}
174
+ div.figure
175
+ {text-align: center;}
176
+
111
177
  h1
112
178
  {mso-style-priority:1;
113
179
  mso-style-unhide:no;
@@ -181,6 +247,7 @@ h1.Annex
181
247
  mso-hyphenate:none;
182
248
  tab-stops:27.0pt 35.0pt;
183
249
  font-size:12.0pt;
250
+ font-weight:bold;
184
251
  mso-bidi-font-size:11.0pt;
185
252
  font-family:$headerfont;
186
253
  mso-fareast-font-family:$headerfont;
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.0.6".freeze
3
+ VERSION = "1.0.7".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ require "fileutils"
2
3
 
3
4
  RSpec.describe Asciidoctor::ISO do
4
5
  it "has a version number" do
@@ -6,7 +7,8 @@ RSpec.describe Asciidoctor::ISO do
6
7
  end
7
8
 
8
9
  it "generates output for the Rice document" do
9
- system "cd spec/examples; rm -f rice.xml; rm -f rice.doc; rm -f rice.html; rm -f rice_alt.html; asciidoctor --trace -b iso -r 'metanorma-iso' rice.adoc; cd ../.."
10
+ FileUtils.rm_f %w(spec/examples/rice.xml spec/examples/rice.doc spec/examples/rice.html spec/examples/rice_alt.html)
11
+ system "cd spec/examples; asciidoctor --trace -b iso -r 'metanorma-iso' rice.adoc; cd ../.."
10
12
  expect(File.exist?("spec/examples/rice.xml")).to be true
11
13
  expect(File.exist?("spec/examples/rice.doc")).to be true
12
14
  expect(File.exist?("spec/examples/rice.html")).to be true
@@ -24,7 +26,7 @@ RSpec.describe Asciidoctor::ISO do
24
26
  end
25
27
 
26
28
  it "converts a blank document" do
27
- system "rm -f test.doc"
29
+ FileUtils.rm_f "test.doc"
28
30
  expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~"OUTPUT"
29
31
  = Document title
30
32
  Author
@@ -60,6 +62,15 @@ RSpec.describe Asciidoctor::ISO do
60
62
  :workgroup: WG
61
63
  :workgroup-number: 3
62
64
  :workgroup-type: C
65
+ :technical-committee_2: TC1
66
+ :technical-committee-number_2: 11
67
+ :technical-committee-type_2: A1
68
+ :subcommittee_2: SC1
69
+ :subcommittee-number_2: 21
70
+ :subcommittee-type_2: B1
71
+ :workgroup_2: WG1
72
+ :workgroup-number_2: 31
73
+ :workgroup-type_2: C1
63
74
  :secretariat: SECRETARIAT
64
75
  :copyright-year: 2001
65
76
  :docstage: 10
@@ -122,8 +133,11 @@ RSpec.describe Asciidoctor::ISO do
122
133
  </copyright>
123
134
  <editorialgroup>
124
135
  <technical-committee number="1" type="A">TC</technical-committee>
136
+ <technical-committee number="11" type="A1">TC1</technical-committee>
125
137
  <subcommittee number="2" type="B">SC</subcommittee>
138
+ <subcommittee number="21" type="B1">SC1</subcommittee>
126
139
  <workgroup number="3" type="C">WG</workgroup>
140
+ <workgroup number="31" type="C1">WG1</workgroup>
127
141
  <secretariat>SECRETARIAT</secretariat>
128
142
  </editorialgroup>
129
143
  <ics>
@@ -257,7 +271,7 @@ RSpec.describe Asciidoctor::ISO do
257
271
  end
258
272
 
259
273
  it "reads scripts into blank HTML document" do
260
- system "rm -f test.html"
274
+ FileUtils.rm_f "test.html"
261
275
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
262
276
  = Document title
263
277
  Author
@@ -269,7 +283,7 @@ RSpec.describe Asciidoctor::ISO do
269
283
  end
270
284
 
271
285
  it "uses default fonts" do
272
- system "rm -f test.html"
286
+ FileUtils.rm_f "test.html"
273
287
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
274
288
  = Document title
275
289
  Author
@@ -283,7 +297,7 @@ RSpec.describe Asciidoctor::ISO do
283
297
  end
284
298
 
285
299
  it "uses default fonts for alt doc" do
286
- system "rm -f test_alt.html"
300
+ FileUtils.rm_f "test_alt.html"
287
301
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
288
302
  = Document title
289
303
  Author
@@ -297,7 +311,7 @@ RSpec.describe Asciidoctor::ISO do
297
311
  end
298
312
 
299
313
  it "uses Chinese fonts" do
300
- system "rm -f test.html"
314
+ FileUtils.rm_f "test.html"
301
315
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
302
316
  = Document title
303
317
  Author
@@ -312,7 +326,7 @@ RSpec.describe Asciidoctor::ISO do
312
326
  end
313
327
 
314
328
  it "uses specified fonts" do
315
- system "rm -f test.html"
329
+ FileUtils.rm_f "test.html"
316
330
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
317
331
  = Document title
318
332
  Author
@@ -330,8 +344,8 @@ RSpec.describe Asciidoctor::ISO do
330
344
  end
331
345
 
332
346
  it "strips MS-specific CSS" do
333
- system "rm -f test.html"
334
- system "rm -f test.doc"
347
+ FileUtils.rm_f "test.html"
348
+ FileUtils.rm_f "test.doc"
335
349
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
336
350
  = Document title
337
351
  Author
@@ -1,5 +1,6 @@
1
1
  require "spec_helper"
2
2
  require "isobib"
3
+ require "fileutils"
3
4
 
4
5
  RSpec.describe Asciidoctor::ISO do
5
6
 
@@ -44,10 +45,10 @@ EOS
44
45
  EOS
45
46
 
46
47
  it "does not activate biblio caches if isobib disabled" do
47
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
48
- system "mv ~/.iev.pstore ~/.iev.pstore1"
49
- system "rm -f test.relaton.pstore"
50
- system "rm -f test.iev.pstore"
48
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
49
+ FileUtils.mv File.expand_path("~/.iev.pstore"), File.expand_path("~/.iev.pstore1"), force: true
50
+ FileUtils.rm_f "test.relaton.pstore"
51
+ FileUtils.rm_f "test.iev.pstore"
51
52
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
52
53
  #{ASCIIDOC_BLANK_HDR}
53
54
  [bibliography]
@@ -60,17 +61,17 @@ EOS
60
61
  expect(File.exist?("test.relaton.pstore")).to be false
61
62
  expect(File.exist?("test.iev.pstore")).to be false
62
63
 
63
- system "rm ~/.relaton-bib.pstore"
64
- system "rm ~/.iev.pstore"
65
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
66
- system "mv ~/.iev.pstore1 ~/.iev.pstore"
64
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
65
+ FileUtils.rm_f File.expand_path("~/.iev.pstore")
66
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
67
+ FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev.pstore"), force: true
67
68
  end
68
69
 
69
70
  it "does not activate biblio caches if isobib caching disabled" do
70
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
71
- system "mv ~/.iev.pstore ~/.iev.pstore1"
72
- system "rm -f test.relaton.pstore"
73
- system "rm -f test.iev.pstore"
71
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
72
+ FileUtils.mv File.expand_path("~/.iev.pstore"), File.expand_path("~/.iev.pstore1"), force: true
73
+ FileUtils.rm_f "test.relaton.pstore"
74
+ FileUtils.rm_f "test.iev.pstore"
74
75
  mock_isobib_get_123
75
76
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
76
77
  #{ISOBIB_BLANK_HDR}
@@ -84,18 +85,18 @@ EOS
84
85
  expect(File.exist?("test.relaton.pstore")).to be false
85
86
  expect(File.exist?("test.iev.pstore")).to be false
86
87
 
87
- system "rm ~/.relaton-bib.pstore"
88
- system "rm ~/.iev.pstore"
89
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
90
- system "mv ~/.iev.pstore1 ~/.iev.pstore"
88
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
89
+ FileUtils.rm_f File.expand_path("~/.iev.pstore")
90
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
91
+ FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev.pstore"), force: true
91
92
  end
92
93
 
93
94
  it "flushes biblio caches" do
94
- system "cp ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
95
- system "cp ~/.iev.pstore ~/.iev.pstore1"
95
+ FileUtils.cp File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1")
96
+ FileUtils.cp File.expand_path("~/.iev.pstore"), File.expand_path("~/.iev.pstore1")
96
97
 
97
98
  File.open("#{Dir.home}/.relaton-bib.pstore", "w") { |f| f.write "XXX" }
98
- system "rm ~/.iev.pstore"
99
+ FileUtils.rm_f File.expand_path("~/.iev.pstore")
99
100
 
100
101
  mock_isobib_get_123
101
102
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
@@ -113,15 +114,15 @@ EOS
113
114
  expect(entry["fetched"].to_s).to eq(Date.today.to_s)
114
115
  expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_123_DATED)
115
116
 
116
- system "rm ~/.relaton-bib.pstore"
117
- system "rm ~/.iev.pstore"
118
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
119
- system "mv ~/.iev.pstore1 ~/.iev.pstore"
117
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
118
+ FileUtils.rm_f File.expand_path("~/.iev.pstore")
119
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
120
+ FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev.pstore"), force: true
120
121
  end
121
122
 
122
123
  it "activates global cache" do
123
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
124
- system "rm -f test.relaton.pstore"
124
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
125
+ FileUtils.rm_f "test.relaton.pstore"
125
126
  mock_isobib_get_123
126
127
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
127
128
  #{CACHED_ISOBIB_BLANK_HDR}
@@ -137,13 +138,13 @@ EOS
137
138
  entry = db.load_entry("ISO(ISO 123:2001)")
138
139
  expect(entry).to_not be nil
139
140
 
140
- system "rm ~/.relaton-bib.pstore"
141
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
141
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
142
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
142
143
  end
143
144
 
144
145
  it "activates local cache" do
145
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
146
- system "rm -f test.relaton.pstore"
146
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
147
+ FileUtils.rm_f "test.relaton.pstore"
147
148
  mock_isobib_get_123
148
149
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
149
150
  #{LOCAL_CACHED_ISOBIB_BLANK_HDR}
@@ -163,13 +164,12 @@ EOS
163
164
  entry = db.load_entry("ISO(ISO 123:2001)")
164
165
  expect(entry).to_not be nil
165
166
 
166
- system "rm ~/.relaton-bib.pstore"
167
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
167
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
168
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
168
169
  end
169
170
 
170
-
171
171
  it "fetches uncached references" do
172
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
172
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
173
173
  db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
174
174
  db.save_entry("ISO(ISO 123:2001)",
175
175
  {
@@ -196,12 +196,12 @@ EOS
196
196
  expect(entry["fetched"].to_s).to eq(Date.today.to_s)
197
197
  expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_124_DATED)
198
198
 
199
- system "rm ~/.relaton-bib.pstore"
200
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
199
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
200
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
201
201
  end
202
202
 
203
203
  it "expires stale undated references" do
204
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
204
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
205
205
 
206
206
  db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
207
207
  db.save_entry("ISO 123",
@@ -225,12 +225,12 @@ EOS
225
225
  expect(entry["fetched"].to_s).to eq(Date.today.to_s)
226
226
  expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_123_UNDATED)
227
227
 
228
- system "rm ~/.relaton-bib.pstore"
229
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
228
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
229
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
230
230
  end
231
231
 
232
232
  it "does not expire stale dated references" do
233
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
233
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
234
234
 
235
235
  db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
236
236
  db.save_entry("ISO(ISO 123:2001)",
@@ -252,13 +252,13 @@ EOS
252
252
  expect(entry["fetched"].to_s).to eq((Date.today - 90).to_s)
253
253
  expect(entry["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
254
254
 
255
- system "rm ~/.relaton-bib.pstore"
256
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
255
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
256
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
257
257
  end
258
258
 
259
259
  it "prioritises local over global cache values" do
260
- system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
261
- system "rm test.relaton.pstore"
260
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore"), File.expand_path("~/.relaton-bib.pstore1"), force: true
261
+ FileUtils.rm_f "test.relaton.pstore"
262
262
 
263
263
  db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
264
264
  db.save_entry("ISO(ISO 123:2001)",
@@ -311,8 +311,8 @@ EOS
311
311
  expect(localdb.load_entry("ISO(ISO 123:2001)")["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
312
312
  expect(localdb.load_entry("ISO(ISO 124)")["bib"].to_xml).to be_equivalent_to(ISO_124_SHORT_ALT)
313
313
 
314
- system "rm ~/.relaton-bib.pstore"
315
- system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
314
+ FileUtils.rm_f File.expand_path("~/.relaton-bib.pstore")
315
+ FileUtils.mv File.expand_path("~/.relaton-bib.pstore1"), File.expand_path("~/.relaton-bib.pstore"), force: true
316
316
  end
317
317
 
318
318
  private