tapsoob 0.5.27 → 0.5.28
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 +4 -4
- data/lib/tapsoob/operation.rb +9 -5
- data/lib/tapsoob/version.rb +1 -1
- data/lib/tasks/tapsoob.rake +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 488bc024b3e68fc52750a34073f6e1fd7544787d3e5d8f9994a31de6e7fa8dc7
|
4
|
+
data.tar.gz: 95f66bd12f95fa6ace15b95a0a8373a3b2665197fe383f1f3588f37f3ba41a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90df45cbd8c7da3efda26ce50ce0216c14d45d61b86ea6d20531d4c17f61bf954cd0e07b1211fbbf00134e422e67220e21a4f7195926d9d2a9746e65beb104b6
|
7
|
+
data.tar.gz: 5d5754a77f0e7c85e4e8d347764a94ae1c365cc432d3a98a727dc53c5d0023ea861b4ae7fa1bfe2c7579a27f9de77780c245f01ddd84a92aef6bfdcd21145509
|
data/lib/tapsoob/operation.rb
CHANGED
@@ -202,7 +202,7 @@ module Tapsoob
|
|
202
202
|
:chunksize => default_chunksize,
|
203
203
|
:table_name => table_name
|
204
204
|
}, { :debug => opts[:debug] })
|
205
|
-
estimated_chunks = (count.to_f / default_chunksize).ceil
|
205
|
+
estimated_chunks = [(count.to_f / default_chunksize).ceil, 1].max
|
206
206
|
progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, estimated_chunks) : nil)
|
207
207
|
pull_data_from_table(stream, progress)
|
208
208
|
end
|
@@ -217,7 +217,7 @@ module Tapsoob
|
|
217
217
|
|
218
218
|
stream = Tapsoob::DataStream.factory(db, stream_state)
|
219
219
|
chunksize = stream_state[:chunksize] || default_chunksize
|
220
|
-
estimated_chunks = (record_count.to_f / chunksize).ceil
|
220
|
+
estimated_chunks = [(record_count.to_f / chunksize).ceil, 1].max
|
221
221
|
progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, estimated_chunks) : nil)
|
222
222
|
pull_data_from_table(stream, progress)
|
223
223
|
end
|
@@ -423,8 +423,10 @@ module Tapsoob
|
|
423
423
|
table_name = stream_state[:table_name]
|
424
424
|
record_count = tables[table_name.to_s]
|
425
425
|
log.info "Resuming #{table_name}, #{format_number(record_count)} records"
|
426
|
-
progress = ProgressBar.new(table_name.to_s, record_count)
|
427
426
|
stream = Tapsoob::DataStream.factory(db, stream_state)
|
427
|
+
chunksize = stream_state[:chunksize] || default_chunksize
|
428
|
+
estimated_chunks = [(record_count.to_f / chunksize).ceil, 1].max
|
429
|
+
progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, estimated_chunks) : nil)
|
428
430
|
push_data_from_file(stream, progress)
|
429
431
|
end
|
430
432
|
|
@@ -445,7 +447,8 @@ module Tapsoob
|
|
445
447
|
:purge => opts[:purge] || false,
|
446
448
|
:debug => opts[:debug]
|
447
449
|
})
|
448
|
-
|
450
|
+
estimated_chunks = [(count.to_f / default_chunksize).ceil, 1].max
|
451
|
+
progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, estimated_chunks) : nil)
|
449
452
|
push_data_from_file(stream, progress)
|
450
453
|
end
|
451
454
|
end
|
@@ -496,7 +499,8 @@ module Tapsoob
|
|
496
499
|
end
|
497
500
|
stream.state[:chunksize] = chunksize
|
498
501
|
|
499
|
-
progress
|
502
|
+
# Update progress bar by 1 chunk
|
503
|
+
progress.inc(1) if progress
|
500
504
|
|
501
505
|
break if stream.complete?
|
502
506
|
end
|
data/lib/tapsoob/version.rb
CHANGED
data/lib/tasks/tapsoob.rake
CHANGED
@@ -2,7 +2,7 @@ namespace :tapsoob do
|
|
2
2
|
desc "Pulls a database to your filesystem"
|
3
3
|
task :pull => :environment do
|
4
4
|
# Default options
|
5
|
-
opts={:default_chunksize => 1000, :debug => false, :resume_filename => nil, :disable_compression => false, :schema => true, :data => true, :indexes_first => false}
|
5
|
+
opts={:default_chunksize => 1000, :debug => false, :resume_filename => nil, :disable_compression => false, :schema => true, :data => true, :indexes_first => false, :progress => true}
|
6
6
|
|
7
7
|
# Get the dump_path
|
8
8
|
dump_path = File.expand_path(Rails.root.join("db", Time.now.strftime("%Y%m%d%I%M%S%p"))).to_s
|
@@ -23,7 +23,7 @@ namespace :tapsoob do
|
|
23
23
|
desc "Push a compatible dump on your filesystem to a database"
|
24
24
|
task :push, [:timestamp] => :environment do |t, args|
|
25
25
|
# Default options
|
26
|
-
opts={:default_chunksize => 1000, :debug => false, :resume_filename => nil, :disable_compression => false, :schema => true, :data => true, :indexes_first => false}
|
26
|
+
opts={:default_chunksize => 1000, :debug => false, :resume_filename => nil, :disable_compression => false, :schema => true, :data => true, :indexes_first => false, :progress => true}
|
27
27
|
|
28
28
|
# Get the dumps
|
29
29
|
dumps = Dir[Rails.root.join("db", "*/")].select { |e| e =~ /([0-9]{14})([A-Z]{2})/ }.sort
|