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

Replaced icon() with a more complete method icons() #3

Merged
merged 1 commit into from
Jan 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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