uff_db_loader 3.1.0 → 3.2.0

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: da9439294400f1649a17e1cfe572708d68c043096fa5d2d8ec7b9d9c16aa44c1
4
- data.tar.gz: b21a7eecaf6942bd18032a7c7a198d8bac84e7e0ee69558c887da8b07733f26b
3
+ metadata.gz: 7cc0ae683bfbb729b2f2c68db73cf2848561ac41d7b3f062fa98d42578ee73b9
4
+ data.tar.gz: d4fd732e0bd9191080e96e2de07edc0ce40e1af604d50f00ecd72c3bfbc5ee4d
5
5
  SHA512:
6
- metadata.gz: b9cd41e8a56a23d406e3672179ab16d309cc93336d35319102e3c28cfc625a0992747b24da97237b5e55f59e6dd9b578681b0c689d31ae6fd0164e51a5aa8c7e
7
- data.tar.gz: 5b39ed2a2c2975d8a0dec526a2a4897987fe7e33b618bbbf96abc465fb9e7fbf3c8cd66700fbd03c7030cd208ae1dfa4e4eab1b3a58e0795bf20ca5f3820bdf4
6
+ metadata.gz: 63499cc1c3bf6a205d5287fd2c77edb4842501f12a22095b72bfdddc0153e46afa0dd0c20652ea66fab6b2cbbb7d4eb45ff11a944b866ef9e83f8e313b1a1a5f
7
+ data.tar.gz: 68fc4f568372a36c37c671dc6d9b78af11ed26524eede15bb8eab72baabd58e4e8886b3cf181d9a33ededb0642afa11559db56b3b63cfccecade37bc918769bf
data/lib/configuration.rb CHANGED
@@ -14,7 +14,8 @@ module UffDbLoader
14
14
  :app_name,
15
15
  :dumps_directory,
16
16
  :database_config_file,
17
- :container_name
17
+ :container_name,
18
+ :local_restore_command_path
18
19
  )
19
20
 
20
21
  def initialize
@@ -27,6 +28,7 @@ module UffDbLoader
27
28
  @dumps_directory = File.join(Dir.pwd, "dumps")
28
29
  @database_config_file = File.join(Dir.pwd, "config", "database.yml")
29
30
  @container_name = nil
31
+ @local_restore_command_path = nil
30
32
  end
31
33
 
32
34
  def database
@@ -10,8 +10,8 @@ module UffDbLoader
10
10
  "ssh %user%@%host% \"docker exec -i %container_name% sh -c 'exec mysqldump --opt --single-transaction --routines --triggers --events --no-tablespaces -uroot -p\"\\$MYSQL_ROOT_PASSWORD\" %database%'\" > %target%"
11
11
  end
12
12
 
13
- def self.restore_command(database_name, result_file_path)
14
- "mysql -uroot #{database_name} < #{result_file_path}"
13
+ def self.restore_command(database_name, result_file_path, config)
14
+ "#{File.join(config.local_restore_command_path || "mysql")} -uroot #{database_name} < #{result_file_path}"
15
15
  end
16
16
 
17
17
  def self.list_databases
@@ -10,8 +10,8 @@ module UffDbLoader
10
10
  "ssh %user%@%host% \"docker exec -i %container_name% sh -c 'exec pg_dump --username \\$POSTGRES_USER --clean --no-owner --no-acl --format=c %database%'\" > %target%"
11
11
  end
12
12
 
13
- def self.restore_command(database_name, result_file_path)
14
- "pg_restore --username postgres --clean --if-exists --no-owner --no-acl --dbname #{database_name} #{result_file_path}"
13
+ def self.restore_command(database_name, result_file_path, config)
14
+ "#{File.join(config.local_restore_command_path || "pg_restore")} --username postgres --clean --if-exists --no-owner --no-acl --dbname #{database_name} #{result_file_path}"
15
15
  end
16
16
 
17
17
  def self.list_databases
@@ -15,5 +15,6 @@ if defined?(UffDbLoader)
15
15
  # config.dumps_directory = '/path/to/dumps' # Defaults to Rails.root.join('dumps')
16
16
  # config.database_config_file = 'path/to/database.yml' # Defaults to Rails.root.join('config', 'database.yml')
17
17
  # config.container_name = ->(app_name, environment) { "#{app_name}_#{environment}_custom_suffix" } # Defaults to "#{app_name}_#{environment}_db". It accepts a static string too.
18
+ # config.local_restore_command_path = '' # Sets the path to the db-cli (pg_restore, mysql). Defaults to nil so it uses what is configured in $PATH.
18
19
  end
19
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffDbLoader
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2.0"
5
5
  end
data/lib/uff_db_loader.rb CHANGED
@@ -177,7 +177,7 @@ module UffDbLoader
177
177
  end
178
178
 
179
179
  def restore_command(database_name, result_file_path)
180
- config.database_system.restore_command(database_name, result_file_path)
180
+ config.database_system.restore_command(database_name, result_file_path, config)
181
181
  end
182
182
 
183
183
  def database_name_template(old_database_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uff_db_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Hellwig
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-04-06 00:00:00.000000000 Z
13
+ date: 2024-12-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: tty-prompt
@@ -88,9 +88,9 @@ licenses:
88
88
  - MIT
89
89
  metadata:
90
90
  bug_tracker_uri: https://github.com/rmehner/uff_db_loader/issues
91
- changelog_uri: https://github.com/rmehner/uff_db_loader/releases/tag/3.1.0
91
+ changelog_uri: https://github.com/rmehner/uff_db_loader/releases/tag/3.2.0
92
92
  homepage_uri: https://github.com/rmehner/uff_db_loader
93
- source_code_uri: https://github.com/rmehner/uff_db_loader/tree/3.1.0
93
+ source_code_uri: https://github.com/rmehner/uff_db_loader/tree/3.2.0
94
94
  post_install_message: Please run `bin/rails uff_db_loader:install` to complete the
95
95
  installation.
96
96
  rdoc_options: []
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.4.6
110
+ rubygems_version: 3.5.3
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Allows to dump, download and restore databases from docker servers.