uff_db_loader 2.0.0 → 2.1.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: 28a567bb65dcdcc545605a5b8b921abe6fb6b4b666d97928e659bf535a1675ed
4
- data.tar.gz: 4deffc2f8bad009cd16d04f08280765be75042da0f6e6e97d488addd22a51065
3
+ metadata.gz: 1b136a4cf8a5a4bbbe44371bdee9f33a97417bc22c88937d3e826af7c4a8b459
4
+ data.tar.gz: bc16630dc38a5cf6de7af81307b61dabe20f9b83675303b22addeb80288ae20c
5
5
  SHA512:
6
- metadata.gz: 22b2e2a27364e1afccda77edf18218c9c0862ee0ef389126e745848fceb08fb9fb73b042e07a71a9bddacc2818262d36c9ba109cadc5840c1c3b6175190ccfb5
7
- data.tar.gz: d8ddddf06be94aa6d2799e7beaeff371c2897cbb7cf6e83855ed112325cc2796732c23082214aa9aa938be023f881e354d2607197dd01a9923777962068c555f
6
+ metadata.gz: da774d613024ae9ff97ad3a8d6d7500b9f4e7b69dff732a9877941d2f810234b00899a7d1bcc3e69c97fe5689a96e98eeba218bbe467fa9584d2f04f44d8deca
7
+ data.tar.gz: 577d9b103ae12261c9d6a099a274f33f54413062d487a391e50e811e6fa91c64f122c706100df1d99fef9b9fe4869acbd5a1e171e857f402b5d7ca08e1d8b6c9
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install uff_db_loader
22
22
 
23
- Run the installation script:
23
+ Run the installation script:
24
24
 
25
25
  $ bin/rails uff_db_loader:install
26
26
 
@@ -50,6 +50,7 @@ Make sure the app's database user has the superuser role. Otherwise the app will
50
50
  - `dump`: Dumps a remote database from a selected environment and downloads it
51
51
  - `restore`: Restores a downloaded dump into a local database
52
52
  - `switch`: Selects a restored local database to use
53
+ - `switch_to_default`: Switches database back to the default development database
53
54
  - `load`: Dumps a remote database from a selected environment and downloads it then restores and selects the database
54
55
  - `prune`: Delete all downloaded db dumps and removes all databases created by UffDbLoader
55
56
 
@@ -79,4 +79,12 @@ namespace :uff_db_loader do
79
79
  puts "Removing dumps from #{UffDbLoader.config.dumps_directory}"
80
80
  UffDbLoader.prune_dump_directory
81
81
  end
82
+
83
+ desc "Switch back to default database"
84
+ task switch_to_default: :environment do
85
+ UffDbLoader.remember_database_name("")
86
+ UffDbLoader.restart_rails_server
87
+
88
+ puts "♻️ Restarted rails server with default database."
89
+ end
82
90
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffDbLoader
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/lib/uff_db_loader.rb CHANGED
@@ -28,7 +28,7 @@ module UffDbLoader
28
28
 
29
29
  puts "⬇️ Creating dump ..."
30
30
 
31
- target = dump_file_path(Time.now.strftime("#{config.app_name}_#{environment}_%Y_%m_%d_%H_%M_%S)"))
31
+ target = dump_file_path(Time.now.strftime("#{config.app_name}_#{environment}_%Y_%m_%d_%H_%M_%S"))
32
32
 
33
33
  command_successful = system(dump_command(environment, target))
34
34
  raise "Command did not run succesful: #{dump_command(environment, target)}" unless command_successful
@@ -108,14 +108,14 @@ module UffDbLoader
108
108
  end
109
109
 
110
110
  def initializer_path
111
- File.join(__dir__, "uff_db_loader", "templates", "uff_db_loader_initializer.erb")
111
+ Rails.root.join("config", "initializers", "uff_db_loader.rb")
112
112
  end
113
113
 
114
114
  def create_initializer
115
- template = ERB.new(File.read(initializer_path))
115
+ template = ERB.new(File.read(initializer_template_path))
116
116
 
117
117
  File.write(
118
- Rails.root.join("config", "initializers", "uff_db_loader.rb"),
118
+ initializer_path,
119
119
  template.result_with_hash(
120
120
  used_database_system: used_database_system,
121
121
  environments: environments
@@ -125,6 +125,10 @@ module UffDbLoader
125
125
 
126
126
  private
127
127
 
128
+ def initializer_template_path
129
+ File.join(__dir__, "uff_db_loader", "templates", "uff_db_loader_initializer.erb")
130
+ end
131
+
128
132
  def database_name_file
129
133
  Rails.root.join("tmp", "uff_db_loader_database_name")
130
134
  end
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.0.0
4
+ version: 2.1.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: 2022-09-29 00:00:00.000000000 Z
13
+ date: 2022-10-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.0.0
91
+ changelog_uri: https://github.com/rmehner/uff_db_loader/releases/tag/2.1.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.0.0
93
+ source_code_uri: https://github.com/rmehner/uff_db_loader/tree/2.1.0
94
94
  post_install_message: Please run `bin/rails uff_db_loader:install` to complete the
95
95
  installation.
96
96
  rdoc_options: []