postmodern 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 +4 -4
- data/Guardfile +1 -0
- data/bin/pg_wal_archive +12 -3
- data/bin/pg_wal_restore +3 -1
- data/lib/postmodern/version.rb +1 -1
- data/spec/bin/pg_wal_archive_spec.rb +27 -4
- data/spec/bin/pg_wal_restore_spec.rb +26 -4
- 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: b21a4d73f6922f7c2d9a23454a3318fde4e57062
|
4
|
+
data.tar.gz: 4c86854b422677faff10fe9daeb0a460c729bb72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a959f4febd53f7785d744212630a9519ff02c79629aff2b96b25c1c714b2c1437fd7bd828258cb4522adfcca74d248396e2d0bd5ca1466bff758e85eea0b485
|
7
|
+
data.tar.gz: 9b9ea98694be96bcdb6e2a18a77c0ba3dc45fc637252e64a052a26a5468493ed30c11d949d7e2d62c3a267b9458d9eb528e7b006030bf0dd94b485718957dbbc
|
data/Guardfile
CHANGED
data/bin/pg_wal_archive
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# This script is a wrapper for a user-generated pg_wal_archive.local
|
4
|
+
# script. If that script does not exist, this executable does nothing
|
5
|
+
# and WAL files are not archived.
|
6
|
+
#
|
7
|
+
# This script (and the local script) should be executable as the
|
8
|
+
# postgres user.
|
9
|
+
|
10
|
+
export WAL_ARCHIVE_FILE=$1 # maps to %f in postgres archiving
|
11
|
+
export WAL_ARCHIVE_PATH=$2 # maps to %p in postgres archiving
|
5
12
|
|
6
13
|
echo "Archiving file: ${WAL_ARCHIVE_FILE}"
|
7
14
|
echo "Archiving path: ${WAL_ARCHIVE_PATH}"
|
8
15
|
|
9
|
-
pg_wal_archive.local
|
16
|
+
if which pg_wal_archive.local &>/dev/null; then
|
17
|
+
pg_wal_archive.local
|
18
|
+
fi
|
data/bin/pg_wal_restore
CHANGED
data/lib/postmodern/version.rb
CHANGED
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe 'pg_wal_archive' do
|
4
4
|
before do
|
5
5
|
double_cmd('pg_wal_archive.local')
|
6
|
+
double_cmd('which', exit: 1)
|
6
7
|
end
|
7
8
|
|
8
9
|
it 'exports WAL_ARCHIVE_FILE' do
|
@@ -13,9 +14,31 @@ describe 'pg_wal_archive' do
|
|
13
14
|
expect(`bin/pg_wal_archive filename filepath`).to include('Archiving path: filepath')
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
context 'when local script is present' do
|
18
|
+
before { double_cmd('which pg_wal_archive.local', exit: 0) }
|
19
|
+
|
20
|
+
it 'succeeds' do
|
21
|
+
expect { `bin/pg_wal_archive 1 2` }.to have_exit_status(0)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'calls a local file with file name and path' do
|
25
|
+
expect {
|
26
|
+
`bin/pg_wal_archive 11111 222222`
|
27
|
+
}.to shellout('pg_wal_archive.local')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when local script is not present' do
|
32
|
+
before { double_cmd('which pg_wal_archive.local', exit: 1) }
|
33
|
+
|
34
|
+
it 'succeeds' do
|
35
|
+
expect { `bin/pg_wal_archive 1 2` }.to have_exit_status(0)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'does nothing' do
|
39
|
+
expect {
|
40
|
+
`bin/pg_wal_archive 11111 222222`
|
41
|
+
}.not_to shellout('pg_wal_archive.local')
|
42
|
+
end
|
20
43
|
end
|
21
44
|
end
|
@@ -5,9 +5,31 @@ describe 'pg_wal_restore' do
|
|
5
5
|
double_cmd('pg_wal_restore.local')
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
context 'when local script exists' do
|
9
|
+
before { double_cmd('which pg_wal_restore.local', exit: 0) }
|
10
|
+
|
11
|
+
it 'succeeds' do
|
12
|
+
expect {`bin/pg_wal_restore 1 2`}.to have_exit_status(0)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'calls a local file with file name and path' do
|
16
|
+
expect {
|
17
|
+
`bin/pg_wal_restore 11111 222222`
|
18
|
+
}.to shellout('pg_wal_restore.local 11111 222222')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when local script does not exists' do
|
23
|
+
before { double_cmd('which pg_wal_restore.local', exit: 1) }
|
24
|
+
|
25
|
+
it 'succeeds' do
|
26
|
+
expect {`bin/pg_wal_restore 1 2`}.to have_exit_status(0)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'does nothing' do
|
30
|
+
expect {
|
31
|
+
`bin/pg_wal_restore 11111 222222`
|
32
|
+
}.not_to shellout('pg_wal_restore.local')
|
33
|
+
end
|
12
34
|
end
|
13
35
|
end
|