Sha256: 6ac982bafd78e5a2e628b1a0063a6c3924bd3c89e988bfc6ddf2317ad2d264e9
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
require 'osx_keychain' module CocoaPodsKeys class Keyring attr_accessor :keys, :path, :name def initialize(name, path, keys = []) @name = name.to_s @path = path @keys = keys end def self.from_hash(hash) new(hash['name'], hash['path'], hash['keys']) end def to_hash { 'keys' => @keys, 'path' => @path, 'name' => @name } end def code_name name.split(/[^a-zA-Z0-9_]/).map { |s| s[0].upcase + s[1..-1] }.join('') end def self.keychain_prefix 'cocoapods-keys-' end def save(key, value) keychain = OSXKeychain.new keychain[self.class.keychain_prefix + name, key] = value end def keychain_data keychain = OSXKeychain.new Hash[ @keys.map { |key| [key, ENV[key] || keychain[self.class.keychain_prefix + name, key]] } ] end def camel_cased_keys Hash[keychain_data.map { |(key, value)| [key[0].downcase + key[1..-1], value] }] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cocoapods-keys-1.4.0 | lib/keyring.rb |