read_ipa 0.2.0 → 0.2.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/read_ipa.rb +8 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2a7646019ea6e7252423c51d1547fcced1825b1
4
- data.tar.gz: 7b994e0ad60aa6de7f31af351af733409f563a9c
3
+ metadata.gz: 1f767230a21f560c346509d7c0676dd68de0324d
4
+ data.tar.gz: ea8e0a300c27f1d4395d41120f8866d54866a3c8
5
5
  SHA512:
6
- metadata.gz: 62ec5b5ac54ddf38dae995edb2a224767876d2c0279e1c96a1d7f899f8cc6cc90dae3956ed5285816b2712f67496a0219495f5f11dd79e98bd32f3d032b26691
7
- data.tar.gz: 075366d953eaabc281fe3435ab3a7c5d0a3a0c22554a3697d82cab222cff57050ca9c539d99e9eaf1e7d6adb3457358ceccaeca2579c07a799c8947779c3b5fa
6
+ metadata.gz: 5ccf898d03ad4ebaa7d3f0bf328fde06cc3d28524ca93fb3517108c2a1eadc0bc39ce079bbc578cb9327352850c7d535a38a85c4294d307c6f1dd3f6c02eb507
7
+ data.tar.gz: 60a232032d4a8fa7c72f5da8cbc7e67af151eb6ed325ad1c9c6dca63fa0df8b4f941cf8a61646739838d8e8baeffa6e353db952274b525c8237aec9d2b2e71f8
data/lib/read_ipa.rb CHANGED
@@ -58,13 +58,15 @@ module ReadIpa
58
58
  end
59
59
 
60
60
  def get_highest_res_icon(icons_file_names)
61
- highest_res_icon = icons_file_names
61
+ icon_names = icons_file_names
62
62
  .map{ |icon_path| find_existing_path(icon_path) }
63
63
  .compact
64
64
  .uniq(&:name)
65
+ highest_res_icon = icon_names
65
66
  .map{|entry| entry.get_input_stream.read}
66
67
  .max_by{|data| read_png(data).width }
67
68
 
69
+ return nil if highest_res_icon.nil?
68
70
  begin
69
71
  return ApplePng.new(highest_res_icon).data
70
72
  rescue NotValidApplePngError
@@ -73,22 +75,17 @@ module ReadIpa
73
75
  end
74
76
 
75
77
  def icon_file
76
- if plist["CFBundleIconFiles"]
77
- get_highest_res_icon(plist["CFBundleIconFiles"])
78
- elsif plist["CFBundleIcons"]
78
+ icon_files = [plist["CFBundleIconFile"]].compact
79
+ icon_files += plist["CFBundleIconFiles"] || []
80
+ if plist["CFBundleIcons"]
79
81
  dict = plist["CFBundleIcons"]
80
82
  primary_icons = dict["CFBundlePrimaryIcon"]
81
83
  return nil unless primary_icons
82
84
  icons = primary_icons.to_rb["CFBundleIconFiles"]
83
85
  return nil unless icons
84
- get_highest_res_icon(icons)
85
- elsif plist["CFBundleIconFile"]
86
- data = read_file(plist["CFBundleIconFile"])
87
- png = ApplePng.new(data)
88
- png.data
89
- else
90
- nil
86
+ icon_files += icons
91
87
  end
88
+ get_highest_res_icon(icon_files)
92
89
  end
93
90
 
94
91
  def executable_file_name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: read_ipa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marvin Killing