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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ac5ce981f7e8b26640d429ff59827f4e58ed925
4
- data.tar.gz: ce95931c1ed6a073ebb00f38415ce375404bd552
3
+ metadata.gz: 1fe5cf56128088fe546a213930363d8a3d75d4cc
4
+ data.tar.gz: b5ff044461719a1af646e5a9abb8876e8bcf1cf7
5
5
  SHA512:
6
- metadata.gz: abf0b5f047f4bee4903e44ddf7b6ab3def60028083121b042dd6269e6b88ab2511e5c0fc1daccd456a4b27f6012ab3906b519aaaf610955c853b654d4ba0ac42
7
- data.tar.gz: 29b665c6db76e49980b2273f1795bc643667f4231533698bc9952b937377c511f43c95278f9088b6ef243ec1f484fee6d7d5ea32ed371ce8fc93d29855870aeb
6
+ metadata.gz: e3008157ce9de21acf2253584df5aa1358231ae8136c118ccaed24542ec682c1f20500d3bbce4aec12abe77575fe45745eb1d969346939312a6e9e9dd9799cdb
7
+ data.tar.gz: 11880444fab90a815b17ed907514c811ea6e32bfafde7220af7ae0285a87a2587cc6559538f45a63dbc9649c2fa38f99647080c3974243c58be9f9c158b15cea
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  Gemfile.lock
2
+ !bin/db_backups
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, 'Source Environment', :in => %w{staging uat production} , :default => 'production'
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]
@@ -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.load_file('config/database.yml')
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
@@ -1,3 +1,3 @@
1
1
  module DbBackups
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_backups
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris