lib/circular.rb in circular-0.0.1 vs lib/circular.rb in circular-0.0.2
- old
+ new
@@ -1,23 +1,24 @@
require 'userinput'
-require 'keychain'
+require 'keylime' if RUBY_PLATFORM =~ /darwin/
+##
+# Define circular module
module Circular
class << self
def new(*args)
self::API.new(*args)
end
def load_token(domain)
lookup_token(domain) || UserInput.new(message: "Token for #{domain}").ask
end
-
+
private
def lookup_token(domain)
- entry = Keychain.open(Keychain.default.path).internet_passwords.where(
- service: domain
- ).first
+ return unless RUBY_PLATFORM =~ /darwin/
+ entry = Keylime.new(server: domain).get!("Token for #{domain}")
return nil unless entry
entry.password
end
end
end