All pastes #592733 Raw Edit

blepsoaf

public ruby v1 · immutable
#592733 ·published 2007-06-27 22:09 UTC
rendered paste body
  AppCommon::Spinner.new(OPTIONS).spin(file_list) do |file|        # Check to make sure that we dont interfere with currently existing encrypted files and their unencrypted counterparts    if File.exists?("#{file}.pgp")      $logger.warn "#{file} already has an encrypted counterpart, manual intervention required -- SKIPPING!"      next    end        if !File.exists?("#{file}.pgp")          $logger.debug "Encrypting file: #{file}"      `#{OPTIONS[:gpg]} --always-trust --batch --homedir #{OPTIONS[:homedir]} --output \"#{file}.pgp\" -e -r #{OPTIONS[:recipient]} \"#{file}\"`    end    # If the exit status is all good, then there were no problems and we can delete the original    if $? == 0 and File.exists?("#{file}.pgp")      $logger.debug "Deleting unecrypted file: #{file}"      File.unlink(file)    end    # Break out of the encryption loop    if !do_loop      break    end  end