class Encruby::CLI
Public Instance Methods
decrypt(path)
click to toggle source
# File lib/encruby/cli.rb, line 20 def decrypt(path) hash = options[:signaturee] if !hash && options[:verify] hash = "Please, provide signature for this file! [Enter to skip verification]:" hash = ask(hash).strip hash = nil if hash.empty? end opts = options.dup.merge(signature: hash, save: true) key = opts.delete(:identity_file) response = Encruby::File.new(path, key, opts).decrypt say_status "Success", "Done!", :green say_status "Digest", response[:signature], :cyan end
encrypt(path)
click to toggle source
# File lib/encruby/cli.rb, line 7 def encrypt(path) opts = options.dup.merge(save: true) key = opts.delete(:identity_file) response = Encruby::File.new(path, key, opts).encrypt say_status "Success", "Done!", :green say_status "Digest", response[:signature], :cyan end
exec(path)
click to toggle source
# File lib/encruby/cli.rb, line 39 def exec(path) hash = options[:signature] if !hash && options[:verify] hash = "Please, provide signature for this file! [Enter to skip verification]:" hash = ask(hash).strip hash = nil if hash.empty? end opts = options.dup.merge(signature: hash, save: true) key = opts.delete(:identity_file) response = Encruby::File.new(path, key, opts).decrypt path = response[:path] command = response[:path] command = "ruby #{command}" unless response[:path].readlines[0] =~ /^#\!/ command = "#{command}; rm -f #{response[:path]}" Kernel.exec(command.to_s) end