module Fue::Security
Public Class Methods
get(options)
click to toggle source
# File lib/fue/security.rb, line 10 def get(options) Fue::Shell.system!(security('find', options)) rescue RuntimeError nil end
store!(options)
click to toggle source
# File lib/fue/security.rb, line 6 def store!(options) Fue::Shell.system!(security('add', options)) end
Private Class Methods
security(command = nil, options = nil)
click to toggle source
# File lib/fue/security.rb, line 18 def security(command = nil, options = nil) run = [security_path] run << "#{command}-internet-password" run << "-a #{options[:username]}" run << "-s #{options[:server]}" if command == 'add' run << "-l #{options[:label]}" run << '-U' run << "-w #{options[:password]}" if options.key?(:password) else run << '-w' end run.join ' ' end
security_path()
click to toggle source
# File lib/fue/security.rb, line 33 def security_path @security_path ||= begin `which security`.chomp rescue StandardError 'security' end end