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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68a5cb60e3cf41f8a59e5ff1f0c08c6d186473633adbf8976f9ffc8b23f86af2
4
- data.tar.gz: 44dda910a3252b9f5c2b2d9b6c3b82c60a78e4d07855f774cab8b7676db2ef28
3
+ metadata.gz: 808414f4eabaeb5ce4f34cbe179a78f730c9d26ad8ad15b69255b15038ffe803
4
+ data.tar.gz: 84543d60988b10a30c002d6a3922a23b9818e1c0d6d8e548dec9d51bbd6fdfe8
5
5
  SHA512:
6
- metadata.gz: 8550673f5245e23f16d92fbf89f231db925f4827c9ba3ee35bfc2bcd94d8cf32a5b138a9012eeb957fe87f6b83dbf20a3a051801ddee54e4e40f28a587edc80e
7
- data.tar.gz: 450d57b8b60f9d5d0c847d67b18144ae5ec5a8c415fd1b5f2fa5a90039f61190db61484f0e7a4092cfc14ca0e8ccd0542c3deed6a7e9ead3b8636c9f2d0b1928
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
- existing_dumps = Dir.glob("#{UffDbLoader.config.dumps_directory}/#{UffDbLoader.config.app_name}*").map { |f| File.basename(f, ".*") }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffDbLoader
4
- VERSION = "3.0.0"
4
+ VERSION = "3.0.1"
5
5
  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}_%Y_%m_%d_%H_%M_%S"))
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.select do |line|
63
- line =~ /#{config.app_name}_(#{config.environments.join("|")})_(\d|_)+/
64
- end
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.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.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.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: []