pprof 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pprof +12 -2
- data/lib/pprof/output_formatter.rb +10 -32
- data/lib/pprof/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: 21276029f4a059802fcc59cdf37a843caa2b38cc11d6af22f76fa2969bf24975
|
4
|
+
data.tar.gz: 02eedbe630b35226f7a00c531d0b8075b11ab6f4c705434e2f4e4f3445251c8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48eb1f57db15c832e6a9acf454d9c6a5ce3be07dc7db4d5877cccb7c32c96f6cfddcf7b3be78a8af8c2c9374148961273a0a1e22a5f51e13b0d8df7359b20ed7
|
7
|
+
data.tar.gz: fdb8efa34984352bc61242ae6452c3e5f6a6e3c11708735c0061d202dae12d8c232458ad88f02d572579221e7d1b8e7e30b1c457048ad626097d80d9825e5aba
|
data/bin/pprof
CHANGED
@@ -40,6 +40,8 @@ parser = OptionParser.new do |opts|
|
|
40
40
|
|Tips:
|
41
41
|
| - If you want to search for _exact_ match, you can use and anchored RegEx like `/^InHouse$/i`
|
42
42
|
| - To remove all expired certificates, you can use `#{opts.program_name} -e0 | xargs -0 rm`
|
43
|
+
| - You can combine the `--json` output with `jq` to generate and filter using some powerful custom outputs.
|
44
|
+
| e.g.: `#{opts.program_name} --name 'My App' --json --devices | jq '.[] | {uuid:.UUID, name:.AppIDName, nb_profiles: .ProvisionedDevices|length}'`
|
43
45
|
BANNER
|
44
46
|
|
45
47
|
opts.separator ''
|
@@ -142,7 +144,7 @@ unless filters.empty? || ARGV.empty?
|
|
142
144
|
exit
|
143
145
|
end
|
144
146
|
|
145
|
-
unless options.empty? || !ARGV.empty?
|
147
|
+
unless list_options[:mode] == :json || options.empty? || !ARGV.empty?
|
146
148
|
puts 'You should use option flags only when providing an specific path.'
|
147
149
|
puts parser # Usage
|
148
150
|
exit
|
@@ -154,7 +156,15 @@ o = PProf::OutputFormatter.new
|
|
154
156
|
if ARGV.empty?
|
155
157
|
# Print list of matching profiles
|
156
158
|
list_options[:mode] = :path if list_options[:zero] && list_options[:mode] == :table
|
157
|
-
o.
|
159
|
+
filter_func = o.filter_proc(filters)
|
160
|
+
case list_options[:mode]
|
161
|
+
when :table
|
162
|
+
o.print_table(&filter_func)
|
163
|
+
when :json
|
164
|
+
o.print_json_list(options: options, &filter_func)
|
165
|
+
else
|
166
|
+
o.print_list(options: list_options, &filter_func)
|
167
|
+
end
|
158
168
|
else
|
159
169
|
begin
|
160
170
|
# Print info about given profile path/UUID
|
@@ -113,7 +113,7 @@ module PProf
|
|
113
113
|
hash.delete 'DER-Encoded-Profile'
|
114
114
|
hash.delete 'ProvisionedDevices' unless options[:devices]
|
115
115
|
if options[:certs]
|
116
|
-
hash['DeveloperCertificates'] = developer_certificates.map do |cert|
|
116
|
+
hash['DeveloperCertificates'] = profile.developer_certificates.map do |cert|
|
117
117
|
{
|
118
118
|
subject: cert.subject,
|
119
119
|
issuer: cert.issuer,
|
@@ -140,27 +140,14 @@ module PProf
|
|
140
140
|
@output.puts JSON.pretty_generate(as_json(profile, options))
|
141
141
|
end
|
142
142
|
|
143
|
-
#
|
144
|
-
#
|
145
|
-
# Convenience method. Calls self.print_list with a filter block build from a filter hash
|
146
|
-
#
|
147
|
-
# @param [String] dir
|
148
|
-
# The directory to search for the provisioning profiles. Defaults to the standard directory on Mac
|
143
|
+
# Generates a lambda which takes a `PProf::ProvisioningProfile` and returns if it should be kept in our listing or not
|
149
144
|
#
|
150
145
|
# @param [Hash<Symbol,Any>] filters
|
151
146
|
# The hash describing the applied filters
|
147
|
+
# @return [Lambda] A lambda which takes a `PProf::ProvisioningProfile` and returns `true` if it matches the provided `filters`
|
152
148
|
#
|
153
|
-
|
154
|
-
|
155
|
-
# * Valid values for key `:mode` are:
|
156
|
-
# - `:table` (for ASCII table output)
|
157
|
-
# - `:list` (for plain list of only the UUIDs, suitable for piping to `xargs`)
|
158
|
-
# - `:path` (for plain list of only the paths, suitable for piping to `xargs`)
|
159
|
-
# * Valid values for key `:zero` are `true` or `false` to decide if we print `\0` at the end of each output.
|
160
|
-
# Only used by `:list` and `:path` modes
|
161
|
-
#
|
162
|
-
def print_filtered_list(dir = PProf::ProvisioningProfile::DEFAULT_DIR, filters = {}, list_options = { mode: :table })
|
163
|
-
filter_func = lambda do |p|
|
149
|
+
def filter_proc(filters = {})
|
150
|
+
lambda do |p|
|
164
151
|
(filters[:name].nil? || p.name =~ filters[:name]) &&
|
165
152
|
(filters[:appid_name].nil? || p.app_id_name =~ filters[:appid_name]) &&
|
166
153
|
(filters[:appid].nil? || p.entitlements.app_id =~ filters[:appid]) &&
|
@@ -172,15 +159,6 @@ module PProf
|
|
172
159
|
(filters[:aps_env].nil? || match_aps_env(p.entitlements.aps_environment, filters[:aps_env])) &&
|
173
160
|
true
|
174
161
|
end
|
175
|
-
|
176
|
-
case list_options[:mode]
|
177
|
-
when :table
|
178
|
-
print_table(dir, &filter_func)
|
179
|
-
when :json
|
180
|
-
print_json_list(dir, list_options, &filter_func)
|
181
|
-
else
|
182
|
-
print_list(dir, list_options, &filter_func)
|
183
|
-
end
|
184
162
|
end
|
185
163
|
|
186
164
|
# Prints the filtered list as a table
|
@@ -193,7 +171,7 @@ module PProf
|
|
193
171
|
# The block is given ProvisioningProfile object and should
|
194
172
|
# return true to display the row, false to filter it out
|
195
173
|
#
|
196
|
-
def print_table(dir
|
174
|
+
def print_table(dir: PProf::ProvisioningProfile::DEFAULT_DIR)
|
197
175
|
count = 0
|
198
176
|
errors = []
|
199
177
|
|
@@ -237,7 +215,7 @@ module PProf
|
|
237
215
|
# The block is given ProvisioningProfile object and should
|
238
216
|
# return true to display the row, false to filter it out
|
239
217
|
#
|
240
|
-
def print_list(dir
|
218
|
+
def print_list(dir: PProf::ProvisioningProfile::DEFAULT_DIR, options:) # rubocop:disable Style/OptionalArguments
|
241
219
|
errors = []
|
242
220
|
Dir['*.mobileprovision', base: dir].each do |file_name|
|
243
221
|
file = File.join(dir, file_name)
|
@@ -259,14 +237,14 @@ module PProf
|
|
259
237
|
# Defaults to '~/Library/MobileDevice/Provisioning Profiles'
|
260
238
|
# @param [Hash] options
|
261
239
|
# The options hash typically filled while parsing the command line arguments.
|
262
|
-
# - :
|
263
|
-
# - :
|
240
|
+
# - :certs: will print the UUIDs if set to `:list`, the file path otherwise
|
241
|
+
# - :devices: will concatenate the entries with `\0` instead of `\n` if set
|
264
242
|
#
|
265
243
|
# @yield each provisioning profile for filtering/validation
|
266
244
|
# The block is given ProvisioningProfile object and should
|
267
245
|
# return true to display the row, false to filter it out
|
268
246
|
#
|
269
|
-
def print_json_list(dir
|
247
|
+
def print_json_list(dir: PProf::ProvisioningProfile::DEFAULT_DIR, options:) # rubocop:disable Style/OptionalArguments
|
270
248
|
errors = []
|
271
249
|
profiles = Dir['*.mobileprovision', base: dir].map do |file_name|
|
272
250
|
file = File.join(dir, file_name)
|
data/lib/pprof/version.rb
CHANGED