class Diffcrypt::CLI
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/diffcrypt/cli.rb, line 51 def self.exit_on_failure? true end
Public Instance Methods
decrypt(path)
click to toggle source
# File lib/diffcrypt/cli.rb, line 11 def decrypt(path) file = File.new(path) ensure_file_exists(file) say file.decrypt(key) end
encrypt(path)
click to toggle source
# File lib/diffcrypt/cli.rb, line 20 def encrypt(path) file = File.new(path) ensure_file_exists(file) say file.encrypt(key, cipher: options[:cipher]) end
encryptor()
click to toggle source
# File lib/diffcrypt/cli.rb, line 42 def encryptor @encryptor ||= Encryptor.new(key) end
ensure_file_exists(file)
click to toggle source
@param [Diffcrypt::File] path
# File lib/diffcrypt/cli.rb, line 47 def ensure_file_exists(file) abort('[ERROR] File does not exist') unless file.exists? end
generate_key()
click to toggle source
# File lib/diffcrypt/cli.rb, line 28 def generate_key say Encryptor.generate_key(options[:cipher]) end
key()
click to toggle source
# File lib/diffcrypt/cli.rb, line 38 def key options[:key] end
version()
click to toggle source
# File lib/diffcrypt/cli.rb, line 33 def version say Diffcrypt::VERSION end