apple_certs_info 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/apple_certs_info.rb +19 -9
- data/lib/apple_certs_info/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b2e020de44a15df7d2cbcc0ef9cbdd2b90f1f90eb3fe00510980e18c257826a
|
4
|
+
data.tar.gz: 34a87dfd691adbf5d9285ab3e51c330e27c16b0284549e5790bdc3f17e74ca99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4357c2532858119eefdc305ce2751f3fff6e53dfca7f72f216a0dae75a50154ee85a901c4595a215385255a854e3b4872944d78de9367ac009cbe38fcdc0e1a
|
7
|
+
data.tar.gz: d2ae4af575d30f61b730fd0a101d1aea44d05b3955810ddcabd883c3bf251953936092c95913cba85b9598d27bd9d12b43fbcf1061b5b89790fa8ecbe37a99be
|
data/Gemfile.lock
CHANGED
data/lib/apple_certs_info.rb
CHANGED
@@ -3,25 +3,33 @@ require "time"
|
|
3
3
|
require "tempfile"
|
4
4
|
|
5
5
|
module AppleCertsInfo
|
6
|
+
@debug_log = false
|
6
7
|
class Error < StandardError; end
|
7
8
|
|
9
|
+
def self.set_debug_log(flag)
|
10
|
+
@debug_log = flag
|
11
|
+
end
|
12
|
+
def self.debug_log
|
13
|
+
@debug_log
|
14
|
+
end
|
15
|
+
|
8
16
|
# Check Certificate file for iPhone/Apple Development in the KeyChain
|
9
17
|
# @param days: limit days
|
10
|
-
def self.certificate_development_list_limit_days_for(days
|
18
|
+
def self.certificate_development_list_limit_days_for(days:)
|
11
19
|
raise "do not set days param" if days.nil?
|
12
|
-
limit_days_for(days: days, type: "certificate_development"
|
20
|
+
limit_days_for(days: days, type: "certificate_development")
|
13
21
|
end
|
14
22
|
|
15
23
|
# Check Certificate file for iPhone/Apple Distribution in the KeyChain
|
16
|
-
def self.certificate_distribution_list_limit_days_for(days
|
24
|
+
def self.certificate_distribution_list_limit_days_for(days:)
|
17
25
|
raise "do not set days param" if days.nil?
|
18
|
-
limit_days_for(days: days, type: "certificate_distribution"
|
26
|
+
limit_days_for(days: days, type: "certificate_distribution")
|
19
27
|
end
|
20
28
|
|
21
29
|
# Check Provisioning Profiles in the Directory that is ~/Library/MobileDevice/Provisioning Profiles/
|
22
|
-
def self.provisioning_profile_list_limit_days_for(days
|
30
|
+
def self.provisioning_profile_list_limit_days_for(days:)
|
23
31
|
raise "do not set days param" if days.nil?
|
24
|
-
limit_days_for(days: days, type: "provisioning_profile"
|
32
|
+
limit_days_for(days: days, type: "provisioning_profile")
|
25
33
|
end
|
26
34
|
|
27
35
|
def self.certificate_development_list
|
@@ -40,6 +48,7 @@ module AppleCertsInfo
|
|
40
48
|
begin
|
41
49
|
`security find-certificate -a -c "#{name}" -p > #{temp_pem_file.path}`
|
42
50
|
result = `openssl x509 -text -fingerprint -noout -in #{temp_pem_file.path}`
|
51
|
+
puts(result) if @debug_log == true
|
43
52
|
|
44
53
|
expire_datetime_match = result.match(/.*Not After :(.*)/)
|
45
54
|
raise "not exits expire date" if expire_datetime_match.nil?
|
@@ -103,7 +112,7 @@ module AppleCertsInfo
|
|
103
112
|
end
|
104
113
|
|
105
114
|
private
|
106
|
-
def self.limit_days_for(days:, type
|
115
|
+
def self.limit_days_for(days:, type:)
|
107
116
|
case type
|
108
117
|
when "certificate_development" then
|
109
118
|
list = certificate_development_list
|
@@ -112,7 +121,7 @@ module AppleCertsInfo
|
|
112
121
|
when "provisioning_profile" then
|
113
122
|
list = provisioning_profile_list_info
|
114
123
|
end
|
115
|
-
puts(list) if
|
124
|
+
puts(list) if @debug_log == true
|
116
125
|
|
117
126
|
danger_list = []
|
118
127
|
list.each do |info|
|
@@ -124,7 +133,8 @@ module AppleCertsInfo
|
|
124
133
|
|
125
134
|
def self.certificate_list_for(name:)
|
126
135
|
result = `security find-certificate -a -c "#{name}"`
|
127
|
-
name_match_list = result.scan(/.*alis"
|
136
|
+
name_match_list = result.scan(/.*alis".*=\"(.*)\".*/)
|
137
|
+
puts(name_match_list) if @debug_log == true
|
128
138
|
|
129
139
|
info = []
|
130
140
|
name_match_list.each do|name_match|
|