uff_db_loader 2.2.0 → 3.0.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: 1a2c7c42ed0513c36d938f46d9346c462ec22e978ed234f519d9825eb8701c8f
4
- data.tar.gz: 6036d5f67b2447a2e747b6b242d4a69a96730c57f5ce45a01d618d4af91085a4
3
+ metadata.gz: 68a5cb60e3cf41f8a59e5ff1f0c08c6d186473633adbf8976f9ffc8b23f86af2
4
+ data.tar.gz: 44dda910a3252b9f5c2b2d9b6c3b82c60a78e4d07855f774cab8b7676db2ef28
5
5
  SHA512:
6
- metadata.gz: e843d03ce1e569f9bd03a84ec9f95321dd34f08f23ad3897392343cffb4779cc91c9d44bb6b1634c94ef6b763177cefe2489c64207bb31cbf20140e73610fa82
7
- data.tar.gz: 25d012b2ba4e6bfbc066b074a95523f8782c9da9a345ad0326014c8b7da87f343452966bfa7a217c3e1783ace8c90a82e5a19777be87ce7b89b69f7fb79cd063
6
+ metadata.gz: 8550673f5245e23f16d92fbf89f231db925f4827c9ba3ee35bfc2bcd94d8cf32a5b138a9012eeb957fe87f6b83dbf20a3a051801ddee54e4e40f28a587edc80e
7
+ data.tar.gz: 450d57b8b60f9d5d0c847d67b18144ae5ec5a8c415fd1b5f2fa5a90039f61190db61484f0e7a4092cfc14ca0e8ccd0542c3deed6a7e9ead3b8636c9f2d0b1928
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
17
+ ruby-version: ['3.0', '3.1', '3.2']
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v3
data/.standard.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
- ruby_version: 2.6
3
+ ruby_version: 3.0
@@ -29,6 +29,11 @@ namespace :uff_db_loader do
29
29
  task restore: :environment do
30
30
  UffDbLoader.ensure_installation!
31
31
 
32
+ # switch to default db so we can restore the currently connected database
33
+ UffDbLoader.remember_database_name("")
34
+ ActiveRecord::Base.remove_connection
35
+ ActiveRecord::Base.establish_connection(Rails.configuration.database_configuration["development"])
36
+
32
37
  prompt = TTY::Prompt.new
33
38
  existing_dumps = Dir.glob("#{UffDbLoader.config.dumps_directory}/#{UffDbLoader.config.app_name}*").map { |f| File.basename(f, ".*") }
34
39
  database_name = prompt.select("Which dump should be restored?", existing_dumps)
@@ -67,11 +72,9 @@ namespace :uff_db_loader do
67
72
 
68
73
  desc "Delete all downloaded db dumps and removes all databases created by UffDbLoader"
69
74
  task prune: :environment do
70
- # switch to default db so we can also drop the currently connected database
71
- UffDbLoader.remember_database_name("")
72
- ActiveRecord::Base.connection.reconnect!
73
-
74
75
  UffDbLoader.databases.each do |database_name|
76
+ next if database_name == ActiveRecord::Base.connection.current_database
77
+
75
78
  puts "Dropping #{database_name}"
76
79
  UffDbLoader.drop_database(database_name)
77
80
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffDbLoader
4
- VERSION = "2.2.0"
4
+ VERSION = "3.0.0"
5
5
  end
data/lib/uff_db_loader.rb CHANGED
@@ -45,7 +45,9 @@ module UffDbLoader
45
45
  end
46
46
 
47
47
  def prune_dump_directory
48
- FileUtils.rm_rf("#{config.dumps_directory}/.", secure: true)
48
+ FileUtils.rm_f(
49
+ FileList["#{config.dumps_directory}/*"].exclude(dump_file_path(current_database_name)).to_a
50
+ )
49
51
  end
50
52
 
51
53
  def create_database(database_name)
@@ -74,8 +76,8 @@ module UffDbLoader
74
76
 
75
77
  def current_database_name
76
78
  File.read(database_name_file).strip.presence
77
- rescue IOError, Errno::ENOENT => e
78
- puts "Could not read #{database_name_file}. #{e.message} Falling back to default database. 🥱"
79
+ rescue IOError, Errno::ENOENT
80
+ # We expect this file to be missing in non-dev environments.
79
81
  end
80
82
 
81
83
  def remember_database_name(database_name)
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.post_install_message = "Please run `bin/rails uff_db_loader:install` to complete the installation."
12
12
  spec.homepage = "https://github.com/rmehner/uff_db_loader"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
15
15
 
16
16
  spec.metadata = {
17
17
  "bug_tracker_uri" => "#{spec.homepage}/issues",
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: 2.2.0
4
+ version: 3.0.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-02-23 00:00:00.000000000 Z
13
+ date: 2023-04-06 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/2.2.0
91
+ changelog_uri: https://github.com/rmehner/uff_db_loader/releases/tag/3.0.0
92
92
  homepage_uri: https://github.com/rmehner/uff_db_loader
93
- source_code_uri: https://github.com/rmehner/uff_db_loader/tree/2.2.0
93
+ source_code_uri: https://github.com/rmehner/uff_db_loader/tree/3.0.0
94
94
  post_install_message: Please run `bin/rails uff_db_loader:install` to complete the
95
95
  installation.
96
96
  rdoc_options: []
@@ -100,14 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.6.0
103
+ version: 3.0.0
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.4.7
110
+ rubygems_version: 3.4.6
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Allows to dump, download and restore databases from docker servers.