pg_backup 0.3.0 → 0.4.0

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: 1c70029ab8d41020559601504b50cc231d68161d
4
- data.tar.gz: c9e0a8194b4c28a0e4c0f5b0fb769286ca9406e7
3
+ metadata.gz: b6866bad1bd83f15812d07615e8cb03adf7e2722
4
+ data.tar.gz: ab1cab68882a8904c9cf229b587aa98feff922e9
5
5
  SHA512:
6
- metadata.gz: 1e21900d18019c6c667926f9cb55dd8d550b8a2691289f704e4c34251be108e97eaf529053b6bd9807a1a99a4d2f86a8e220e4aafb57fb453136041fcf563b28
7
- data.tar.gz: 6a97f26e859b101dde40bbf3fc4e5f6351f4c7b4df44c524d1899caf9dbc9c365e7063a3d87be9920878973720648e60b393ec7a4fa6f568364181b41fd342e3
6
+ metadata.gz: b4be5f3951ee12c7ccf236be1e856a76fe351511551ea58d69d613d01421f0e6f3a05c29a68e0171955a4dd5c4d039b6240cfc04fcfab27a15da787a2253c915
7
+ data.tar.gz: d71d47c3f773c0527ef9c23f1e21befa0bba3b9cb02ed328bd3b1d31b8f1ab05bf4d1bd186d502f44446867df8f0138358e3908a8cc05cca59211c08453e990e
data/README.md CHANGED
@@ -78,13 +78,18 @@ require "pg_backup/integration/deploy_mate"
78
78
 
79
79
  ## Example usage
80
80
 
81
- Create a dump on production server, download it, upload the dump to prestage and load it into prestage database
81
+ Create a dump on production server, download it, upload the dump to staging and load it into staging database
82
82
 
83
83
  ```
84
84
  bundle exec cap production pg_backup:dump:create
85
85
  bundle exec cap production pg_backup:dump:download
86
- bundle exec cap prestage pg_backup:dump:upload
87
- bundle exec cap prestage pg_backup:dump:load
86
+ bundle exec cap staging pg_backup:dump:upload
87
+ bundle exec cap staging pg_backup:dump:load
88
+ ```
89
+
90
+ **PRO TIP:** Use the simple **sync** task, which runs exactly the same commands:
91
+ ```
92
+ bundle exec rake pg_backup:sync PG_DUMP_SOURCE=production PG_DUMP_TARGET=staging
88
93
  ```
89
94
 
90
95
  ## Credits
@@ -4,6 +4,7 @@ module PgBackup
4
4
 
5
5
  rake_tasks do
6
6
  load "pg_backup/tasks/dump.rake"
7
+ load "pg_backup/tasks/sync.rake"
7
8
  end
8
9
  end
9
10
  end
@@ -0,0 +1,25 @@
1
+ require "pg_backup/helpers/database"
2
+ include PgBackup::Helpers::Database
3
+
4
+ namespace :pg_backup do
5
+ desc "Sync db from source server to target server"
6
+ task sync: :environment do
7
+ puts "[pg_backup:dump:sync] Create dump file on '#{source_env}'..."
8
+ sh "bundle exec cap #{source_env} pg_backup:dump:create"
9
+ puts "[pg_backup:dump:sync] Download file from '#{source_env}'..."
10
+ sh "bundle exec cap #{source_env} pg_backup:dump:download"
11
+ puts "[pg_backup:dump:sync] Upload file to '#{target_env}'..."
12
+ sh "bundle exec cap #{target_env} pg_backup:dump:upload"
13
+ puts "[pg_backup:dump:sync] Load file into '#{target_env}' database..."
14
+ sh "bundle exec cap #{target_env} pg_backup:dump:load"
15
+ puts "[pg_backup:dump:sync] Done."
16
+ end
17
+
18
+ def source_env
19
+ ENV.fetch("PG_DUMP_SOURCE")
20
+ end
21
+
22
+ def target_env
23
+ ENV.fetch("PG_DUMP_TARGET")
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module PgBackup
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Geissler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-05 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ files:
74
74
  - lib/pg_backup/tasks/capistrano.rake
75
75
  - lib/pg_backup/tasks/deploy_mate.rake
76
76
  - lib/pg_backup/tasks/dump.rake
77
+ - lib/pg_backup/tasks/sync.rake
77
78
  - lib/pg_backup/version.rb
78
79
  - pg_backup.gemspec
79
80
  homepage: https://github.com/marcusg/pg_backup
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
97
  version: '0'
97
98
  requirements: []
98
99
  rubyforge_project:
99
- rubygems_version: 2.4.5.1
100
+ rubygems_version: 2.6.10
100
101
  signing_key:
101
102
  specification_version: 4
102
103
  summary: Create, restore, download and upload postgres dumps locally and on remote