db_backups 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/db_backups +5 -2
- data/lib/db_backups/db_config.rb +12 -1
- data/lib/db_backups/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe5cf56128088fe546a213930363d8a3d75d4cc
|
4
|
+
data.tar.gz: b5ff044461719a1af646e5a9abb8876e8bcf1cf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3008157ce9de21acf2253584df5aa1358231ae8136c118ccaed24542ec682c1f20500d3bbce4aec12abe77575fe45745eb1d969346939312a6e9e9dd9799cdb
|
7
|
+
data.tar.gz: 11880444fab90a815b17ed907514c811ea6e32bfafde7220af7ae0285a87a2587cc6559538f45a63dbc9649c2fa38f99647080c3974243c58be9f9c158b15cea
|
data/.gitignore
CHANGED
data/bin/db_backups
CHANGED
@@ -10,7 +10,10 @@ require 'db_backups/db_config'
|
|
10
10
|
|
11
11
|
class DbBackups::CLI < Optitron::CLI
|
12
12
|
|
13
|
-
class_opt :environment,
|
13
|
+
class_opt :environment,
|
14
|
+
'Source Environment (NB. Destination Environment comes from RAILS_ENV var, default: development)',
|
15
|
+
:in => %w{staging uat production} ,
|
16
|
+
:default => 'production'
|
14
17
|
|
15
18
|
desc 'Index backups'
|
16
19
|
def index
|
@@ -28,7 +31,7 @@ class DbBackups::CLI < Optitron::CLI
|
|
28
31
|
puts cat(container[i_int])
|
29
32
|
end
|
30
33
|
|
31
|
-
desc 'Load backup'
|
34
|
+
desc 'Load backup (defaults to last)'
|
32
35
|
arg_types :numeric
|
33
36
|
def load(i_int=-1)
|
34
37
|
backup = container[i_int]
|
data/lib/db_backups/db_config.rb
CHANGED
@@ -1,9 +1,20 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'erb'
|
2
3
|
|
3
4
|
module DbBackups
|
4
5
|
class DbConfig
|
5
6
|
def yaml
|
6
|
-
@yaml ||= YAML.
|
7
|
+
@yaml ||= YAML.load(erb_result)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def erb_result
|
13
|
+
ERB.new(IO.read(database_yml)).result
|
14
|
+
end
|
15
|
+
|
16
|
+
def database_yml
|
17
|
+
ENV.fetch('DATABASE_YML', File.join(%w(config database.yml)))
|
7
18
|
end
|
8
19
|
end
|
9
20
|
end
|
data/lib/db_backups/version.rb
CHANGED