read_ipa 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/read_ipa.rb +12 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc3b6e33d57cd5c349914d1bb11c9cb9fc0c749b
4
- data.tar.gz: 0ff85cca8e86f3a917fb09839e99d4b32304ccbb
3
+ metadata.gz: a2a7646019ea6e7252423c51d1547fcced1825b1
4
+ data.tar.gz: 7b994e0ad60aa6de7f31af351af733409f563a9c
5
5
  SHA512:
6
- metadata.gz: 77f355d8a9acedbcc7ce6f0c2a148f7e26b6cdb27b6aa1847314e052907279922d0a2eb2bdfadfe0896973387e499c4a98c293c1e6e8d01b2f7e83a1379f7a36
7
- data.tar.gz: b3262b4e494801b29ba5b4931036f1aefc8c90eea79864a390988b9cd53a4bfa5e45f900e68730f4e93c2c65da76314fe7bcf11769d8342220d1dab9f0ad074f
6
+ metadata.gz: 62ec5b5ac54ddf38dae995edb2a224767876d2c0279e1c96a1d7f899f8cc6cc90dae3956ed5285816b2712f67496a0219495f5f11dd79e98bd32f3d032b26691
7
+ data.tar.gz: 075366d953eaabc281fe3435ab3a7c5d0a3a0c22554a3697d82cab222cff57050ca9c539d99e9eaf1e7d6adb3457358ceccaeca2579c07a799c8947779c3b5fa
data/lib/read_ipa.rb CHANGED
@@ -57,10 +57,12 @@ module ReadIpa
57
57
  end
58
58
  end
59
59
 
60
- def get_highest_res_icon(icons_array)
61
- highest_res_icon = icons_array
62
- .map{ |icon_path| icon_path.downcase.end_with?('.png') ? icon_path : icon_path + '.png' }
63
- .map{ |icon_path| read_file(icon_path) }
60
+ def get_highest_res_icon(icons_file_names)
61
+ highest_res_icon = icons_file_names
62
+ .map{ |icon_path| find_existing_path(icon_path) }
63
+ .compact
64
+ .uniq(&:name)
65
+ .map{|entry| entry.get_input_stream.read}
64
66
  .max_by{|data| read_png(data).width }
65
67
 
66
68
  begin
@@ -122,6 +124,12 @@ module ReadIpa
122
124
  return false
123
125
  end
124
126
 
127
+ def find_existing_path(icon_path)
128
+ without_extension = icon_path.gsub(/\.png$/i, '')
129
+ regex = /#{Regexp.quote(@app_folder)}#{Regexp.quote(without_extension)}[(\.png)@~]/
130
+ @zipfile.entries.find{|e| e.name =~ regex}
131
+ end
132
+
125
133
  private
126
134
 
127
135
  def read_file(entry)
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.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marvin Killing