tapsoob 0.4.2 → 0.4.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 661f0fd554e2cd6781c9a174c4051331024879fb1abecb9f48f19b9e365c1e46
4
- data.tar.gz: 10535d8376543d13e16a35b8d7e098cdb4c4757b518e75068d6a83884196cd98
3
+ metadata.gz: cc84752fc2a91822aa3bc16f26c08caeeb65908cef115a65a926ef8b20234af2
4
+ data.tar.gz: d8a7436afa147cb420c18552e3dcbbed8e1255a74176463ddaa6a51bf23fc8be
5
5
  SHA512:
6
- metadata.gz: 171152e81bcb75da25c9865b8b8211256e7fce176bca88f576b4eb9cf159d67a66badacc51344b3c3a4efa137f16dd57384f606780f0b35984ecfb1d6bfbe96c
7
- data.tar.gz: a9a59c2a045419d2b580b9d3932055f012f9b192daf6feef8e35602546b0b8dcbd77fc87e56ffa728c1818c6de5004b8027cc0051c9e44d313acc1c5673bc862
6
+ metadata.gz: 639660bd7c1d819d8cace1b1270356628c2e4c7784c65ec828ad71e59316e651d94c10068c45d9185ad5a89115e31d237d33300452b8cf30d1a11198d437361b
7
+ data.tar.gz: 0c5f443dc175183a43ae68573f3c32775e9ca339e29a467d9b9303d684b4d3a4b533fd2509065f18266cf17f7e71fb39a69f6d44c13acbc46215f916fc55e769
@@ -152,7 +152,7 @@ module Tapsoob
152
152
 
153
153
  rows = parse_encoded_data(encoded_data, json[:checksum])
154
154
 
155
- @complete = rows == { }
155
+ @complete = rows[:data] == [ ]
156
156
 
157
157
  # update local state
158
158
  state.merge!(json[:state].merge(:chunksize => state[:chunksize]))
@@ -227,8 +227,6 @@ module Tapsoob
227
227
  Tapsoob::Utils.export_rows(dump_path, stream.table_name, rows)
228
228
  end
229
229
  end
230
- break if stream.complete?
231
- progress.inc(size) if progress && !exiting?
232
230
  stream.error = false
233
231
  self.stream_state = stream.to_hash
234
232
  rescue Tapsoob::CorruptedData => e
@@ -236,6 +234,9 @@ module Tapsoob
236
234
  stream.error = true
237
235
  next
238
236
  end
237
+
238
+ progress.inc(size) if progress && !exiting?
239
+ break if stream.complete?
239
240
  end
240
241
 
241
242
  progress.finish if progress
data/lib/tapsoob/utils.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'zlib'
3
+ require 'active_support/core_ext/file/atomic.rb'
3
4
 
4
5
  require 'tapsoob/errors'
5
6
  require 'tapsoob/chunksize'
@@ -143,11 +144,15 @@ Data : #{data}
143
144
  data = row_data
144
145
  if File.exists?(File.join(dump_path, "data", "#{table}.json"))
145
146
  previous_data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
146
- data[:data] = previous_data["data"] + row_data[:data]
147
- end
147
+ data[:data] = (previous_data["data"].nil? ? row_data[:data] : previous_data["data"] + row_data[:data])
148
148
 
149
- File.open(File.join(dump_path, "data", "#{table}.json"), 'w') do |file|
150
- file.write(JSON.generate(data))
149
+ File.atomic_write(File.join(dump_path, "data", "#{table}.json")) do |file|
150
+ file.write(JSON.generate(data))
151
+ end
152
+ else
153
+ File.open(File.join(dump_path, "data", "#{table}.json"), 'w') do |file|
154
+ file.write(JSON.generate(data))
155
+ end
151
156
  end
152
157
  end
153
158
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.4.2".freeze
3
+ VERSION = "0.4.7".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapsoob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-25 00:00:00.000000000 Z
12
+ date: 2021-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ripl