apple_cert_monitor 0.3.0
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 +7 -0
- data/.gitignore +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +163 -0
- data/LICENSE.txt +21 -0
- data/README.md +132 -0
- data/Rakefile +2 -0
- data/apple_cert_monitor.gemspec +41 -0
- data/bin/apple_dev_client +4 -0
- data/bin/check_certificates +4 -0
- data/bin/check_provisioning_profiles +4 -0
- data/lib/apple_cert_monitor.rb +8 -0
- data/lib/apple_cert_monitor/certificate/check_certificates.rb +89 -0
- data/lib/apple_cert_monitor/client.rb +295 -0
- data/lib/apple_cert_monitor/model/table_cell_model.rb +9 -0
- data/lib/apple_cert_monitor/provisioning_profile/check_provisioning_profiles.rb +88 -0
- data/lib/apple_cert_monitor/version.rb +3 -0
- metadata +123 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: d93f1e75058cbb7dfa3f9a6fa65bb6d44ae7b5fd
|
|
4
|
+
data.tar.gz: fc1058683cde41966fdc98e4d4dc60620f52b66f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3d2440c326b37ab1b71971eb4848fd72b4832cfe95336a9988078228eb7d316ab17f764ae121eb86cb1c1a7f78560eaef30d7839c4f98f3367abf5a8ce29612c
|
|
7
|
+
data.tar.gz: a2dd4ef0dd3e31ad071abf480b19efe63e898ce3ac1c32446e10d4c9d172dbf21a34d8901830edfb2b1b0387d26aa2e08d9d0db826fc15d9efb3a865a4dd7741
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at xzyang@thoughtworks.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
apple_cert_monitor (0.1.0)
|
|
5
|
+
fastlane (~> 2.91)
|
|
6
|
+
thor (~> 0.20)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
CFPropertyList (3.0.0)
|
|
12
|
+
addressable (2.5.2)
|
|
13
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
14
|
+
atomos (0.1.2)
|
|
15
|
+
babosa (1.0.2)
|
|
16
|
+
claide (1.0.2)
|
|
17
|
+
colored (1.2)
|
|
18
|
+
colored2 (3.1.2)
|
|
19
|
+
commander-fastlane (4.4.6)
|
|
20
|
+
highline (~> 1.7.2)
|
|
21
|
+
declarative (0.0.10)
|
|
22
|
+
declarative-option (0.1.0)
|
|
23
|
+
domain_name (0.5.20170404)
|
|
24
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
25
|
+
dotenv (2.2.2)
|
|
26
|
+
emoji_regex (0.1.1)
|
|
27
|
+
excon (0.62.0)
|
|
28
|
+
faraday (0.14.0)
|
|
29
|
+
multipart-post (>= 1.2, < 3)
|
|
30
|
+
faraday-cookie_jar (0.0.6)
|
|
31
|
+
faraday (>= 0.7.4)
|
|
32
|
+
http-cookie (~> 1.0.0)
|
|
33
|
+
faraday_middleware (0.12.2)
|
|
34
|
+
faraday (>= 0.7.4, < 1.0)
|
|
35
|
+
fastimage (2.1.1)
|
|
36
|
+
fastlane (2.92.0)
|
|
37
|
+
CFPropertyList (>= 2.3, < 4.0.0)
|
|
38
|
+
addressable (>= 2.3, < 3.0.0)
|
|
39
|
+
babosa (>= 1.0.2, < 2.0.0)
|
|
40
|
+
bundler (>= 1.12.0, < 2.0.0)
|
|
41
|
+
colored
|
|
42
|
+
commander-fastlane (>= 4.4.6, < 5.0.0)
|
|
43
|
+
dotenv (>= 2.1.1, < 3.0.0)
|
|
44
|
+
emoji_regex (~> 0.1)
|
|
45
|
+
excon (>= 0.45.0, < 1.0.0)
|
|
46
|
+
faraday (~> 0.9)
|
|
47
|
+
faraday-cookie_jar (~> 0.0.6)
|
|
48
|
+
faraday_middleware (~> 0.9)
|
|
49
|
+
fastimage (>= 2.1.0, < 3.0.0)
|
|
50
|
+
gh_inspector (>= 1.1.2, < 2.0.0)
|
|
51
|
+
google-api-client (>= 0.13.1, < 0.14.0)
|
|
52
|
+
highline (>= 1.7.2, < 2.0.0)
|
|
53
|
+
json (< 3.0.0)
|
|
54
|
+
mini_magick (~> 4.5.1)
|
|
55
|
+
multi_json
|
|
56
|
+
multi_xml (~> 0.5)
|
|
57
|
+
multipart-post (~> 2.0.0)
|
|
58
|
+
plist (>= 3.1.0, < 4.0.0)
|
|
59
|
+
public_suffix (~> 2.0.0)
|
|
60
|
+
rubyzip (>= 1.1.0, < 2.0.0)
|
|
61
|
+
security (= 0.1.3)
|
|
62
|
+
simctl (~> 1.6.3)
|
|
63
|
+
slack-notifier (>= 2.0.0, < 3.0.0)
|
|
64
|
+
terminal-notifier (>= 1.6.2, < 2.0.0)
|
|
65
|
+
terminal-table (>= 1.4.5, < 2.0.0)
|
|
66
|
+
tty-screen (>= 0.6.3, < 1.0.0)
|
|
67
|
+
tty-spinner (>= 0.8.0, < 1.0.0)
|
|
68
|
+
word_wrap (~> 1.0.0)
|
|
69
|
+
xcodeproj (>= 1.5.7, < 2.0.0)
|
|
70
|
+
xcpretty (>= 0.2.4, < 1.0.0)
|
|
71
|
+
xcpretty-travis-formatter (>= 0.0.3)
|
|
72
|
+
gh_inspector (1.1.3)
|
|
73
|
+
google-api-client (0.13.6)
|
|
74
|
+
addressable (~> 2.5, >= 2.5.1)
|
|
75
|
+
googleauth (~> 0.5)
|
|
76
|
+
httpclient (>= 2.8.1, < 3.0)
|
|
77
|
+
mime-types (~> 3.0)
|
|
78
|
+
representable (~> 3.0)
|
|
79
|
+
retriable (>= 2.0, < 4.0)
|
|
80
|
+
googleauth (0.6.2)
|
|
81
|
+
faraday (~> 0.12)
|
|
82
|
+
jwt (>= 1.4, < 3.0)
|
|
83
|
+
logging (~> 2.0)
|
|
84
|
+
memoist (~> 0.12)
|
|
85
|
+
multi_json (~> 1.11)
|
|
86
|
+
os (~> 0.9)
|
|
87
|
+
signet (~> 0.7)
|
|
88
|
+
highline (1.7.10)
|
|
89
|
+
http-cookie (1.0.3)
|
|
90
|
+
domain_name (~> 0.5)
|
|
91
|
+
httpclient (2.8.3)
|
|
92
|
+
json (2.1.0)
|
|
93
|
+
jwt (2.1.0)
|
|
94
|
+
little-plugger (1.1.4)
|
|
95
|
+
logging (2.2.2)
|
|
96
|
+
little-plugger (~> 1.1)
|
|
97
|
+
multi_json (~> 1.10)
|
|
98
|
+
memoist (0.16.0)
|
|
99
|
+
mime-types (3.1)
|
|
100
|
+
mime-types-data (~> 3.2015)
|
|
101
|
+
mime-types-data (3.2016.0521)
|
|
102
|
+
mini_magick (4.5.1)
|
|
103
|
+
multi_json (1.13.1)
|
|
104
|
+
multi_xml (0.6.0)
|
|
105
|
+
multipart-post (2.0.0)
|
|
106
|
+
nanaimo (0.2.5)
|
|
107
|
+
naturally (2.1.0)
|
|
108
|
+
os (0.9.6)
|
|
109
|
+
plist (3.4.0)
|
|
110
|
+
public_suffix (2.0.5)
|
|
111
|
+
rake (10.5.0)
|
|
112
|
+
representable (3.0.4)
|
|
113
|
+
declarative (< 0.1.0)
|
|
114
|
+
declarative-option (< 0.2.0)
|
|
115
|
+
uber (< 0.2.0)
|
|
116
|
+
retriable (3.1.1)
|
|
117
|
+
rouge (2.0.7)
|
|
118
|
+
rubyzip (1.2.1)
|
|
119
|
+
security (0.1.3)
|
|
120
|
+
signet (0.8.1)
|
|
121
|
+
addressable (~> 2.3)
|
|
122
|
+
faraday (~> 0.9)
|
|
123
|
+
jwt (>= 1.5, < 3.0)
|
|
124
|
+
multi_json (~> 1.10)
|
|
125
|
+
simctl (1.6.4)
|
|
126
|
+
CFPropertyList
|
|
127
|
+
naturally
|
|
128
|
+
slack-notifier (2.3.2)
|
|
129
|
+
terminal-notifier (1.8.0)
|
|
130
|
+
terminal-table (1.8.0)
|
|
131
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
132
|
+
thor (0.20.0)
|
|
133
|
+
tty-cursor (0.5.0)
|
|
134
|
+
tty-screen (0.6.4)
|
|
135
|
+
tty-spinner (0.8.0)
|
|
136
|
+
tty-cursor (>= 0.5.0)
|
|
137
|
+
uber (0.1.0)
|
|
138
|
+
unf (0.1.4)
|
|
139
|
+
unf_ext
|
|
140
|
+
unf_ext (0.0.7.5)
|
|
141
|
+
unicode-display_width (1.3.0)
|
|
142
|
+
word_wrap (1.0.0)
|
|
143
|
+
xcodeproj (1.5.7)
|
|
144
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
|
145
|
+
atomos (~> 0.1.2)
|
|
146
|
+
claide (>= 1.0.2, < 2.0)
|
|
147
|
+
colored2 (~> 3.1)
|
|
148
|
+
nanaimo (~> 0.2.4)
|
|
149
|
+
xcpretty (0.2.8)
|
|
150
|
+
rouge (~> 2.0.7)
|
|
151
|
+
xcpretty-travis-formatter (1.0.0)
|
|
152
|
+
xcpretty (~> 0.2, >= 0.0.7)
|
|
153
|
+
|
|
154
|
+
PLATFORMS
|
|
155
|
+
ruby
|
|
156
|
+
|
|
157
|
+
DEPENDENCIES
|
|
158
|
+
apple_cert_monitor!
|
|
159
|
+
bundler (~> 1.16)
|
|
160
|
+
rake (~> 10.0)
|
|
161
|
+
|
|
162
|
+
BUNDLED WITH
|
|
163
|
+
1.16.1
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 TODO: Write your name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# AppleCertMonitor
|
|
2
|
+
|
|
3
|
+
[](https://github.com/fastlane/fastlane/blob/master/LICENSE)
|
|
4
|
+
[](https://rubygems.org/gems/apple_cert_monitor)
|
|
5
|
+
|
|
6
|
+
This tool is the ruby-gem version of my last repo [apple-developer-account-client](https://github.com/xzyang87/apple-developer-account-client).
|
|
7
|
+
|
|
8
|
+
What AppleCertMonitor do is to monitor expiring/expired certificates/provising_profiles of all teams in an Apple developer account.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'apple_cert_monitor'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And then execute:
|
|
19
|
+
|
|
20
|
+
$ bundle
|
|
21
|
+
|
|
22
|
+
Or install it yourself as:
|
|
23
|
+
|
|
24
|
+
$ gem install apple_cert_monitor
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
- pretty print all teams of an account on terminal
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
$ apple_dev_client print_all_teams
|
|
31
|
+
```
|
|
32
|
+
- print all expired/expiring certificates/provising_profiles separately on terminal and output **.txt** file to path: **~/Downloads/AppleCertMonitorOutput**
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
$ check_certificates expired
|
|
36
|
+
$ check_certificates expiring
|
|
37
|
+
$ check_provisioning_profiles expired
|
|
38
|
+
$ check_provisioning_profiles expiring
|
|
39
|
+
```
|
|
40
|
+
- also you can forget about remembering these commands and explore all the functionalities and usage-descriptions with just the head of the command:
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
$ apple_dev_client
|
|
44
|
+
Commands:
|
|
45
|
+
apple_dev_client help [COMMAND] # Describe available commands or one specific command
|
|
46
|
+
apple_dev_client print_all_teams # find and pretty-print all teams
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
$ check_certificates
|
|
50
|
+
Commands:
|
|
51
|
+
check_certificates expired # find expired certificates in all teams
|
|
52
|
+
check_certificates expiring # find expiring certificates in all teams
|
|
53
|
+
check_certificates help [COMMAND] # Describe available commands or one specific command
|
|
54
|
+
|
|
55
|
+
$ check_provisioning_profiles
|
|
56
|
+
Commands:
|
|
57
|
+
check_provisioning_profiles expired # find expired provisioning profiles in all teams
|
|
58
|
+
check_provisioning_profiles expiring # find expiring provisioning profiles in all teams
|
|
59
|
+
check_provisioning_profiles help [COMMAND] # Describe available commands or one specific command
|
|
60
|
+
```
|
|
61
|
+
and the UI and output txt file looks like this:
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
================================================================================================================
|
|
65
|
+
Welcome to this cute tool. With its help, managing complicated Apple Developer Accounts have never been so easy!
|
|
66
|
+
=====================================================================
|
|
67
|
+
First, please enter Apple Developer Account info.
|
|
68
|
+
Enter Username:
|
|
69
|
+
XXXX@XXX.com
|
|
70
|
+
Enter Password:
|
|
71
|
+
Now login in, please wait......
|
|
72
|
+
************************************************************* 1 / 3 ******************************************************
|
|
73
|
+
|
|
74
|
+
* Now deal with team_id(XXXXXXXXXX) team_name(XXXXXXXXXX) team_type(Company/Organization)
|
|
75
|
+
|
|
76
|
+
* =====================================================================
|
|
77
|
+
* Now fetching certificates...
|
|
78
|
+
* There are XX certificates in this team
|
|
79
|
+
* Found 1 certificates with less than 60 days left.
|
|
80
|
+
* --------------------------------------------------
|
|
81
|
+
* No. | Certificate Name | Days
|
|
82
|
+
* --------------------------------------------------
|
|
83
|
+
* 1 | com.xxx.xxxxxxx.xxxxxxxxxxxxxxx | 22
|
|
84
|
+
* --------------------------------------------------
|
|
85
|
+
************************************************************* 1 / 3 ******************************************************
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
********************************************** 2 / 3 ****************************************
|
|
89
|
+
|
|
90
|
+
* Now deal with team_id(XXXXXXXXXX) team_name(XXXXXXXXXX) team_type(In-House)
|
|
91
|
+
|
|
92
|
+
* =====================================================================
|
|
93
|
+
* Now fetching certificates...
|
|
94
|
+
* There are XX certificates in this team
|
|
95
|
+
* Found 8 certificates with less than 60 days left.
|
|
96
|
+
* -------------------------------------------------
|
|
97
|
+
* No. | Certificate Name | Days
|
|
98
|
+
* -------------------------------------------------
|
|
99
|
+
* 1 | com.xxxxxxx.xxx | 9
|
|
100
|
+
* 2 | xxxxx xxxx | 0
|
|
101
|
+
* 3 | xx xxxxxxxx | 0
|
|
102
|
+
* 4 | xx xxxxxxxx | 0
|
|
103
|
+
* 5 | xx xxxxxx | 0
|
|
104
|
+
* 6 | xx xxxx | 9
|
|
105
|
+
* 7 | xx xxxxxxxx | 27
|
|
106
|
+
* 8 | com.xxxxxxx.xxxx.xxxxxxxx.xxxx | 59
|
|
107
|
+
* -------------------------------------------------
|
|
108
|
+
********************************************** 2 / 3 ****************************************
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
**************************************************** 3 / 3 **********************************************
|
|
112
|
+
|
|
113
|
+
* Now deal with team_id(XXXXXXXXXX) team_name(XXXXXXXXXX) team_type(Company/Organization)
|
|
114
|
+
|
|
115
|
+
* =====================================================================
|
|
116
|
+
* Now fetching certificates...
|
|
117
|
+
* There are 10 certificates in this team
|
|
118
|
+
* Found 0 certificates with less than 60 days left.
|
|
119
|
+
* ---------------------------------------------------------------------
|
|
120
|
+
**************************************************** 3 / 3 **********************************************
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
File created at: 04/18/18 14:02
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Contributing
|
|
127
|
+
|
|
128
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/xzyang87/apple_cert_monitor](https://github.com/xzyang87/apple_cert_monitor). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "apple_cert_monitor/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "apple_cert_monitor"
|
|
8
|
+
spec.version = AppleCertMonitor::VERSION
|
|
9
|
+
spec.authors = ["Xiaozhu Yang"]
|
|
10
|
+
spec.email = ["xzyang@thoughtworks.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Check for expiration}
|
|
13
|
+
spec.description = %q{What Apple Developer Account Client do is to monitor all the expiring and expired certificates and provising profiles in all teams of an Apple developer account.}
|
|
14
|
+
spec.homepage = "https://github.com/xzyang87/apple-developer-account-client"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
if spec.respond_to?(:metadata)
|
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
21
|
+
else
|
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
+
"public gem pushes."
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
# f.match(%r{^(test|spec|features)/})
|
|
28
|
+
# end
|
|
29
|
+
spec.files = `git ls-files`.split($/)
|
|
30
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
31
|
+
|
|
32
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
33
|
+
|
|
34
|
+
spec.require_paths = ["lib"]
|
|
35
|
+
|
|
36
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
|
37
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
38
|
+
|
|
39
|
+
spec.add_runtime_dependency "thor", "~>0.20"
|
|
40
|
+
spec.add_dependency "fastlane", "~>2.91"
|
|
41
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
require "spaceship"
|
|
2
|
+
require 'thor'
|
|
3
|
+
require 'apple_cert_monitor'
|
|
4
|
+
require 'apple_cert_monitor/client'
|
|
5
|
+
require 'apple_cert_monitor/model/table_cell_model'
|
|
6
|
+
|
|
7
|
+
module AppleCertMonitor
|
|
8
|
+
class CheckCertificates < Thor
|
|
9
|
+
|
|
10
|
+
desc "expired", "find expired certificates in all teams"
|
|
11
|
+
def expired
|
|
12
|
+
AppleDevClient.set_output_file_name("expired_certificates-#{DateTime.now.strftime("%m_%d_%H_%M")}.txt")
|
|
13
|
+
|
|
14
|
+
# Get all the teams
|
|
15
|
+
teams = AppleDevClient.teams
|
|
16
|
+
|
|
17
|
+
# Loop every team
|
|
18
|
+
teams.each_with_index do |team, team_index|
|
|
19
|
+
# print team header
|
|
20
|
+
AppleDevClient.print_team_header(team, team_index)
|
|
21
|
+
|
|
22
|
+
# Set current_team_id manually
|
|
23
|
+
Spaceship.client.team_id = team["teamId"]
|
|
24
|
+
|
|
25
|
+
# find & print expired certificates
|
|
26
|
+
cellModels = CheckCertificates.convert_certificates_to_table_cells(CheckCertificates.fetch_all_certificates)
|
|
27
|
+
AppleDevClient.find_expired_items(cellModels,
|
|
28
|
+
TableCellModel::MODEL_TYPES[:is_certificate])
|
|
29
|
+
|
|
30
|
+
# print team footer
|
|
31
|
+
AppleDevClient.print_team_footer(team, team_index)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
AppleDevClient.write_to_file_and_puts_to_console("File created at: #{DateTime.now.strftime("%m/%d/%y %H:%M")}")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
desc "expiring", "find expiring certificates in all teams"
|
|
38
|
+
def expiring
|
|
39
|
+
AppleDevClient.set_output_file_name("expiring_certificates-#{DateTime.now.strftime("%m_%d_%H_%M")}.txt")
|
|
40
|
+
|
|
41
|
+
# Get all the teams
|
|
42
|
+
teams = AppleDevClient.teams
|
|
43
|
+
|
|
44
|
+
# Loop every team
|
|
45
|
+
teams.each_with_index do |team, team_index|
|
|
46
|
+
# print team header
|
|
47
|
+
AppleDevClient.print_team_header(team, team_index)
|
|
48
|
+
|
|
49
|
+
# Set current_team_id manually
|
|
50
|
+
Spaceship.client.team_id = team["teamId"]
|
|
51
|
+
|
|
52
|
+
# find & print 60 days to expire certificates
|
|
53
|
+
cellModels = CheckCertificates.convert_certificates_to_table_cells(CheckCertificates.fetch_all_certificates)
|
|
54
|
+
AppleDevClient.find_60_days_to_expire_items(cellModels,
|
|
55
|
+
TableCellModel::MODEL_TYPES[:is_certificate])
|
|
56
|
+
|
|
57
|
+
# print team footer
|
|
58
|
+
AppleDevClient.print_team_footer(team, team_index)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
AppleDevClient.write_to_file_and_puts_to_console("File created at: #{DateTime.now.strftime("%m/%d/%y %H:%M")}")
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
def self.convert_certificates_to_table_cells(certificates)
|
|
67
|
+
cellModels = []
|
|
68
|
+
certificates.each do |certificate|
|
|
69
|
+
cell = TableCellModel.new
|
|
70
|
+
cell.name = certificate.owner_name.to_s
|
|
71
|
+
days_to_now = (certificate.expires.to_datetime - DateTime.now).to_i
|
|
72
|
+
cell.days_to_now = days_to_now
|
|
73
|
+
cellModels << cell
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
return cellModels
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def self.fetch_all_certificates
|
|
80
|
+
AppleDevClient.write_to_file_and_puts_to_console("* =====================================================================\n")
|
|
81
|
+
puts "* Now fetching certificates...\n"
|
|
82
|
+
|
|
83
|
+
all_certificates = Spaceship::Portal.certificate.all
|
|
84
|
+
|
|
85
|
+
puts "* There are #{all_certificates.count} certificates in this team\n"
|
|
86
|
+
return all_certificates
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
require "spaceship"
|
|
2
|
+
require 'io/console'
|
|
3
|
+
# require './lib/model/table_cell_model'
|
|
4
|
+
require 'thor'
|
|
5
|
+
require 'apple_cert_monitor'
|
|
6
|
+
require 'fileutils'
|
|
7
|
+
|
|
8
|
+
module AppleCertMonitor
|
|
9
|
+
class AppleDevClient < Thor
|
|
10
|
+
|
|
11
|
+
@@output_file_name
|
|
12
|
+
|
|
13
|
+
desc "print_all_teams", "find and pretty-print all teams"
|
|
14
|
+
def print_all_teams
|
|
15
|
+
if Spaceship.client == nil
|
|
16
|
+
puts "================================================================================================================".green
|
|
17
|
+
puts "Welcome to this cute tool. With its help, managing complicated Apple Developer Accounts have never been so easy!".green
|
|
18
|
+
puts "=====================================================================".green
|
|
19
|
+
puts "First, please enter Apple Developer Account info."
|
|
20
|
+
puts 'Enter Username:'
|
|
21
|
+
username = STDIN.gets.strip
|
|
22
|
+
password = STDIN.getpass("Enter Password:")
|
|
23
|
+
puts "Now login in, please wait......".green
|
|
24
|
+
AppleDevClient.login(username, password)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
all_teams = Spaceship.client.teams
|
|
28
|
+
|
|
29
|
+
if all_teams.count <= 0
|
|
30
|
+
puts "No teams available on the Developer Portal"
|
|
31
|
+
puts "You must accept an invitation to a team for it to be available"
|
|
32
|
+
puts "To learn more about teams and how to use them visit https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ManagingYourTeam/ManagingYourTeam.html"
|
|
33
|
+
raise "Your account is in no teams"
|
|
34
|
+
else
|
|
35
|
+
puts "=====================================================================".green
|
|
36
|
+
puts "Multiple teams found on the " + "Developer Portal"
|
|
37
|
+
AppleDevClient.pretty_print_teams(all_teams)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.teams
|
|
42
|
+
if Spaceship.client == nil
|
|
43
|
+
puts "================================================================================================================".green
|
|
44
|
+
puts "Welcome to this cute tool. With its help, managing complicated Apple Developer Accounts have never been so easy!".green
|
|
45
|
+
puts "=====================================================================".green
|
|
46
|
+
puts "First, please enter Apple Developer Account info."
|
|
47
|
+
puts 'Enter Username:'
|
|
48
|
+
username = STDIN.gets.strip
|
|
49
|
+
password = STDIN.getpass("Enter Password:")
|
|
50
|
+
puts "Now login in, please wait......".green
|
|
51
|
+
AppleDevClient.login(username, password)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
all_teams = Spaceship.client.teams
|
|
55
|
+
return all_teams
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.print_team_header(team, team_index)
|
|
59
|
+
# configure stars line above
|
|
60
|
+
stars_str = team_star_str(team, team_index)
|
|
61
|
+
AppleDevClient.write_to_file_and_puts_to_console(stars_str)
|
|
62
|
+
AppleDevClient.write_to_file_and_puts_to_console("\n")
|
|
63
|
+
|
|
64
|
+
# configure output string for each team
|
|
65
|
+
origin_str = team_header_str(team)
|
|
66
|
+
AppleDevClient.write_to_file_and_puts_to_console(origin_str)
|
|
67
|
+
AppleDevClient.write_to_file_and_puts_to_console("\n")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.print_team_footer(team, team_index)
|
|
71
|
+
AppleDevClient.write_to_file_and_puts_to_console(team_star_str(team, team_index))
|
|
72
|
+
AppleDevClient.write_to_file_and_puts_to_console("\n\n")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def self.team_star_str(team, team_index)
|
|
76
|
+
# configure output string for each team
|
|
77
|
+
origin_str = team_header_str(team)
|
|
78
|
+
# configure stars line above
|
|
79
|
+
star_index = 0
|
|
80
|
+
stars_str = ''
|
|
81
|
+
while star_index < origin_str.length
|
|
82
|
+
if star_index == origin_str.length / 2
|
|
83
|
+
progress_str = " #{team_index + 1} / #{teams.count} "
|
|
84
|
+
stars_str += progress_str
|
|
85
|
+
star_index += progress_str.length
|
|
86
|
+
else
|
|
87
|
+
stars_str += "*"
|
|
88
|
+
star_index += 1
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
return stars_str
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def self.team_header_str(team)
|
|
96
|
+
origin_str = "* " + "Now deal with team_id(" + team["teamId"] + ") team_name(" + team["name"] + ") team_type(" + team["type"] + ")"
|
|
97
|
+
return origin_str
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.find_expired_items(cellModels, model_type)
|
|
101
|
+
find_items(cellModels, model_type)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def self.find_60_days_to_expire_items(cellModels, model_type)
|
|
105
|
+
find_items(cellModels, model_type, 0, 60)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def self.set_output_file_name(string)
|
|
109
|
+
@@output_file_name = string
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def self.write_to_file_and_puts_to_console(string)
|
|
113
|
+
puts string
|
|
114
|
+
output_dir = "#{ENV['HOME']}/Downloads/AppleCertMonitorOutput"
|
|
115
|
+
unless File.directory?(output_dir)
|
|
116
|
+
FileUtils.mkdir_p(output_dir)
|
|
117
|
+
end
|
|
118
|
+
if string.to_s.length > 0
|
|
119
|
+
File.open("#{output_dir}/#{@@output_file_name}", 'a') {|f|
|
|
120
|
+
f << string
|
|
121
|
+
}
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def self.pretty_print_table(table_header_1, table_header_2, table_header_3, cellModels)
|
|
126
|
+
if !cellModels.is_a?(Array)
|
|
127
|
+
return
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# configure index max length
|
|
131
|
+
index_max_length = 5
|
|
132
|
+
|
|
133
|
+
# configure longest name length
|
|
134
|
+
longest_certificate_name_length = 0
|
|
135
|
+
cellModels.each do |cell|
|
|
136
|
+
if cell.kind_of?(TableCellModel)
|
|
137
|
+
if cell.name.to_s.length > longest_certificate_name_length
|
|
138
|
+
longest_certificate_name_length = cell.name.to_s.length
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# configure underline
|
|
144
|
+
underline_str = ''
|
|
145
|
+
underline_index = index_max_length + " | ".length + longest_certificate_name_length + " | ".length + "Days".length
|
|
146
|
+
while underline_index > 0
|
|
147
|
+
underline_str += '-'
|
|
148
|
+
underline_index -= 1
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# top line
|
|
152
|
+
table_top_line = "* " + underline_str
|
|
153
|
+
write_to_file_and_puts_to_console(table_top_line + "\n")
|
|
154
|
+
|
|
155
|
+
# table title
|
|
156
|
+
table_title = generate_formatted_table_row("* ",
|
|
157
|
+
table_header_1,
|
|
158
|
+
table_header_2,
|
|
159
|
+
table_header_3,
|
|
160
|
+
index_max_length,
|
|
161
|
+
longest_certificate_name_length,
|
|
162
|
+
" | ")
|
|
163
|
+
write_to_file_and_puts_to_console(table_title + "\n")
|
|
164
|
+
|
|
165
|
+
# table title bottom line
|
|
166
|
+
table_title_bottom_line = "* " + underline_str
|
|
167
|
+
write_to_file_and_puts_to_console(table_title_bottom_line + "\n")
|
|
168
|
+
|
|
169
|
+
# table content
|
|
170
|
+
cellModels.each_with_index do |cell, index|
|
|
171
|
+
row_text = generate_formatted_table_row("* ",
|
|
172
|
+
(index + 1).to_s,
|
|
173
|
+
cell.name.to_s,
|
|
174
|
+
cell.days_to_now.to_s,
|
|
175
|
+
index_max_length,
|
|
176
|
+
longest_certificate_name_length,
|
|
177
|
+
" | ")
|
|
178
|
+
write_to_file_and_puts_to_console(row_text + "\n")
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# table bottom line
|
|
182
|
+
table_bottom_line = "* " + underline_str
|
|
183
|
+
write_to_file_and_puts_to_console(table_bottom_line + "\n")
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def self.generate_formatted_table_row(left_margin, s1, s2, s3, max_s1_length, max_s2_length, separator)
|
|
187
|
+
row_text = ""
|
|
188
|
+
# concatenate index
|
|
189
|
+
row_text += left_margin + s1.to_s
|
|
190
|
+
i = 0
|
|
191
|
+
while i < (max_s1_length - s1.to_s.length) do
|
|
192
|
+
row_text += " "
|
|
193
|
+
i += 1
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
row_text += separator
|
|
197
|
+
|
|
198
|
+
# concantenate name
|
|
199
|
+
row_text += s2
|
|
200
|
+
i = 0
|
|
201
|
+
while i < (max_s2_length - s2.to_s.length) do
|
|
202
|
+
row_text += " "
|
|
203
|
+
i += 1
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
row_text += separator
|
|
207
|
+
|
|
208
|
+
# concantenate days
|
|
209
|
+
row_text += s3
|
|
210
|
+
|
|
211
|
+
return row_text
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
private
|
|
215
|
+
|
|
216
|
+
# Login
|
|
217
|
+
def self.login(username, password)
|
|
218
|
+
Spaceship::Portal.login(username, password)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def self.pretty_print_teams(teams)
|
|
222
|
+
index_max_length = 5
|
|
223
|
+
|
|
224
|
+
# configure longest id length
|
|
225
|
+
longest_team_id_length = 0
|
|
226
|
+
teams.each do |team|
|
|
227
|
+
if team['teamId'].length > longest_team_id_length
|
|
228
|
+
longest_team_id_length = team['teamId'].length
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# configure longest name length
|
|
233
|
+
longest_team_name_length = 0
|
|
234
|
+
teams.each do |team|
|
|
235
|
+
if team['name'].length > longest_team_name_length
|
|
236
|
+
longest_team_name_length = team['name'].length
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# configure longest type length
|
|
241
|
+
longest_team_type_length = 0
|
|
242
|
+
teams.each do |team|
|
|
243
|
+
if team['type'].length > longest_team_type_length
|
|
244
|
+
longest_team_type_length = team['type'].length
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# configure underline
|
|
249
|
+
underline_str = ''
|
|
250
|
+
underline_index = index_max_length + " | ".length + longest_team_id_length + " | ".length + longest_team_name_length + " | ".length + longest_team_type_length + " | ".length
|
|
251
|
+
while underline_index > 0
|
|
252
|
+
underline_str += '-'
|
|
253
|
+
underline_index -= 1
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
puts "* " + underline_str
|
|
257
|
+
printf "* %-#{index_max_length}s | %-#{longest_team_id_length}s | %-#{longest_team_name_length}s | %-#{longest_team_type_length}s\n", "No.", "Team Id", "Team Name", "Team Type"
|
|
258
|
+
puts "* " + underline_str
|
|
259
|
+
teams.each_with_index do |team, index|
|
|
260
|
+
printf "* %-#{index_max_length}s | %-#{longest_team_id_length}s | %-#{longest_team_name_length}s | %-#{longest_team_type_length}s\n", (index + 1).to_s, team['teamId'], team['name'], team['type']
|
|
261
|
+
end
|
|
262
|
+
puts "* " + underline_str
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
def self.find_items(cellModels, model_type, days_left_min=-999999, days_left_max=0)
|
|
266
|
+
target_items = []
|
|
267
|
+
|
|
268
|
+
# find expired items
|
|
269
|
+
cellModels.each do |item|
|
|
270
|
+
if item.is_a?(TableCellModel) && item.days_to_now >= days_left_min && item.days_to_now < days_left_max
|
|
271
|
+
target_items << item
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# configure title string
|
|
276
|
+
title_str = model_type ==
|
|
277
|
+
TableCellModel::MODEL_TYPES[:is_certificate] ?
|
|
278
|
+
("*" + " Found #{target_items.count} certificates " + (days_left_max <= 0 ? "expired." : "with less than #{days_left_max} days left.") + "\n")
|
|
279
|
+
:
|
|
280
|
+
("*" + " Found #{target_items.count} provisioning profiles " + (days_left_max <= 0 ? "expired." : "with less than #{days_left_max} days left.") + "\n")
|
|
281
|
+
write_to_file_and_puts_to_console(title_str)
|
|
282
|
+
|
|
283
|
+
# print out
|
|
284
|
+
if target_items.count == 0
|
|
285
|
+
write_to_file_and_puts_to_console("* ---------------------------------------------------------------------\n")
|
|
286
|
+
else
|
|
287
|
+
# print table rows
|
|
288
|
+
pretty_print_table("No.",
|
|
289
|
+
model_type == TableCellModel::MODEL_TYPES[:is_certificate] ? "Certificate Name" : "Provisioning Profile Name",
|
|
290
|
+
"Days",
|
|
291
|
+
target_items)
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
require "spaceship"
|
|
2
|
+
require 'thor'
|
|
3
|
+
require 'apple_cert_monitor'
|
|
4
|
+
require 'apple_cert_monitor/client'
|
|
5
|
+
require 'apple_cert_monitor/model/table_cell_model'
|
|
6
|
+
|
|
7
|
+
module AppleCertMonitor
|
|
8
|
+
class CheckProvisioningProfiles < Thor
|
|
9
|
+
|
|
10
|
+
desc "expired", "find expired provisioning profiles in all teams"
|
|
11
|
+
def expired
|
|
12
|
+
AppleDevClient.set_output_file_name("expired_provisioning_profiles-#{DateTime.now.strftime("%m_%d_%H_%M")}.txt")
|
|
13
|
+
|
|
14
|
+
# Get all the teams
|
|
15
|
+
teams = AppleDevClient.teams
|
|
16
|
+
|
|
17
|
+
# Loop every team
|
|
18
|
+
teams.each_with_index do |team, team_index|
|
|
19
|
+
# print team header
|
|
20
|
+
AppleDevClient.print_team_header(team, team_index)
|
|
21
|
+
|
|
22
|
+
# Set current_team_id manually
|
|
23
|
+
Spaceship.client.team_id = team["teamId"]
|
|
24
|
+
|
|
25
|
+
# find & print expired certificates
|
|
26
|
+
cellModels = CheckProvisioningProfiles.convert_provisioning_profiles_to_table_cells(CheckProvisioningProfiles.fetch_all_provisioning_profiles)
|
|
27
|
+
AppleDevClient.find_expired_items(cellModels,
|
|
28
|
+
TableCellModel::MODEL_TYPES[:is_provisioning_profile])
|
|
29
|
+
|
|
30
|
+
# print team footer
|
|
31
|
+
AppleDevClient.print_team_footer(team, team_index)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
AppleDevClient.write_to_file_and_puts_to_console("File created at: #{DateTime.now.strftime("%m/%d/%y %H:%M")}")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
desc "expiring", "find expiring provisioning profiles in all teams"
|
|
38
|
+
def expiring
|
|
39
|
+
AppleDevClient.set_output_file_name("expiring_provisioning_profiles-#{DateTime.now.strftime("%m_%d_%H_%M")}.txt")
|
|
40
|
+
|
|
41
|
+
# Get all the teams
|
|
42
|
+
teams = AppleDevClient.teams
|
|
43
|
+
|
|
44
|
+
# Loop every team
|
|
45
|
+
teams.each_with_index do |team, team_index|
|
|
46
|
+
# print team header
|
|
47
|
+
AppleDevClient.print_team_header(team, team_index)
|
|
48
|
+
|
|
49
|
+
# Set current_team_id manually
|
|
50
|
+
Spaceship.client.team_id = team["teamId"]
|
|
51
|
+
|
|
52
|
+
# find & print 60 days to expire certificates
|
|
53
|
+
cellModels = CheckProvisioningProfiles.convert_provisioning_profiles_to_table_cells(CheckProvisioningProfiles.fetch_all_provisioning_profiles)
|
|
54
|
+
AppleDevClient.find_60_days_to_expire_items(cellModels,
|
|
55
|
+
TableCellModel::MODEL_TYPES[:is_provisioning_profile])
|
|
56
|
+
# print team footer
|
|
57
|
+
AppleDevClient.print_team_footer(team, team_index)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
AppleDevClient.write_to_file_and_puts_to_console("File created at: #{DateTime.now.strftime("%m/%d/%y %H:%M")}")
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def self.convert_provisioning_profiles_to_table_cells(provisioning_profiles)
|
|
66
|
+
cellModels = []
|
|
67
|
+
provisioning_profiles.each do |profile|
|
|
68
|
+
cell = TableCellModel.new
|
|
69
|
+
cell.name = profile.name.to_s
|
|
70
|
+
days_to_now = (profile.expires - DateTime.now).to_i
|
|
71
|
+
cell.days_to_now = days_to_now
|
|
72
|
+
cellModels << cell
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
return cellModels
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.fetch_all_provisioning_profiles
|
|
79
|
+
AppleDevClient.write_to_file_and_puts_to_console("* =====================================================================\n")
|
|
80
|
+
puts "* Now fetching provisioning profiles..."
|
|
81
|
+
|
|
82
|
+
all_profiles = Spaceship::Portal.provisioning_profile.all
|
|
83
|
+
|
|
84
|
+
puts "* There are #{all_profiles.count} provisioning profiles in this team"
|
|
85
|
+
return all_profiles
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: apple_cert_monitor
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.3.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Xiaozhu Yang
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.16'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.16'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: thor
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.20'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.20'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: fastlane
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.91'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '2.91'
|
|
69
|
+
description: What Apple Developer Account Client do is to monitor all the expiring
|
|
70
|
+
and expired certificates and provising profiles in all teams of an Apple developer
|
|
71
|
+
account.
|
|
72
|
+
email:
|
|
73
|
+
- xzyang@thoughtworks.com
|
|
74
|
+
executables:
|
|
75
|
+
- apple_dev_client
|
|
76
|
+
- check_certificates
|
|
77
|
+
- check_provisioning_profiles
|
|
78
|
+
extensions: []
|
|
79
|
+
extra_rdoc_files: []
|
|
80
|
+
files:
|
|
81
|
+
- ".gitignore"
|
|
82
|
+
- CODE_OF_CONDUCT.md
|
|
83
|
+
- Gemfile
|
|
84
|
+
- Gemfile.lock
|
|
85
|
+
- LICENSE.txt
|
|
86
|
+
- README.md
|
|
87
|
+
- Rakefile
|
|
88
|
+
- apple_cert_monitor.gemspec
|
|
89
|
+
- bin/apple_dev_client
|
|
90
|
+
- bin/check_certificates
|
|
91
|
+
- bin/check_provisioning_profiles
|
|
92
|
+
- lib/apple_cert_monitor.rb
|
|
93
|
+
- lib/apple_cert_monitor/certificate/check_certificates.rb
|
|
94
|
+
- lib/apple_cert_monitor/client.rb
|
|
95
|
+
- lib/apple_cert_monitor/model/table_cell_model.rb
|
|
96
|
+
- lib/apple_cert_monitor/provisioning_profile/check_provisioning_profiles.rb
|
|
97
|
+
- lib/apple_cert_monitor/version.rb
|
|
98
|
+
homepage: https://github.com/xzyang87/apple-developer-account-client
|
|
99
|
+
licenses:
|
|
100
|
+
- MIT
|
|
101
|
+
metadata:
|
|
102
|
+
allowed_push_host: https://rubygems.org
|
|
103
|
+
post_install_message:
|
|
104
|
+
rdoc_options: []
|
|
105
|
+
require_paths:
|
|
106
|
+
- lib
|
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
requirements: []
|
|
118
|
+
rubyforge_project:
|
|
119
|
+
rubygems_version: 2.5.2
|
|
120
|
+
signing_key:
|
|
121
|
+
specification_version: 4
|
|
122
|
+
summary: Check for expiration
|
|
123
|
+
test_files: []
|