tapsoob 0.5.21-java → 0.5.23-java

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: 76f70dd3a031e79ff2e9ef17cfa393ff43ab72d5997764dff75868639fea538f
4
- data.tar.gz: f6c9bfdd071441d86ecbef66932365860a7b30ca4e9485a187078430a9983fc7
3
+ metadata.gz: b47271ea2dda6178d7a1608c9ebdc7f2e655565f6e2c565448bc40a92d8c8a68
4
+ data.tar.gz: de8d73310081b68516889ddfb4f4a294c29ba8f8d23f6ef789c957c4c2096a70
5
5
  SHA512:
6
- metadata.gz: 16364c004373d3afb5092e14c5d831817ec40193563c4e4b6b20815a3168426a57cf7a8c2785dfc2eee3af1f0a02b67d4bccafc66fe56d920204eba730defbd6
7
- data.tar.gz: feb890c468b17e7b8feccb5870a37a3c06edb307334134c0dee7ef9c4db6f5ce383d901da27d399e026c95d2b5d3109f4e68cc2735780b0b9fe595ad91b32b03
6
+ metadata.gz: 976dbf7d3d95b4a345df15fadeb2fa805700791335585f601cd4c620b46aaeaa43e273c96cbeb1e8f80678033960d406082e97fc5b7747239ab531cf7776fb34
7
+ data.tar.gz: 58e5601d727ff3c1d23afee2b27cc3f3ccd77c59d412fa3f061f2f8335c8ca3f366e45ac6a52265a5747bb5de2149c705871ae96c78ead0b59cafa39407d7998
@@ -36,7 +36,7 @@ module Tapsoob
36
36
  opts = parse_opts(options)
37
37
 
38
38
  # read data from dump_path or from STDIN
39
- if dump_path && Dir.exists?(dump_path)
39
+ if dump_path && Dir.exist?(dump_path)
40
40
  files = Dir[Pathname.new(dump_path).join("*.json")]
41
41
  files.each { |file| data << JSON.parse(File.read(file), symbolize_names: true) }
42
42
  else
@@ -1,5 +1,6 @@
1
1
  require 'thor'
2
2
  require 'fileutils'
3
+ require 'yaml'
3
4
 
4
5
  require_relative '../config'
5
6
  require_relative '../log'
@@ -10,6 +11,7 @@ module Tapsoob
10
11
  module CLI
11
12
  class Root < Thor
12
13
  desc "pull DUMP_PATH DATABASE_URL", "Pull a dump from a database to a folder"
14
+ option :config, desc: "Define all options in a config file", type: :string, aliases: '-C'
13
15
  option :data, desc: "Pull the data to the database", default: true, type: :boolean, aliases: '-d'
14
16
  option :schema, desc: "Pull the schema to the database", default: true, type: :boolean, aliases: "-s"
15
17
  option :"indexes-first", desc: "Transfer indexes first before data", default: false, type: :boolean, aliases: "-i"
@@ -33,6 +35,7 @@ module Tapsoob
33
35
  end
34
36
 
35
37
  desc "push DUMP_PATH DATABASE_URL", "Push a previously tapsoob dump to a database"
38
+ option :config, desc: "Define all options in a config file", type: :string, aliases: '-C'
36
39
  option :data, desc: "Push the data to the database", default: true, type: :boolean, aliases: '-d'
37
40
  option :schema, desc: "Push the schema to the database", default: true, type: :boolean, aliases: "-s"
38
41
  option :"indexes-first", desc: "Transfer indexes first before data", default: false, type: :boolean, aliases: "-i"
@@ -56,6 +59,11 @@ module Tapsoob
56
59
  end
57
60
  end
58
61
 
62
+ def ripl
63
+ require 'ripl'
64
+ Ripl.start
65
+ end
66
+
59
67
  desc "version", "Show tapsoob version"
60
68
  def version
61
69
  puts Tapsoob::VERSION.dup
@@ -69,8 +77,11 @@ module Tapsoob
69
77
 
70
78
  private
71
79
  def parse_opts(options)
80
+ # Load config file if it exist
81
+ opts = ((options[:config] && File.exist?(options[:config])) ? YAML.load_file(options[:config]) : {})
82
+
72
83
  # Default options
73
- opts = {
84
+ opts = opts.merge({
74
85
  data: options[:data],
75
86
  schema: options[:schema],
76
87
  indexes_first: options[:"indexes_first"],
@@ -78,7 +89,7 @@ module Tapsoob
78
89
  tables: options[:tables],
79
90
  progress: options[:progress],
80
91
  debug: options[:debug]
81
- }
92
+ })
82
93
 
83
94
  # Pull only options
84
95
  opts[:indexes] = options[:"indexes"] if options.key?(:"indexes")
@@ -91,7 +102,7 @@ module Tapsoob
91
102
 
92
103
  # Resume
93
104
  if options[:resume]
94
- if File.exists?(options[:resume])
105
+ if File.exist?(options[:resume])
95
106
  opts[:resume_file] = options[:resume]
96
107
  else
97
108
  raise "Unable to find resume file."
