commit c3e15c24b0476d608af8be9ff88e9329d6abad7e
parent 9109c4b1678f384b9a83fba5e60e975eff72513b
Author: William Morgan <william@twitter.com>
Date: Wed, 19 Jan 2011 15:53:13 -0800
Merge branch 'master' into next
Diffstat:
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -103,7 +103,7 @@ module Redwood
if backup
backup_fn = fn + '.bak'
- unless File.exists?(backup_fn) && File.size(fn) == 0
+ if File.exists?(fn) && File.size(fn) > 0
File.open(backup_fn, "w", mode) do |f|
File.open(fn, "r") { |old_f| FileUtils.copy_stream old_f, f }
f.fsync
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -43,13 +43,19 @@ EOS
@mutex = Mutex.new
# test if the gpgme gem is available
- @gpgme_present = true
- begin
- GPGME.check_version({:protocol => GPGME::PROTOCOL_OpenPGP})
- rescue NameError, GPGME::Error
- @gpgme_present = false
- return
- end
+ @gpgme_present =
+ begin
+ begin
+ GPGME.check_version({:protocol => GPGME::PROTOCOL_OpenPGP})
+ true
+ rescue GPGME::Error
+ false
+ end
+ rescue NameError
+ false
+ end
+
+ return unless @gpgme_present
if (bin = `which gpg2`.chomp) =~ /\S/
GPGME.set_engine_info GPGME::PROTOCOL_OpenPGP, bin, nil