Class: GpgCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/gpg_encrypt_folder.rb

Instance Method Summary collapse

Instance Method Details

#encrypted_filenameObject



83
84
85
# File 'lib/gpg_encrypt_folder.rb', line 83

def encrypted_filename
  options.destination_folder.join(output_filename)
end

#filename_without_extensionObject



75
76
77
# File 'lib/gpg_encrypt_folder.rb', line 75

def filename_without_extension
  File.basename(file, ".xml")
end

#homedirObject



67
68
69
# File 'lib/gpg_encrypt_folder.rb', line 67

def homedir
  options.homedir && "--homedir \"#{options.homedir}\""
end

#keyringObject



71
72
73
# File 'lib/gpg_encrypt_folder.rb', line 71

def keyring
  "--keyring \"#{options.keyring}\""
end

#output_filenameObject



79
80
81
# File 'lib/gpg_encrypt_folder.rb', line 79

def output_filename
  "#{filename_without_extension}.gpg"
end

#recipientObject



63
64
65
# File 'lib/gpg_encrypt_folder.rb', line 63

def recipient
  options.recipient && "--recipient \"#{options.recipient}\""
end

#to_sObject



56
57
58
59
60
61
# File 'lib/gpg_encrypt_folder.rb', line 56

def to_s
  "gpg --armor --no-default-keyring --trust-model always "\
    "#{keyring} #{homedir} #{recipient} "\
    "-o \"#{encrypted_filename}\" "\
    "--encrypt \"#{file}\""
end