uff_db_loader 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uff_db_loader/tasks/uff_db_loader.rake +1 -2
- data/lib/uff_db_loader/version.rb +1 -1
- data/lib/uff_db_loader.rb +16 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 808414f4eabaeb5ce4f34cbe179a78f730c9d26ad8ad15b69255b15038ffe803
|
4
|
+
data.tar.gz: 84543d60988b10a30c002d6a3922a23b9818e1c0d6d8e548dec9d51bbd6fdfe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3375429c2ba7351f575f8e1a658a9962d00ef5b4dbce63e496ca2534e2febd014f482eb98d4fbd6419f6d19461df99fc903f75e1859426fa5400d75f78646778
|
7
|
+
data.tar.gz: 035eb70eaf893677206aaf0b8be8b68bae37322d0d1ad870612ef4ff7c14b79b36a72c5c2823a15722d3e91b8e269d652a90fa71dfea3e0224b4a2fcb423aea6
|
@@ -35,8 +35,7 @@ namespace :uff_db_loader do
|
|
35
35
|
ActiveRecord::Base.establish_connection(Rails.configuration.database_configuration["development"])
|
36
36
|
|
37
37
|
prompt = TTY::Prompt.new
|
38
|
-
|
39
|
-
database_name = prompt.select("Which dump should be restored?", existing_dumps)
|
38
|
+
database_name = prompt.select("Which dump should be restored?", UffDbLoader.dumps)
|
40
39
|
|
41
40
|
UffDbLoader.load_dump_into_database(database_name)
|
42
41
|
end
|
data/lib/uff_db_loader.rb
CHANGED
@@ -6,6 +6,9 @@ require "configuration"
|
|
6
6
|
module UffDbLoader
|
7
7
|
require "railtie"
|
8
8
|
|
9
|
+
TIMESTAMP_FORMAT = "%Y_%m_%d_%H_%M_%S"
|
10
|
+
TIMESTAMP_LENGTH = Time.now.strftime(TIMESTAMP_FORMAT).size
|
11
|
+
|
9
12
|
class << self
|
10
13
|
def config
|
11
14
|
@configuration ||= Configuration.new
|
@@ -28,7 +31,7 @@ module UffDbLoader
|
|
28
31
|
|
29
32
|
puts "⬇️ Creating dump ..."
|
30
33
|
|
31
|
-
target = dump_file_path(Time.now.strftime("#{config.app_name}_#{environment}_
|
34
|
+
target = dump_file_path(Time.now.strftime("#{config.app_name}_#{environment}_#{TIMESTAMP_FORMAT}"))
|
32
35
|
|
33
36
|
command_successful = system(dump_command(environment, target))
|
34
37
|
raise "Command did not run succesful: #{dump_command(environment, target)}" unless command_successful
|
@@ -59,9 +62,18 @@ module UffDbLoader
|
|
59
62
|
end
|
60
63
|
|
61
64
|
def databases
|
62
|
-
config.database_system.list_databases
|
63
|
-
line =~ /#{config.app_name}_(#{config.environments.join("|")})_(\d|_)+/
|
64
|
-
|
65
|
+
config.database_system.list_databases
|
66
|
+
.select { |line| line =~ /#{config.app_name}_(#{config.environments.join("|")})_(\d|_)+/ }
|
67
|
+
.sort_by { |database| database[-TIMESTAMP_LENGTH..] }
|
68
|
+
.reverse
|
69
|
+
end
|
70
|
+
|
71
|
+
def dumps
|
72
|
+
Dir
|
73
|
+
.glob("#{config.dumps_directory}/#{config.app_name}*")
|
74
|
+
.map { |f| File.basename(f, ".*") }
|
75
|
+
.sort_by { |dump| dump[-TIMESTAMP_LENGTH..] }
|
76
|
+
.reverse
|
65
77
|
end
|
66
78
|
|
67
79
|
def setup_dynamic_database_name_in_config
|
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.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Hellwig
|
@@ -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.0.
|
91
|
+
changelog_uri: https://github.com/rmehner/uff_db_loader/releases/tag/3.0.1
|
92
92
|
homepage_uri: https://github.com/rmehner/uff_db_loader
|
93
|
-
source_code_uri: https://github.com/rmehner/uff_db_loader/tree/3.0.
|
93
|
+
source_code_uri: https://github.com/rmehner/uff_db_loader/tree/3.0.1
|
94
94
|
post_install_message: Please run `bin/rails uff_db_loader:install` to complete the
|
95
95
|
installation.
|
96
96
|
rdoc_options: []
|