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

Minor improvements #6

Merged
merged 4 commits into from
Sep 30, 2015
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions ipa.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Gem::Specification.new do |s|
s.required_rubygems_version = '>= 1.3.6'
s.rubyforge_project = 'ipa'

s.add_dependency 'rubyzip', '~> 1.1'
s.add_dependency 'rubyzip', '~> 1.1'
s.add_dependency 'zip-zip', '~> 0.3'
s.add_dependency 'CFPropertyList', '~> 2.2.0'
s.add_development_dependency 'bundler', '>= 1.0.0'
s.add_runtime_dependency 'CFPropertyList', '~> 2.2', '>= 2.2.0'
s.add_development_dependency 'bundler', '~> 1.0', '>= 1.0.0'

s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
Expand Down
23 changes: 16 additions & 7 deletions lib/ipa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class IPAFile
:is_iphone => 'LSRequiresIPhoneOS',
:app_category => 'LSApplicationCategoryType',
:version => 'CFBundleVersion',
:version_string => 'CFBundleShortVersionString'
:version_string => 'CFBundleShortVersionString',
:minimum_os_version => 'MinimumOSVersion',
:device_family => 'UIDeviceFamily',
}

MAPPED_INFO_KEYS.each do |method_name, key_name|
Expand Down Expand Up @@ -61,13 +63,20 @@ def info
@info_plist
end

# Note: The returned pngs are crushed by Apple during the ipa creation. To uncrush use:
# `xcrun -sdk iphoneos pngcrush -revert-iphone-optimizations crushed.png uncrushed.png`
def icons
paths = info &&
info['CFBundleIcons'] &&
info['CFBundleIcons']['CFBundlePrimaryIcon'] &&
(info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFile'] ||
info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'])
paths ||= 'Icon.png'
paths = []
path_keys = ['CFBundleIcons', 'CFBundleIcons~ipad']
path_keys.each do |path_key|
icons = info && (info[path_key] &&
info[path_key]['CFBundlePrimaryIcon'] &&
(info[path_key]['CFBundlePrimaryIcon']['CFBundleIconFile'] ||
info[path_key]['CFBundlePrimaryIcon']['CFBundleIconFiles']))
paths.push(*icons)
end

paths << 'Icon.png' if paths.size == 0

unless paths.is_a?(Array)
paths = [paths]
Expand Down