tapsoob 0.4.17 → 0.4.21

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: fb5c1ed1e219ec2410ed346a7c9cbee4e75990c706d1d8afba596d0494db4571
4
- data.tar.gz: dff7182a190b95f92b18c348aeb0b58212e3d1b3e282c8edd38249a3fcd04af2
3
+ metadata.gz: 6894559fc6e93ef21963e790ec461551355785551906af8b3919c562efe58917
4
+ data.tar.gz: 01d3b9ae459ae41d598e7146cb7334d3e154fd28e71a617f52ee134bea00ebef
5
5
  SHA512:
6
- metadata.gz: e2c71ef98ebc8b9354aed85dc11b6530ac6d83192125a94dbf71736947286fcd7584d4b81849e02fea8a7c638dab41c51bc97671eba0ad70c5fe372e40a2aa0d
7
- data.tar.gz: c441227f8249ff7bfe47c09b436e4fd628f186847563fbf44d75134ed0b73619248edccd0451c891ec4aa40b4f23dc3adaa615eb097e6118515d34c6c219a395
6
+ metadata.gz: fc5b9ce215d00c4966aa85e2c9c0d9270197a2bacc1f444b758bc3f7f9b03bfc26ccb250ccf69e0fefbf7db2c31b7b3778790c527607bee6515837f6169825d6
7
+ data.tar.gz: 780dc83b47bf036f25182bb0e37b1f9f89db9f65a2a9889942eb2ba28fab872118f359e40c5a3abe014d8ec7aedcaa52aafc956e2a2eec8e268783061a6dc7be
@@ -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}.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,14 +75,19 @@ 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"
83
+ when :Bignum
84
+ "integer"
82
85
  when File
83
86
  "blob"
87
+ when TrueClass
88
+ "boolean"
84
89
  else
85
- 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
86
91
  end
87
92
  end unless schema.empty?
88
93
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.4.17".freeze
3
+ VERSION = "0.4.21".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.17
4
+ version: 0.4.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger