Skip to content
This repository has been archived by the owner on Mar 14, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3 from bastienleonard/master
Browse files Browse the repository at this point in the history
Replaced icon() with a more complete method icons()
  • Loading branch information
sjmulder committed Jan 8, 2014
2 parents d92087d + f08b6de commit 4326573
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions lib/ipa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,31 @@ def info
@info_plist
end

def icon
path = info &&
info['CFBundleIcons'] &&
info['CFBundleIcons']['CFBundlePrimaryIcon'] &&
(info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFile'] ||
info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].first)
path ||= 'Icon.png'
payload_file(path)
end
def icons
paths = info &&
info['CFBundleIcons'] &&
info['CFBundleIcons']['CFBundlePrimaryIcon'] &&
(info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFile'] ||
info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'])
paths ||= 'Icon.png'

unless paths.is_a?(Array)
paths = [paths]
end

paths = paths.map do |path|
begin
@zipfile.entries.entries.map { |e| File.basename(e.name) }.select { |name| name.start_with?(path) }
rescue Exception => e
STDERR.puts "\n\nException #{e}\n\n"
nil
end
end.flatten.compact.map do |path|
[path, Proc.new { payload_file(path) }]
end

Hash[paths]
end

def artwork
payload_file('iTunesArtwork')
Expand Down

0 comments on commit 4326573

Please sign in to comment.