astrails-safe 0.1.7 → 0.1.8
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.
- data/README.markdown +1 -1
- data/VERSION.yml +1 -1
- data/examples/unit/gpg_example.rb +12 -12
- data/lib/astrails/safe/gpg.rb +3 -3
- metadata +1 -1
data/README.markdown
CHANGED
@@ -25,7 +25,7 @@ Note
|
|
25
25
|
|
26
26
|
Support for pg_dump and svndump was contributed but since I don't personally use them i don't have an easy
|
27
27
|
way of testing it. So if you use Subversion or PostgreSQL please test the new functionality and report if
|
28
|
-
there are any problems.
|
28
|
+
there are any problems. Issues tracker is [here](http://github.com/astrails/safe/issues)
|
29
29
|
|
30
30
|
Usage
|
31
31
|
-----
|
data/VERSION.yml
CHANGED
@@ -17,16 +17,16 @@ describe Astrails::Safe::Gpg do
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
20
|
-
before(:each) do
|
21
|
-
@gpg = gpg()
|
22
|
-
stub(@gpg).gpg_password_file {"pwd-file"}
|
23
|
-
stub(@gpg).pipe {"|gpg -BLAH"}
|
24
|
-
end
|
25
|
-
|
26
20
|
after(:each) { Astrails::Safe::TmpFile.cleanup }
|
27
21
|
|
28
22
|
describe :process do
|
29
23
|
|
24
|
+
before(:each) do
|
25
|
+
@gpg = gpg()
|
26
|
+
stub(@gpg).gpg_password_file {"pwd-file"}
|
27
|
+
stub(@gpg).pipe {"|gpg -BLAH"}
|
28
|
+
end
|
29
|
+
|
30
30
|
describe "when active" do
|
31
31
|
before(:each) do
|
32
32
|
stub(@gpg).active? {true}
|
@@ -38,7 +38,7 @@ describe Astrails::Safe::Gpg do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should add command pipe" do
|
41
|
-
mock(@backup.command) << (/\|gpg
|
41
|
+
mock(@backup.command) << (/\|gpg -BLAH/)
|
42
42
|
@gpg.process
|
43
43
|
end
|
44
44
|
|
@@ -103,7 +103,7 @@ describe Astrails::Safe::Gpg do
|
|
103
103
|
|
104
104
|
describe "with key" do
|
105
105
|
before(:each) do
|
106
|
-
@gpg = gpg(:gpg => {:key => "foo"}, :options => "OPT")
|
106
|
+
@gpg = gpg(:gpg => {:key => "foo", :options => "GPG-OPT"}, :options => "OPT")
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should not call gpg_password_file" do
|
@@ -111,19 +111,19 @@ describe Astrails::Safe::Gpg do
|
|
111
111
|
@gpg.send(:pipe)
|
112
112
|
end
|
113
113
|
|
114
|
-
it "should use '-r' and options" do
|
115
|
-
@gpg.send(:pipe).should == "|gpg OPT -e -r foo"
|
114
|
+
it "should use '-r' and :options" do
|
115
|
+
@gpg.send(:pipe).should == "|gpg GPG-OPT -e -r foo"
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
119
|
describe "with password" do
|
120
120
|
before(:each) do
|
121
|
-
@gpg = gpg(:gpg => {:password => "bar"}, :options => "OPT")
|
121
|
+
@gpg = gpg(:gpg => {:password => "bar", :options => "GPG-OPT"}, :options => "OPT")
|
122
122
|
stub(@gpg).gpg_password_file(anything) {"pass-file"}
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should use '--passphrase-file' and :options" do
|
126
|
-
@gpg.send(:pipe).should == "|gpg OPT -c --passphrase-file pass-file"
|
126
|
+
@gpg.send(:pipe).should == "|gpg GPG-OPT -c --passphrase-file pass-file"
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
data/lib/astrails/safe/gpg.rb
CHANGED
@@ -10,9 +10,9 @@ module Astrails
|
|
10
10
|
|
11
11
|
def pipe
|
12
12
|
if key
|
13
|
-
"|gpg #{@config[:options]} -e -r #{key}"
|
13
|
+
"|gpg #{@config[:gpg, :options]} -e -r #{key}"
|
14
14
|
elsif password
|
15
|
-
"|gpg #{@config[:options]} -c --passphrase-file #{gpg_password_file(password)}"
|
15
|
+
"|gpg #{@config[:gpg,:options]} -c --passphrase-file #{gpg_password_file(password)}"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ module Astrails
|
|
23
23
|
def active?
|
24
24
|
raise RuntimeError, "can't use both gpg password and pubkey" if key && password
|
25
25
|
|
26
|
-
password || key
|
26
|
+
!!(password || key)
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|