tapsoob 0.5.21-java → 0.5.24-java

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: 76f70dd3a031e79ff2e9ef17cfa393ff43ab72d5997764dff75868639fea538f
4
- data.tar.gz: f6c9bfdd071441d86ecbef66932365860a7b30ca4e9485a187078430a9983fc7
3
+ metadata.gz: 11fbd480c773fa8dc6e153610ce7ca4b942edcb78e1924f9d3f7f77fd80ccbb1
4
+ data.tar.gz: 176d7cfe422de41213a2b245db01598503855481b73d8c577aa29293f0a31c63
5
5
  SHA512:
6
- metadata.gz: 16364c004373d3afb5092e14c5d831817ec40193563c4e4b6b20815a3168426a57cf7a8c2785dfc2eee3af1f0a02b67d4bccafc66fe56d920204eba730defbd6
7
- data.tar.gz: feb890c468b17e7b8feccb5870a37a3c06edb307334134c0dee7ef9c4db6f5ce383d901da27d399e026c95d2b5d3109f4e68cc2735780b0b9fe595ad91b32b03
6
+ metadata.gz: acdbb9432e0c046d114128bff2f1b5b828e3ef22208edca966c57cac532fbe6fc5007cfc2d50901802eee2c7bc5aed4e89a2920bd4b4bf6d2c4c45ecae43df25
7
+ data.tar.gz: 9be5ba4e60af48dc35bc6bdd392bcc875201ad11a20e85c63273b358389f9079d316cde0ecbb1d6ca7356e455299730d1e5acd67597a4b99cf1fc1062b12a84c
@@ -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"
@@ -69,8 +72,11 @@ module Tapsoob
69
72
 
70
73
  private
71
74
  def parse_opts(options)
75
+ # Load config file if it exist
76
+ opts = ((options[:config] && File.exist?(options[:config])) ? YAML.load_file(options[:config]) : {})
77
+
72
78
  # Default options
73
- opts = {
79
+ opts = opts.merge({
74
80
  data: options[:data],
75
81
  schema: options[:schema],
76
82
  indexes_first: options[:"indexes_first"],
@@ -78,7 +84,7 @@ module Tapsoob
78
84
  tables: options[:tables],
79
85
  progress: options[:progress],
80
86
  debug: options[:debug]
81
- }
87
+ })
82
88
 
83
89
  # Pull only options
84
90
  opts[:indexes] = options[:"indexes"] if options.key?(:"indexes")
@@ -91,7 +97,7 @@ module Tapsoob
91
97
 
92
98
  # Resume
93
99
  if options[:resume]
94
- if File.exists?(options[:resume])
100
+ if File.exist?(options[:resume])
95
101
  opts[:resume_file] = options[:resume]
96
102
  else
97
103
  raise "Unable to find resume file."
@@ -9,8 +9,9 @@ module Tapsoob
9
9
  desc "console DATABASE_URL", "Create an IRB REPL connected to a database"
10
10
  def console(database_url)
11
11
  $db = Sequel.connect(database_url)
12
- require 'ripl'
13
- Ripl.start binding: binding
12
+ require 'irb'
13
+ ARGV.clear # otherwise all script parameters get passed to IRB
14
+ IRB.start
14
15
  end
15
16
 
16
17
  desc "dump DATABASE_URL", "Dump a database using a database URL"
@@ -54,7 +55,7 @@ module Tapsoob
54
55
  desc "load DATABASE_URL [FILENAME]", "Load a database schema from a file or STDIN to a database using a database URL"
55
56
  option :drop, type: :boolean, default: false
56
57
  def load(database_url, filename = nil)
57
- schema = if filename && File.exists?(filename)
58
+ schema = if filename && File.exist?(filename)
58
59
  File.read(filename)
59
60
  else
60
61
  STDIN.read
@@ -69,7 +70,7 @@ module Tapsoob
69
70
 
70
71
  desc "load_foreign_keys DATABASE_URL [FILENAME]", "Load foreign keys from a file or STDIN to a database using a database URL"
71
72
  def load_foreign_keys(database_url, filename = nil)
72
- indexes = if filename && File.exists?(filename)
73
+ indexes = if filename && File.exist?(filename)
73
74
  File.read(filename)
74
75
  else
75
76
  STDIN.read
@@ -84,7 +85,7 @@ module Tapsoob
84
85
 
85
86
  desc "load_indexes DATABASE_URL [FILENAME]", "Load indexes from a file or STDIN to a database using a database URL"
86
87
  def load_indexes(database_url, filename = nil)
87
- indexes = if filename && File.exists?(filename)
88
+ indexes = if filename && File.exist?(filename)
88
89
  File.read(filename)
89
90
  else
90
91
  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.24".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
@@ -20,9 +20,8 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  # Dependencies
23
- s.add_dependency "ripl", "~> 0.7.1"
24
- s.add_dependency "sequel", "~> 5.65.0"
25
- s.add_dependency "thor", "~> 1.2.1"
23
+ s.add_dependency "sequel", "~> 5.80.0"
24
+ s.add_dependency "thor", "~> 1.3.1"
26
25
 
27
26
  if (RUBY_PLATFORM =~ /java/).nil?
28
27
  s.add_development_dependency "mysql2", "~> 0.4.10"
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.24
5
5
  platform: java
6
6
  authors:
7
7
  - Félix Bellanger
@@ -9,50 +9,36 @@ 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-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.1
20
- name: ripl
21
- prerelease: false
22
- type: :runtime
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: 0.7.1
28
- - !ruby/object:Gem::Dependency
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 5.65.0
19
+ version: 5.80.0
34
20
  name: sequel
35
- prerelease: false
36
21
  type: :runtime
22
+ prerelease: false
37
23
  version_requirements: !ruby/object:Gem::Requirement
38
24
  requirements:
39
25
  - - "~>"
40
26
  - !ruby/object:Gem::Version
41
- version: 5.65.0
27
+ version: 5.80.0
42
28
  - !ruby/object:Gem::Dependency
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 1.2.1
33
+ version: 1.3.1
48
34
  name: thor
49
- prerelease: false
50
35
  type: :runtime
36
+ prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
39
  - - "~>"
54
40
  - !ruby/object:Gem::Version
55
- version: 1.2.1
41
+ version: 1.3.1
56
42
  - !ruby/object:Gem::Dependency
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
@@ -60,8 +46,8 @@ dependencies:
60
46
  - !ruby/object:Gem::Version
61
47
  version: 5.1.44
62
48
  name: jdbc-mysql
63
- prerelease: false
64
49
  type: :runtime
50
+ prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
53
  - - "~>"
@@ -74,8 +60,8 @@ dependencies:
74
60
  - !ruby/object:Gem::Version
75
61
  version: 42.2.25
76
62
  name: jdbc-postgres
77
- prerelease: false
78
63
  type: :runtime
64
+ prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
67
  - - "~>"
@@ -88,8 +74,8 @@ dependencies:
88
74
  - !ruby/object:Gem::Version
89
75
  version: 3.28.0
90
76
  name: jdbc-sqlite3
91
- prerelease: false
92
77
  type: :runtime
78
+ prerelease: false
93
79
  version_requirements: !ruby/object:Gem::Requirement
94
80
  requirements:
95
81
  - - "~>"
@@ -149,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
135
  - !ruby/object:Gem::Version
150
136
  version: '0'
151
137
  requirements: []
152
- rubygems_version: 3.3.25
138
+ rubygems_version: 3.3.26
153
139
  signing_key:
154
140
  specification_version: 4
155
141
  summary: Simple tool to import/export databases.