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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: beb70176f9b6a2673c3b36ed4ca232890683d18f
4
- data.tar.gz: c60027334210357bd684049bd09e5269e34c491e
3
+ metadata.gz: b21a4d73f6922f7c2d9a23454a3318fde4e57062
4
+ data.tar.gz: 4c86854b422677faff10fe9daeb0a460c729bb72
5
5
  SHA512:
6
- metadata.gz: dffefefa12f86d9efb264c89c4ded2bc639d7f718f5c657cefef37219c318d652d4ef2b1eeb2c5876a9df34e21de5dfaf79eb4f564d8e53fa22f0304bd1fd753
7
- data.tar.gz: 705628ee8b7e61baf35b1b2d503d949a9d9e84eb6a4f27dd4079e283fe171008bd9bc2fd099ad975fdab1d3698517f536a05f76a4fa40c0a2a6d5b1487a0caae
6
+ metadata.gz: 1a959f4febd53f7785d744212630a9519ff02c79629aff2b96b25c1c714b2c1437fd7bd828258cb4522adfcca74d248396e2d0bd5ca1466bff758e85eea0b485
7
+ data.tar.gz: 9b9ea98694be96bcdb6e2a18a77c0ba3dc45fc637252e64a052a26a5468493ed30c11d949d7e2d62c3a267b9458d9eb528e7b006030bf0dd94b485718957dbbc
data/Guardfile CHANGED
@@ -2,6 +2,7 @@
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
4
  guard :rspec do
5
+ watch(%r{^bin/.+$})
5
6
  watch(%r{^spec/.+_spec\.rb$})
6
7
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
8
  watch('spec/spec_helper.rb') { "spec" }
data/bin/pg_wal_archive CHANGED
@@ -1,9 +1,18 @@
1
1
  #!/bin/bash
2
2
 
3
- export WAL_ARCHIVE_FILE=$1
4
- export WAL_ARCHIVE_PATH=$2
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
@@ -1,3 +1,5 @@
1
1
  #!/bin/bash
2
2
 
3
- pg_wal_restore.local $1 $2
3
+ if which pg_wal_restore.local &>/dev/null; then
4
+ pg_wal_restore.local $1 $2
5
+ fi
@@ -1,3 +1,3 @@
1
1
  module Postmodern
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
- it 'calls a local file with file name and path' do
17
- expect {
18
- `bin/pg_wal_archive 11111 222222`
19
- }.to shellout('pg_wal_archive.local')
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
- it 'calls a local file with file name and path' do
9
- expect {
10
- `bin/pg_wal_restore 11111 222222`
11
- }.to shellout('pg_wal_restore.local 11111 222222')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmodern
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
  - Eric Saxby