pprof 0.5.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -2
- data/bin/pprof +4 -0
- data/lib/pprof/output_formatter.rb +14 -13
- data/lib/pprof/provisioning_profile.rb +13 -3
- data/lib/pprof/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8d524121a74832a72453cd1e7b7a9ab1ca9d109fbca14d8cb1ce1ef8e77747
|
4
|
+
data.tar.gz: 682cfa8a82f248b977c384af168129a5395f65fb440411e7d1a919726ec7bfe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b740f1dd3808135315ea487366acb9f884c43b58067fa96e2c3272591528394371b1102a2db1445f2223aa461a28ba2d077838137b888aadc7b43063c366ccd3
|
7
|
+
data.tar.gz: 7e0f924bb2d451bc6fe6aaf4a200f0cdf0dfae5b84b841a9cfc0d2499cdb914cac8fc52074e5c9c7ebfe55fefa9aa305d97b18c91c345208906aab6335f18509
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
|
7
7
|
`pprof` is a ruby library and binary to manipulate Provisioning Profiles.
|
8
8
|
|
9
|
-
It can help you
|
9
|
+
It can help you manage the Provisioning Profiles installed on your Mac (find the profiles UUIDs from the app names or bundle IDs, find detailed information on a given profile, clean up expired profiles from your Mac…) directly from the command line.
|
10
|
+
|
11
|
+
It also supports printing the output in JSON format so you can pipe the result of printing provisioning profiles info into `jq` or similar tools.
|
10
12
|
|
11
13
|
## Installation
|
12
14
|
|
@@ -32,6 +34,8 @@ _(You might need to run this command with `sudo` if your gem home is a system di
|
|
32
34
|
|
33
35
|
### Using it from the command line
|
34
36
|
|
37
|
+
#### Listing (and filtering) provisioning profiles
|
38
|
+
|
35
39
|
```sh
|
36
40
|
# List all provisioning profiles
|
37
41
|
$ pprof
|
@@ -65,6 +69,8 @@ $ pprof --has-devices --aps --appid com.foo
|
|
65
69
|
$ pprof --exp -0 | xargs -0 rm
|
66
70
|
```
|
67
71
|
|
72
|
+
#### Printing info for a given Provisioning Profile
|
73
|
+
|
68
74
|
```sh
|
69
75
|
# Print info for a given Provisioning Profile
|
70
76
|
$ pprof '12345678-ABCD-EF90-1234-567890ABCDEF'
|
@@ -80,6 +86,25 @@ $ pprof --certs --devices --info '12345678-ABCD-EF90-1234-567890ABCDEF'
|
|
80
86
|
$ pprof -cdi '12345678-ABCD-EF90-1234-567890ABCDEF'
|
81
87
|
```
|
82
88
|
|
89
|
+
#### Printing output in JSON
|
90
|
+
|
91
|
+
```sh
|
92
|
+
# Print info about all your provisioning profiles as a JSON array
|
93
|
+
$ pprof --json
|
94
|
+
# Print info about all your provisioning profiles whose name contains "Foo", as a JSON array
|
95
|
+
$ pprof --name "Foo" --json
|
96
|
+
# Print info about all your provisioning profiles as a JSON array, including list of devices and certificates in each profile
|
97
|
+
$ pprof --json --devices --certs
|
98
|
+
|
99
|
+
# Print info about a specific provisioning profile as JSON object
|
100
|
+
$ pprof --json '12345678-ABCD-EF90-1234-567890ABCDEF'
|
101
|
+
# Print info about a specific provisioning profile as JSON object, including list of devices and certificates
|
102
|
+
$ pprof --json -c -d '12345678-ABCD-EF90-1234-567890ABCDEF'
|
103
|
+
|
104
|
+
# Use `jq` (https://stedolan.github.io/jq/) to post-process the JSON output and generate some custom JSON array of objects from it
|
105
|
+
$ pprof --name 'My App' --json --devices | jq '.[] | {uuid:.UUID, name:.AppIDName, nb_profiles: .ProvisionedDevices|length}'
|
106
|
+
```
|
107
|
+
|
83
108
|
### Using it in Ruby
|
84
109
|
|
85
110
|
```ruby
|
@@ -105,7 +130,8 @@ end
|
|
105
130
|
|
106
131
|
# And you can easily loop on all provisioning profiles and manipulate each
|
107
132
|
dir = PProf::ProvisioningProfile::DEFAULT_DIR
|
108
|
-
|
133
|
+
# `*.mobileprovision` are typically for iOS profiles, `*.provisionprofile` for Mac profiles
|
134
|
+
Dir["#{dir}/*.{mobileprovision,provisionprofile}"].each do |file|
|
109
135
|
p = PProf::ProvisioningProfile.new(file)
|
110
136
|
puts p.name
|
111
137
|
end
|
data/bin/pprof
CHANGED
@@ -88,6 +88,10 @@ parser = OptionParser.new do |opts|
|
|
88
88
|
filters[:appid] = matcher(appid)
|
89
89
|
end
|
90
90
|
|
91
|
+
opts.on('--platform PLATFORM', 'Filter by Platform (OSX, iOS, xrOS/visionOS, …)') do |platform|
|
92
|
+
filters[:platform] = platform
|
93
|
+
end
|
94
|
+
|
91
95
|
opts.on('--uuid UUID', 'Filter by UUID') do |uuid|
|
92
96
|
filters[:uuid] = matcher(uuid)
|
93
97
|
end
|
@@ -7,7 +7,7 @@ module PProf
|
|
7
7
|
# A helper tool to pretty-print Provisioning Profile informations
|
8
8
|
class OutputFormatter
|
9
9
|
# List of properties of a `PProf::ProvisioningProfile` to print when using the `-i` flag
|
10
|
-
MAIN_PROFILE_KEYS = %i[name uuid app_id_name app_id_prefix creation_date expiration_date ttl team_ids team_name]
|
10
|
+
MAIN_PROFILE_KEYS = %i[name uuid app_id_name app_id_prefix creation_date expiration_date ttl team_ids team_name].freeze
|
11
11
|
|
12
12
|
# Initialize a new OutputFormatter
|
13
13
|
#
|
@@ -157,6 +157,7 @@ module PProf
|
|
157
157
|
(filters[:has_devices].nil? || !(p.provisioned_devices || []).empty? == filters[:has_devices]) &&
|
158
158
|
(filters[:all_devices].nil? || p.provisions_all_devices == filters[:all_devices]) &&
|
159
159
|
(filters[:aps_env].nil? || match_aps_env(p.entitlements.aps_environment, filters[:aps_env])) &&
|
160
|
+
(filters[:platform].nil? || p.platform.include?(filters[:platform])) &&
|
160
161
|
true
|
161
162
|
end
|
162
163
|
end
|
@@ -164,7 +165,7 @@ module PProf
|
|
164
165
|
# Prints the filtered list as a table
|
165
166
|
#
|
166
167
|
# @param [String] dir
|
167
|
-
# The directory containing the mobileprovision files to list.
|
168
|
+
# The directory containing the mobileprovision/provisionprofile files to list.
|
168
169
|
# Defaults to '~/Library/MobileDevice/Provisioning Profiles'
|
169
170
|
#
|
170
171
|
# @yield each provisioning provile for filtering/validation
|
@@ -180,7 +181,7 @@ module PProf
|
|
180
181
|
@output.puts table.row('UUID', 'Name', 'AppID', 'Expiration Date', ' ', 'Team Name')
|
181
182
|
@output.puts table.separator
|
182
183
|
|
183
|
-
Dir['*.mobileprovision', base: dir].each do |file_name|
|
184
|
+
Dir['*.{mobileprovision,provisionprofile}', base: dir].each do |file_name|
|
184
185
|
file = File.join(dir, file_name)
|
185
186
|
begin
|
186
187
|
p = PProf::ProvisioningProfile.new(file)
|
@@ -203,21 +204,21 @@ module PProf
|
|
203
204
|
|
204
205
|
# Prints the filtered list of UUIDs or Paths only
|
205
206
|
#
|
206
|
-
# @param [String] dir
|
207
|
-
# The directory containing the mobileprovision files to list.
|
208
|
-
# Defaults to '~/Library/MobileDevice/Provisioning Profiles'
|
209
207
|
# @param [Hash] options
|
210
208
|
# The options hash typically filled while parsing the command line arguments.
|
211
209
|
# - :mode: will print the UUIDs if set to `:list`, the file path otherwise
|
212
210
|
# - :zero: will concatenate the entries with `\0` instead of `\n` if set
|
211
|
+
# @param [String] dir
|
212
|
+
# The directory containing the mobileprovision/provisionprofile files to list.
|
213
|
+
# Defaults to '~/Library/MobileDevice/Provisioning Profiles'
|
213
214
|
#
|
214
215
|
# @yield each provisioning profile for filtering/validation
|
215
216
|
# The block is given ProvisioningProfile object and should
|
216
217
|
# return true to display the row, false to filter it out
|
217
218
|
#
|
218
|
-
def print_list(dir: PProf::ProvisioningProfile::DEFAULT_DIR
|
219
|
+
def print_list(options:, dir: PProf::ProvisioningProfile::DEFAULT_DIR)
|
219
220
|
errors = []
|
220
|
-
Dir['*.mobileprovision', base: dir].each do |file_name|
|
221
|
+
Dir['*.{mobileprovision,provisionprofile}', base: dir].each do |file_name|
|
221
222
|
file = File.join(dir, file_name)
|
222
223
|
p = PProf::ProvisioningProfile.new(file)
|
223
224
|
next if block_given? && !yield(p)
|
@@ -232,21 +233,21 @@ module PProf
|
|
232
233
|
|
233
234
|
# Prints the filtered list of profiles as a JSON array
|
234
235
|
#
|
235
|
-
# @param [String] dir
|
236
|
-
# The directory containing the mobileprovision files to list.
|
237
|
-
# Defaults to '~/Library/MobileDevice/Provisioning Profiles'
|
238
236
|
# @param [Hash] options
|
239
237
|
# The options hash typically filled while parsing the command line arguments.
|
240
238
|
# - :certs: will print the UUIDs if set to `:list`, the file path otherwise
|
241
239
|
# - :devices: will concatenate the entries with `\0` instead of `\n` if set
|
240
|
+
# @param [String] dir
|
241
|
+
# The directory containing the mobileprovision/provisionprofile files to list.
|
242
|
+
# Defaults to '~/Library/MobileDevice/Provisioning Profiles'
|
242
243
|
#
|
243
244
|
# @yield each provisioning profile for filtering/validation
|
244
245
|
# The block is given ProvisioningProfile object and should
|
245
246
|
# return true to display the row, false to filter it out
|
246
247
|
#
|
247
|
-
def print_json_list(dir: PProf::ProvisioningProfile::DEFAULT_DIR
|
248
|
+
def print_json_list(options:, dir: PProf::ProvisioningProfile::DEFAULT_DIR)
|
248
249
|
errors = []
|
249
|
-
profiles = Dir['*.mobileprovision', base: dir].map do |file_name|
|
250
|
+
profiles = Dir['*.{mobileprovision,provisionprofile}', base: dir].map do |file_name|
|
250
251
|
file = File.join(dir, file_name)
|
251
252
|
p = PProf::ProvisioningProfile.new(file)
|
252
253
|
as_json(p, options) unless block_given? && !yield(p)
|
@@ -21,11 +21,13 @@ module PProf
|
|
21
21
|
# File path or UUID of the ProvisioningProfile
|
22
22
|
#
|
23
23
|
def initialize(file)
|
24
|
-
path = if file
|
25
|
-
"#{PProf::ProvisioningProfile::DEFAULT_DIR}/#{file}.mobileprovision"
|
24
|
+
path = if file.match?(/^[0-9A-F-]*$/i)
|
25
|
+
Dir["#{PProf::ProvisioningProfile::DEFAULT_DIR}/#{file}.{mobileprovision,provisionprofile}"].first
|
26
26
|
else
|
27
27
|
file
|
28
28
|
end
|
29
|
+
raise "Unable to find Provisioning Profile with UUID #{file}." if file.nil?
|
30
|
+
|
29
31
|
xml = nil
|
30
32
|
begin
|
31
33
|
pkcs7 = OpenSSL::PKCS7.new(File.read(path))
|
@@ -41,7 +43,7 @@ module PProf
|
|
41
43
|
xml = `security cms -D -i "#{path}" 2> /dev/null`
|
42
44
|
end
|
43
45
|
@plist = Plist.parse_xml(xml)
|
44
|
-
raise "Unable to parse file #{
|
46
|
+
raise "Unable to parse file #{path}." if @plist.nil?
|
45
47
|
end
|
46
48
|
|
47
49
|
# The name of the Provisioning Profile
|
@@ -58,6 +60,14 @@ module PProf
|
|
58
60
|
@plist['UUID']
|
59
61
|
end
|
60
62
|
|
63
|
+
# The list of Platforms the Provisioning Profile is for.
|
64
|
+
# Typical values include `OSX`, `iOS`, `xrOS`, `visionOS`, …
|
65
|
+
#
|
66
|
+
# @return [Array<String>]
|
67
|
+
def platform
|
68
|
+
@plist['Platform']
|
69
|
+
end
|
70
|
+
|
61
71
|
# The name of the Application Identifier associated with this Provisioning Profile
|
62
72
|
#
|
63
73
|
# @note This is not the AppID itself, but rather the name you associated to that
|
data/lib/pprof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pprof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Halligon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plist
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
|
-
rubygems_version: 3.
|
62
|
+
rubygems_version: 3.5.17
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: A Provisioning Profiles library
|