Module: AppleCertsCleaner
- Defined in:
- lib/apple_certs_cleaner.rb,
lib/apple_certs_cleaner/version.rb
Constant Summary collapse
- VERSION =
"0.1.3"
Class Method Summary collapse
-
.remove_duplicate_certificate ⇒ Object
Remove duplicate Certificate files note: remove first data.
-
.remove_expired_certificate ⇒ Object
Remove expired Certificate files.
-
.remove_expired_provisioning_profile ⇒ Object
Remove expired Provisioning Profile.
-
.remove_invalid_certificate ⇒ Object
Remove revoked Certificate files.
Class Method Details
.remove_duplicate_certificate ⇒ Object
Remove duplicate Certificate files note: remove first data
8 9 10 11 12 13 14 |
# File 'lib/apple_certs_cleaner.rb', line 8 def self.remove_duplicate_certificate duplicate_cname = all_certs_list.group_by{ |e| e[:cname] }.select { |k, v| v.size > 1 }.map(&:first) duplicate_cname.each do |cname| delete_first_match_keychain(name: cname) end end |
.remove_expired_certificate ⇒ Object
Remove expired Certificate files
17 18 19 20 21 22 23 |
# File 'lib/apple_certs_cleaner.rb', line 17 def self.remove_expired_certificate all_certs_list.each do |certificate| if certificate[:limit_days].to_i < 0 delete_first_match_keychain(name: certificate[:cname]) end end end |
.remove_expired_provisioning_profile ⇒ Object
Remove expired Provisioning Profile
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/apple_certs_cleaner.rb', line 26 def self.remove_expired_provisioning_profile pp_list = AppleCertsInfo.provisioning_profile_list pp_list.each do |pp_file| next if pp_file[:file_path].nil? if pp_file[:limit_days].to_i < 0 puts "Delete Provisioning Profile: #{pp_file[:app_id_name]}(expired: #{pp_file[:limit_days]})" File.delete(pp_file[:file_path]) end end end |
.remove_invalid_certificate ⇒ Object
Remove revoked Certificate files
40 41 42 43 44 45 46 47 |
# File 'lib/apple_certs_cleaner.rb', line 40 def self.remove_invalid_certificate result = `security find-identity -v -p codesigning` invalid_cert_sha1 = result.scan(/[0-9]+\) ([a-zA-Z0-9]+) \".*\" .*CSSMERR_TP_CERT_REVOKED.*/) invalid_cert_sha1.each do |sha1| delete_keychain_for(sha1: sha1.first) end end |