tapsoob 0.4.18 → 0.4.22

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: 29f1479cf9a3b2bf6a0580c9549fb77cd89ba5383c8369980b9aea01616ea9b9
4
- data.tar.gz: 84bf428c8275804269afced6d2a0d18e7ca6a894223e8d20e332bbf16fd515ea
3
+ metadata.gz: 3ae0fadaae87496510d5ba645478eab092666a51db14e0225dd666cf33b3b2da
4
+ data.tar.gz: 900c0a0aa8711bffba6a7e2c404f8f18ca737df178b3e136d512b0a76433d015
5
5
  SHA512:
6
- metadata.gz: 0e1d271e76fa4298a2a32160d8cb9b4171c2fb78f565cb2deb9d2c0650a9c6b76500b17325257fae54cd4299adf803df6ea93dfda0cf8e9d795c25551c7ea995
7
- data.tar.gz: 85e68d96a84fc9b88ed8f0821780bcc303cc33e03c9468ad6ffb7ee0e6556f95f2e631fc5c430833b3f1ae3b55eebf1a8fc5ab20fc96efdaebe18db15a5c3410
6
+ metadata.gz: 70355d42c987f1b739764cc1e318d0ae98aa62fa016187012d2d5716f5b33516e0646196157d7ad5fbd1ab58d8e597c5de8a3a2e096b468131060f3919630731
7
+ data.tar.gz: fd2dd601102884014c0e41fd613f03881a2bc117abdc672309afcb7b5a396c7740d349489c84646b859da2917eb4646cc7632a2364f7182cd34635f193e8b183
@@ -393,7 +393,7 @@ module Tapsoob
393
393
  log.info "#{tables.size} tables, #{format_number(record_count)} records"
394
394
 
395
395
  tables.each do |table_name, count|
396
- next unless File.exists?(File.join(dump_path, "data", "#{table_name}.json"))
396
+ next unless File.exists?(File.join(dump_path, "data", "#{table_name}.json")) || JSON.parse(File.read(File.join(dump_path, "data", "#{table_name}.json")))["data"].size == 0
397
397
  db[table_name.to_sym].truncate if @opts[:purge]
398
398
  stream = Tapsoob::DataStream.factory(db, {
399
399
  :table_name => table_name,
@@ -485,7 +485,7 @@ module Tapsoob
485
485
 
486
486
  def fetch_local_tables_info
487
487
  tables_with_counts = {}
488
- tbls = Dir.glob(File.join(dump_path, "data", "*")).map { |path| File.basename(path, ".json") }
488
+ tbls = Dir.glob(File.join(dump_path, "schemas", "*")).map { |path| File.basename(path, ".rb") }
489
489
  tbls.each do |table|
490
490
  if File.exists?(File.join(dump_path, "data", "#{table}.json"))
491
491
  data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
data/lib/tapsoob/utils.rb CHANGED
@@ -75,8 +75,9 @@ Data : #{data}
75
75
  res = { table_name: table, header: header, data: only_data }
76
76
 
77
77
  # Add types if schema isn't empty
78
+ db.extension :schema_dumper # Add schema dumper extension in case it hasn't been added until now
78
79
  res[:types] = schema.map do |c|
79
- case db.column_schema_to_ruby_type(c.last[:type])[:type]
80
+ case db.column_schema_to_ruby_type(c.last)[:type]
80
81
  when BigDecimal
81
82
  "float"
82
83
  when :Bignum
@@ -86,7 +87,7 @@ Data : #{data}
86
87
  when TrueClass
87
88
  "boolean"
88
89
  else
89
- db.column_schema_to_ruby_type(c.last[:type])[:type].to_s.downcase
90
+ db.column_schema_to_ruby_type(c.last)[:type].to_s.downcase
90
91
  end
91
92
  end unless schema.empty?
92
93
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.4.18".freeze
3
+ VERSION = "0.4.22".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.18
4
+ version: 0.4.22
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-10-19 00:00:00.000000000 Z
12
+ date: 2021-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ripl