postmodern 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/README.md +1 -0
- data/lib/postmodern/version.rb +1 -1
- data/lib/postmodern/wal/archive.rb +13 -6
- data/spec/fixtures/wal/env/postmodern_archive.local +6 -0
- data/spec/postmodern/wal/archive_spec.rb +12 -4
- data/spec/postmodern/wal/restore_spec.rb +12 -4
- data/spec/spec_helper.rb +0 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbecfcf25d7aab04bd19df71c1edd12680eb84a7
|
4
|
+
data.tar.gz: 3a104d4e01a2297319572ff763345a40da950a9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e133e8e11e56f7cb9dd594c9784cefb9311b68216e1656618f9e06b7896bbc4e6955f6606e8a416af86f2c0b348c0889b09233cd3c0f2520c7a49c366d8cdd3
|
7
|
+
data.tar.gz: 8de3bd8f674ae01174bce7b0046d53473d42b245d2da849ea29f037a392c694055012b77df04bf919987dabd765f16c3a88c91c67d8f34411395bc35810e68d1
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/postmodern/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'postmodern/command'
|
2
|
+
require 'open3'
|
2
3
|
|
3
4
|
module Postmodern
|
4
5
|
module WAL
|
@@ -32,12 +33,10 @@ module Postmodern
|
|
32
33
|
|
33
34
|
def run
|
34
35
|
if local_script_exists?
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
'PATH' => ENV['PATH']
|
40
|
-
}) { |f| puts f.gets }
|
36
|
+
stdout, stderr, status = Open3.capture3(script_env, "#{local_script} #{path} #{filename}")
|
37
|
+
$stdout.print stdout
|
38
|
+
$stderr.print stderr
|
39
|
+
exit status.exitstatus
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
@@ -58,6 +57,14 @@ module Postmodern
|
|
58
57
|
def local_script
|
59
58
|
'postmodern_archive.local'
|
60
59
|
end
|
60
|
+
|
61
|
+
def script_env
|
62
|
+
{
|
63
|
+
'WAL_ARCHIVE_PATH' => path,
|
64
|
+
'WAL_ARCHIVE_FILE' => filename,
|
65
|
+
'PATH' => ENV['PATH']
|
66
|
+
}
|
67
|
+
end
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
@@ -2,7 +2,9 @@ require 'spec_helper'
|
|
2
2
|
require 'postmodern/wal/archive'
|
3
3
|
|
4
4
|
describe Postmodern::WAL::Archive do
|
5
|
-
|
5
|
+
let(:stdout) { double(to_s: '') }
|
6
|
+
let(:stderr) { double(to_s: '') }
|
7
|
+
let(:status) { double(exitstatus: 0) }
|
6
8
|
|
7
9
|
let(:filename) { "some_file" }
|
8
10
|
let(:path) { "/path/to/file" }
|
@@ -10,6 +12,11 @@ describe Postmodern::WAL::Archive do
|
|
10
12
|
|
11
13
|
subject(:archiver) { Postmodern::WAL::Archive.new(arguments) }
|
12
14
|
|
15
|
+
before do
|
16
|
+
allow(Open3).to receive(:capture3).and_return([stdout, stderr, status])
|
17
|
+
allow(archiver).to receive(:exit)
|
18
|
+
end
|
19
|
+
|
13
20
|
describe '#run' do
|
14
21
|
let(:expected_command) { "postmodern_archive.local #{path} #{filename}" }
|
15
22
|
|
@@ -18,12 +25,13 @@ describe Postmodern::WAL::Archive do
|
|
18
25
|
|
19
26
|
it 'executes postmodern_archive.local with filename and path' do
|
20
27
|
archiver.run
|
21
|
-
expect(
|
28
|
+
expect(Open3).to have_received(:capture3).with(
|
22
29
|
{
|
23
30
|
'WAL_ARCHIVE_PATH' => path,
|
24
31
|
'WAL_ARCHIVE_FILE' => filename,
|
25
32
|
'PATH' => anything
|
26
|
-
}
|
33
|
+
},
|
34
|
+
expected_command
|
27
35
|
)
|
28
36
|
end
|
29
37
|
end
|
@@ -33,7 +41,7 @@ describe Postmodern::WAL::Archive do
|
|
33
41
|
|
34
42
|
it 'executes postmodern_archive.local with filename and path' do
|
35
43
|
archiver.run
|
36
|
-
expect(
|
44
|
+
expect(Open3).not_to have_received(:capture3)
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
@@ -2,7 +2,9 @@ require 'spec_helper'
|
|
2
2
|
require 'postmodern/wal/restore'
|
3
3
|
|
4
4
|
describe Postmodern::WAL::Restore do
|
5
|
-
|
5
|
+
let(:stdout) { double(to_s: '') }
|
6
|
+
let(:stderr) { double(to_s: '') }
|
7
|
+
let(:status) { double(exitstatus: 0) }
|
6
8
|
|
7
9
|
let(:filename) { "some_file" }
|
8
10
|
let(:path) { "/path/to/file" }
|
@@ -10,6 +12,11 @@ describe Postmodern::WAL::Restore do
|
|
10
12
|
|
11
13
|
subject(:restorer) { Postmodern::WAL::Restore.new(arguments) }
|
12
14
|
|
15
|
+
before do
|
16
|
+
allow(Open3).to receive(:capture3).and_return([stdout, stderr, status])
|
17
|
+
allow(restorer).to receive(:exit)
|
18
|
+
end
|
19
|
+
|
13
20
|
describe '#run' do
|
14
21
|
let(:expected_command) { "postmodern_restore.local #{path} #{filename}" }
|
15
22
|
|
@@ -18,12 +25,13 @@ describe Postmodern::WAL::Restore do
|
|
18
25
|
|
19
26
|
it 'executes postmodern_restore.local with filename and path' do
|
20
27
|
restorer.run
|
21
|
-
expect(
|
28
|
+
expect(Open3).to have_received(:capture3).with(
|
22
29
|
{
|
23
30
|
'WAL_ARCHIVE_PATH' => path,
|
24
31
|
'WAL_ARCHIVE_FILE' => filename,
|
25
32
|
'PATH' => anything
|
26
|
-
}
|
33
|
+
},
|
34
|
+
expected_command
|
27
35
|
)
|
28
36
|
end
|
29
37
|
end
|
@@ -33,7 +41,7 @@ describe Postmodern::WAL::Restore do
|
|
33
41
|
|
34
42
|
it 'executes postmodern_restore.local with filename and path' do
|
35
43
|
restorer.run
|
36
|
-
expect(
|
44
|
+
expect(Open3).not_to have_received(:capture3)
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmodern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Saxby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- spec/features/freeze_spec.rb
|
89
89
|
- spec/features/restore_spec.rb
|
90
90
|
- spec/features/vacuum_spec.rb
|
91
|
+
- spec/fixtures/wal/env/postmodern_archive.local
|
91
92
|
- spec/postmodern/command_spec.rb
|
92
93
|
- spec/postmodern/db/adapter_spec.rb
|
93
94
|
- spec/postmodern/postmodern_spec.rb
|
@@ -128,6 +129,7 @@ test_files:
|
|
128
129
|
- spec/features/freeze_spec.rb
|
129
130
|
- spec/features/restore_spec.rb
|
130
131
|
- spec/features/vacuum_spec.rb
|
132
|
+
- spec/fixtures/wal/env/postmodern_archive.local
|
131
133
|
- spec/postmodern/command_spec.rb
|
132
134
|
- spec/postmodern/db/adapter_spec.rb
|
133
135
|
- spec/postmodern/postmodern_spec.rb
|