lib/astrails/safe/gpg.rb in astrails-safe-0.1.6 vs lib/astrails/safe/gpg.rb in astrails-safe-0.1.7

- old
+ new

@@ -1,42 +1,45 @@ module Astrails module Safe class Gpg < Pipe - def compressed? - active? || @parent.compressed? - end - protected + def post_process + @backup.compressed = true + end + def pipe if key - rise RuntimeError, "can't use both gpg password and pubkey" if password - "|gpg -e -r #{key}" + "|gpg #{@config[:options]} -e -r #{key}" elsif password - "|gpg -c --passphrase-file #{gpg_password_file(password)}" + "|gpg #{@config[:options]} -c --passphrase-file #{gpg_password_file(password)}" end end def extension - ".gpg" if active? + ".gpg" end def active? + raise RuntimeError, "can't use both gpg password and pubkey" if key && password + password || key end + private + def password - @password ||= config[:gpg, :password] + @password ||= @config[:gpg, :password] end def key - @key ||= config[:gpg, :key] + @key ||= @config[:gpg, :key] end def gpg_password_file(pass) return "TEMP_GENERATED_FILENAME" if $DRY_RUN Astrails::Safe::TmpFile.create("gpg-pass") { |file| file.write(pass) } end end end -end +end \ No newline at end of file