@@ -54,7 +54,7 @@ module Tapsoob
54
54
  desc "load DATABASE_URL [FILENAME]", "Load a database schema from a file or STDIN to a database using a database URL"
55
55
  option :drop, type: :boolean, default: false
56
56
  def load(database_url, filename = nil)
57
- schema = if filename && File.exists?(filename)
57
+ schema = if filename && File.exist?(filename)
58
58
  File.read(filename)
59
59
  else
60
60
  STDIN.read
@@ -69,7 +69,7 @@ module Tapsoob
69
69
 
70
70
  desc "load_foreign_keys DATABASE_URL [FILENAME]", "Load foreign keys from a file or STDIN to a database using a database URL"
71
71
  def load_foreign_keys(database_url, filename = nil)
72
- indexes = if filename && File.exists?(filename)
72
+ indexes = if filename && File.exist?(filename)
73
73
  File.read(filename)
74
74
  else
75
75
  STDIN.read
@@ -84,7 +84,7 @@ module Tapsoob
84
84
 
85
85
  desc "load_indexes DATABASE_URL [FILENAME]", "Load indexes from a file or STDIN to a database using a database URL"
86
86
  def load_indexes(database_url, filename = nil)
87
- indexes = if filename && File.exists?(filename)
87
+ indexes = if filename && File.exist?(filename)
88
88
  File.read(filename)
89
89
  else
90
90
  STDIN.read
@@ -428,7 +428,7 @@ module Tapsoob
428
428
  log.info "#{tables.size} tables, #{format_number(record_count)} records"
429
429
 
430
430
  tables.each do |table_name, count|
431
- next unless File.exists?(File.join(dump_path, "data", "#{table_name}.json")) || 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
431
+ next unless File.exist?(File.join(dump_path, "data", "#{table_name}.json")) || File.exist?(File.join(dump_path, "data", "#{table_name}.json")) && JSON.parse(File.read(File.join(dump_path, "data", "#{table_name}.json")))["data"].size == 0
432
432
  db[table_name.to_sym].truncate if @opts[:purge]
433
433
  stream = Tapsoob::DataStream.factory(db, {
434
434
  :table_name => table_name,
@@ -521,7 +521,7 @@ module Tapsoob
521
521
  tables_with_counts = {}
522
522
  tbls = Dir.glob(File.join(dump_path, "schemas", "*")).map { |path| File.basename(path, ".rb") }
523
523
  tbls.each do |table|
524
- if File.exists?(File.join(dump_path, "data", "#{table}.json"))
524
+ if File.exist?(File.join(dump_path, "data", "#{table}.json"))
525
525
  data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
526
526
  tables_with_counts[table] = data["data"].size
527
527
  else
data/lib/tapsoob/utils.rb CHANGED
@@ -144,7 +144,7 @@ Data : #{data}
144
144
 
145
145
  def export_indexes(dump_path, table, index_data)
146
146
  data = [index_data]
147
- if File.exists?(File.join(dump_path, "indexes", "#{table}.json"))
147
+ if File.exist?(File.join(dump_path, "indexes", "#{table}.json"))
148
148
  previous_data = JSON.parse(File.read(File.join(dump_path, "indexes", "#{table}.json")))
149
149
  data = data + previous_data
150
150
  end
@@ -156,7 +156,7 @@ Data : #{data}
156
156
 
157
157
  def export_rows(dump_path, table, row_data)
158
158
  data = row_data
159
- if File.exists?(File.join(dump_path, "data", "#{table}.json"))
159
+ if File.exist?(File.join(dump_path, "data", "#{table}.json"))
160
160
  previous_data = JSON.parse(File.read(File.join(dump_path, "data", "#{table}.json")))
161
161
  data[:data] = previous_data["data"] + row_data[:data] unless row_data[:data].nil?
162
162
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.5.21".freeze
3
+ VERSION = "0.5.23".freeze
4
4
  end
@@ -56,7 +56,7 @@ namespace :tapsoob do
56
56
  if dumps.count > keep
57
57
  old_dumps = dumps - dumps.reverse[0..(keep - 1)]
58
58
  old_dumps.each do |dir|
59
- if Dir.exists?(dir)
59
+ if Dir.exist?(dir)
60
60
  puts "Deleting old dump directory ('#{dir}')"
61
61
  FileUtils.remove_entry_secure(dir)
62
62
  end
data/tapsoob.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  # Dependencies
23
23
  s.add_dependency "ripl", "~> 0.7.1"
24
- s.add_dependency "sequel", "~> 5.65.0"
24
+ s.add_dependency "sequel", "~> 5.70.0"
25
25
  s.add_dependency "thor", "~> 1.2.1"
26
26
 
27
27
  if (RUBY_PLATFORM =~ /java/).nil?
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.5.21
4
+ version: 0.5.23
5
5
  platform: java
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: 2023-04-09 00:00:00.000000000 Z
12
+ date: 2024-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.65.0
33
+ version: 5.70.0
34
34
  name: sequel
35
35
  prerelease: false
36
36
  type: :runtime
@@ -38,7 +38,7 @@ dependencies:
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 5.65.0
41
+ version: 5.70.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements: