uff_db_loader 1.2.0 → 1.3.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: 7bd8cbc61f1a00104d4331da35c5e46cd08d3458977a8b59f2f16bd97ff1d9f3
4
- data.tar.gz: c164595210489cc21d090672c3ff2e571184440a1a1aeb7810e070ad976d6ad4
3
+ metadata.gz: 5f807430f4dff47a2a9a98b6f360720a51a7f96c9af2554e0784383adaf0fe63
4
+ data.tar.gz: dfaf6dad64eea0e267872426f1426534703e52257c8e29a6440c174a94a94f72
5
5
  SHA512:
6
- metadata.gz: 8c63cf3e6671df456a8a5094505e28151d4c98c9410b920742ca685c91ecf683167471ad6c91d16f43dcac97e0f93f9b7ed21e784cb9f8d808fd36f3ab15544b
7
- data.tar.gz: bd6e2f2f5b5ea9e5d95dd7e2fe3eb40280d52d7b2803601f71fe3daa4f5b5edb3921fe7ddabd9e0868662457c30d760a5ef63920c2881443c59ff01d963c1216
6
+ metadata.gz: c1bed481bd67cc2d5dc3000b6d8b67d17ae0e3f7631302b717c436827862538ab679b52edea76777e8a6f2e1d103caca6c5b75796f64dcf457c7bec7e5a6b226
7
+ data.tar.gz: 05defe18ffd2c6719180c26fcab48c85de42cba697834162c9ca81a15e8394760afe8e5daf60e287bc7611b2d257d3a58cbe98778ea2c119275a0a692673bbb3
@@ -30,9 +30,14 @@ namespace :uff_db_loader do
30
30
 
31
31
  puts "✅ Succesfully loaded #{result_file_path} into #{database_name}"
32
32
 
33
- puts "💩 Because YAML is a wonderful format, you need to adapt your config file by hand."
34
- puts "🆗 Go to #{UffDbLoader.config.database_config_file} and change the development database value to: #{database_name}"
35
- puts "🧑🏾‍🏫 Don't forgot to restart the Rails server after changing the database config (`rails restart`)"
33
+ if UffDbLoader.replace_database_name_in_config(database_name)
34
+ system("bin/rails restart")
35
+ puts "🤖 Updated #{UffDbLoader.config.database_config_file} and restarted the rails server. Happy hacking, beep boop!"
36
+ else
37
+ puts "💩 Because YAML is a wonderful format, you need to adapt your config file by hand."
38
+ puts "🆗 Go to #{UffDbLoader.config.database_config_file} and change the development database value to: #{database_name}"
39
+ puts "🧑🏾‍🏫 Don't forgot to restart the Rails server after changing the database config (`rails restart`)"
40
+ end
36
41
  end
37
42
 
38
43
  desc "Delete all downloaded db dumps and emove all databases created by UffDbLoader"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffDbLoader
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/uff_db_loader.rb CHANGED
@@ -80,6 +80,16 @@ module UffDbLoader
80
80
  end
81
81
  end
82
82
 
83
+ def self.replace_database_name_in_config(new_database_name)
84
+ old_database_name = Rails.configuration.database_configuration["development"]["database"]
85
+
86
+ return false if old_database_name.nil?
87
+
88
+ old_config = File.read(UffDbLoader.config.database_config_file)
89
+ new_config = old_config.sub(old_database_name, new_database_name)
90
+ File.write(UffDbLoader.config.database_config_file, new_config)
91
+ end
92
+
83
93
  class ForbiddenEnvironmentError < StandardError; end
84
94
 
85
95
  class UnknownDatabaseSystem < StandardError; end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uff_db_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Hellwig
8
8
  - Fynn Heintz
9
9
  - Robin Mehner
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
13
  date: 2022-08-25 00:00:00.000000000 Z
@@ -88,10 +88,10 @@ 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/1.2.0
91
+ changelog_uri: https://github.com/rmehner/uff_db_loader/releases/tag/1.3.0
92
92
  homepage_uri: https://github.com/rmehner/uff_db_loader
93
- source_code_uri: https://github.com/rmehner/uff_db_loader/tree/1.2.0
94
- post_install_message:
93
+ source_code_uri: https://github.com/rmehner/uff_db_loader/tree/1.3.0
94
+ post_install_message:
95
95
  rdoc_options: []
96
96
  require_paths:
97
97
  - lib
@@ -106,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.3.8
110
- signing_key:
109
+ rubygems_version: 3.0.3
110
+ signing_key:
111
111
  specification_version: 4
112
112
  summary: Allows to dump, download and restore databases from docker servers.
113
113
  test_files: []