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 +4 -4
- data/README.md +8 -3
- data/lib/pg_backup/railtie.rb +1 -0
- data/lib/pg_backup/tasks/sync.rake +25 -0
- data/lib/pg_backup/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6866bad1bd83f15812d07615e8cb03adf7e2722
|
4
|
+
data.tar.gz: ab1cab68882a8904c9cf229b587aa98feff922e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
87
|
-
bundle exec cap
|
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
|
data/lib/pg_backup/railtie.rb
CHANGED
@@ -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
|
data/lib/pg_backup/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|