capistrano-db-mirror 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e443f923780b4892b0ea156c2aad67642a71b51
4
- data.tar.gz: de208192f6c409e1272ba5961115358050fa038b
3
+ metadata.gz: 56aa98de5ce0a2f6d65b10c7a5dcdbddb363f367
4
+ data.tar.gz: fdbfb1a6bfee49006ab41bc5fcc0a791952dc84b
5
5
  SHA512:
6
- metadata.gz: 3d46406392bf96bed93a3c80db3e6f6e951755e7a6ee4d77cf86f193989ea736e6b633bbc5163bc08a96006d710edc475b0a914f6dfd71e1620bd6408d68c883
7
- data.tar.gz: 0d2d8f6c4032bac5298145baedda694033333ca0e277f59bbe49c3162d8ae4b0afeb68eec09abd396393c45dfbdc5ed62ac263cfa84abc9600b6494caabdf74e
6
+ metadata.gz: f035724c98ff5740e1d112cd339331c0ed6f897f62735a45cd3b1cf1d77f7210d72ac667d4278de84bb4c8fc208b7e70b58ee76b768f8e46caa153d8ef97c843
7
+ data.tar.gz: 360fb56c365fe889770763920bc5aea7aa1b170e2c2f1282c1674ef5bea534bbcec4bf447e744f015eaee06f82017cf78950d2b3af9de35220b56c384852bcb1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -3,7 +3,7 @@ module Capistrano
3
3
  VERSION = ::File.read(::File.expand_path('../../VERSION', __FILE__)).to_s.strip
4
4
 
5
5
  class << self
6
- attr_accessor :excludes, :sanitizer
6
+ attr_accessor :excludes, :sanitizer, :dump_dir
7
7
 
8
8
  def excludes
9
9
  @excludes ||= [:production]
@@ -16,6 +16,10 @@ module Capistrano
16
16
  }
17
17
  }
18
18
  end
19
+
20
+ def dump_dir
21
+ @dump_dir ||= './dump'
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -43,6 +43,13 @@ namespace :db do
43
43
  end
44
44
  end
45
45
 
46
+ desc "Rollback db"
47
+ task rollback: [:environment] do
48
+ files = Dir.glob(File.join(Capistrano::DbMirror.dump_dir, '**', '*.dump.gz'))
49
+ file = files.sort.reverse.first
50
+ Rake::Task["db:mirror:load"].invoke(file)
51
+ end
52
+
46
53
  desc "Sanitize db"
47
54
  task sanitize: [:environment] do
48
55
  raise "The operation is not allowed in #{Rails.env}!!" if Capistrano::DbMirror.excludes.map(&:to_s).include?(Rails.env.to_s)
@@ -9,7 +9,7 @@ namespace :db do
9
9
  remote_f = File.join('/tmp', filename)
10
10
 
11
11
  # local - scp dump file from remote
12
- local_d = './dump'
12
+ local_d = Capistrano::DbMirror.dump_dir
13
13
  FileUtils.mkdir_p(local_d)
14
14
  local_f = File.join('./dump', filename)
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-db-mirror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki