metanorma-utils 1.4.1 → 1.4.2

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
  SHA256:
3
- metadata.gz: 4f32aeb7bee3b6c0d36ef4ec14722115d92b2a721640b353f2fdedf91e130ded
4
- data.tar.gz: 98bcc533cdb3c716d5961696f0aebf610d40dbdc86164fd615d2a4d63e31b955
3
+ metadata.gz: fd1e58ea4dadd1ad26ad1b254805c2c831914a1177b0e75ea166117a3c1a4e99
4
+ data.tar.gz: 1479bd090933fc9e861f3b9aba780fa18fe863ddfa923ddcee7caa148956f754
5
5
  SHA512:
6
- metadata.gz: c31cdc9c3b6e98801e3006cb6a9d549880fa42225ce21e2636a6e70adf09abe39c384cb166d4f275e911f91e68deb743c1433471f9df7d1417745efa25852ecd
7
- data.tar.gz: 8fa5f30a48fa4f073fe40b475709551da487f9891bb40cd55a33cc3c9e2ecd989b897a9cafd24da30f9b734eea5fe81c963d806a074af3e870e180e8a04ebef3
6
+ metadata.gz: c4578a2d2450368c92cec783b297ab5c5ba921e3644dc6078b6df66af58b0a74f56e6e800d2d01322f8af6b95ebf3c2834076528308845aaca612ed851108990
7
+ data.tar.gz: 343f2b25137e40335e56ce82f00297294f6f33a956d7bec3ccb76ad012d31a8594d78a31143919060d05fe6edfa2a3a39f06183548e2b9a671cb3f97a310d6c8
data/lib/utils/log.rb CHANGED
@@ -59,6 +59,7 @@ module Metanorma
59
59
  def write1(file, entry)
60
60
  loc = entry[:location] ? "(#{entry[:location]}): " : ""
61
61
  file.puts "#{loc}#{entry[:message]}"
62
+ .encode("UTF-8", invalid: :replace, undef: :replace)
62
63
  entry[:context]&.split(/\n/)&.first(5)&.each do |l|
63
64
  file.puts "\t#{l}"
64
65
  end
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.4.1".freeze
3
+ VERSION = "1.4.2".freeze
4
4
  end
5
5
  end
data/spec/utils_spec.rb CHANGED
@@ -126,6 +126,23 @@ RSpec.describe Metanorma::Utils do
126
126
  OUTPUT
127
127
  end
128
128
 
129
+ it "deals with illegal characters in log" do
130
+ FileUtils.rm_f("log.txt")
131
+ log = Metanorma::Utils::Log.new
132
+ log.add("Category 1", nil, "é\xc2")
133
+ log.write("log.txt")
134
+ expect(File.exist?("log.txt")).to be true
135
+ file = File.read("log.txt", encoding: "utf-8")
136
+ expect(file).to eq <<~OUTPUT
137
+ log.txt errors
138
+
139
+
140
+ == Category 1
141
+
142
+ (): é�
143
+ OUTPUT
144
+ end
145
+
129
146
  it "parses CSV" do
130
147
  expect(Metanorma::Utils.csv_split("A;'B;C'")).to eq ["A", "'B", "C'"]
131
148
  expect(Metanorma::Utils.csv_split('A;"B;C"')).to eq ["A", "B;C"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.