ipa 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 601bffa541c7faeb2631b61454d46d93f1cd6245
4
+ data.tar.gz: cc3483f6fc1ebd2f0beb8f91cd28b606cd657045
5
+ SHA512:
6
+ metadata.gz: cbff855594ad6ed3e2f6d8bebdcf81f1a3b7eb82b987cab7c3829538baf0d242d95df87750172df3652e8ef6977efe509f9f1cdf006cb0c376cfd8408400250f
7
+ data.tar.gz: 34a36839e314c6096205dd8244ed631b394588a830cc5861849d8759bce9bd2c89586eb0ec10f60137c2857d34bbb60a004675a6729060c56fa533e177e0c7b4
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  pkg/*
2
2
  *.gem
3
+ *.swo
4
+ *.swp
3
5
  .bundle
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
- source :gemcutter
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in ipa.gemspec
4
4
  gemspec
5
5
 
6
6
  gem 'rake'
7
- gem 'CFPropertyList', '~> 2.2.0'
@@ -1,22 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipa (0.1.3)
5
- CFPropertyList (~> 2.2.0)
6
- rubyzip (~> 0.9.4)
4
+ ipa (0.2.0)
5
+ CFPropertyList (~> 2.3)
6
+ rubyzip (~> 1.1)
7
7
 
8
8
  GEM
9
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
10
10
  specs:
11
- CFPropertyList (2.2.0)
12
- rake (0.9.2)
13
- rubyzip (0.9.9)
11
+ CFPropertyList (2.3.1)
12
+ rake (10.4.2)
13
+ rubyzip (1.1.7)
14
14
 
15
15
  PLATFORMS
16
16
  ruby
17
17
 
18
18
  DEPENDENCIES
19
- CFPropertyList (~> 2.2.0)
20
- bundler (>= 1.0.0)
19
+ bundler
21
20
  ipa!
22
21
  rake
22
+
23
+ BUNDLED WITH
24
+ 1.10.6
@@ -0,0 +1,6 @@
1
+ I, the copyright holder of this work, hereby release it into the public domain.
2
+ This applies worldwide.
3
+
4
+ In case this is not legally possible: I grant anyone the right to use this work
5
+ for any purpose, without any conditions, unless such conditions are required by
6
+ law.
data/Rakefile CHANGED
@@ -1,2 +1,11 @@
1
1
  require 'bundler'
2
+ require 'rake/testtask'
3
+
2
4
  Bundler::GemHelper.install_tasks
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs << 'test'
8
+ end
9
+
10
+ desc "Run tests"
11
+ task :default => :test
@@ -5,8 +5,9 @@ Gem::Specification.new do |s|
5
5
  s.name = 'ipa'
6
6
  s.version = IPA::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
- s.authors = ['Sijmen J. Mulder']
9
- s.email = ['sjmulder@gmail.com']
8
+ s.authors = ['Sijmen Mulder']
9
+ s.email = ['ik@sjmulder.nl']
10
+ s.license = 'Public Domain'
10
11
  s.homepage = 'https://github.com/sjmulder/ipa'
11
12
  s.summary = 'Reads metadata from IPA files'
12
13
  s.description = 'Reads metadata from iPhone/iPad IPA files, such as title, version, and icon files.'
@@ -14,9 +15,9 @@ Gem::Specification.new do |s|
14
15
  s.required_rubygems_version = '>= 1.3.6'
15
16
  s.rubyforge_project = 'ipa'
16
17
 
17
- s.add_dependency 'rubyzip', '~> 0.9.4'
18
- s.add_dependency 'CFPropertyList', '~> 2.2.0'
19
- s.add_development_dependency 'bundler', '>= 1.0.0'
18
+ s.add_dependency 'rubyzip', '~> 1.1'
19
+ s.add_dependency 'CFPropertyList', '~> 2.3'
20
+ s.add_development_dependency 'bundler', '~> 0'
20
21
 
21
22
  s.files = `git ls-files`.split("\n")
22
23
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
data/lib/ipa.rb CHANGED
@@ -5,15 +5,17 @@ require 'cfpropertylist'
5
5
  module IPA
6
6
  class IPAFile
7
7
  MAPPED_INFO_KEYS = {
8
- :name => 'CFBundleName',
9
- :display_name => 'CFBundleDisplayName',
10
- :identifier => 'CFBundleIdentifier',
11
- :icon_path => 'CFBundleIconFile',
12
- :icon_paths => 'CFBundleIconFiles',
13
- :is_iphone => 'LSRequiresIPhoneOS',
14
- :app_category => 'LSApplicationCategoryType',
15
- :version => 'CFBundleVersion',
16
- :version_string => 'CFBundleShortVersionString'
8
+ :name => 'CFBundleName',
9
+ :display_name => 'CFBundleDisplayName',
10
+ :identifier => 'CFBundleIdentifier',
11
+ :icon_path => 'CFBundleIconFile',
12
+ :icon_paths => 'CFBundleIconFiles',
13
+ :is_iphone => 'LSRequiresIPhoneOS',
14
+ :app_category => 'LSApplicationCategoryType',
15
+ :version => 'CFBundleVersion',
16
+ :version_string => 'CFBundleShortVersionString',
17
+ :minimum_os_version => 'MinimumOSVersion',
18
+ :device_family => 'UIDeviceFamily'
17
19
  }
18
20
 
19
21
  MAPPED_INFO_KEYS.each do |method_name, key_name|
@@ -61,15 +63,38 @@ module IPA
61
63
  @info_plist
62
64
  end
63
65
 
64
- def icon
65
- path = info &&
66
- info['CFBundleIcons'] &&
67
- info['CFBundleIcons']['CFBundlePrimaryIcon'] &&
68
- (info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFile'] ||
69
- info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].first)
70
- path ||= 'Icon.png'
71
- payload_file(path)
72
- end
66
+ # Note: The returned pngs are crushed by Apple during the ipa creation. To uncrush use:
67
+ # `xcrun -sdk iphoneos pngcrush -revert-iphone-optimizations crushed.png uncrushed.png`
68
+ def icons
69
+ paths = []
70
+ path_keys = ['CFBundleIcons', 'CFBundleIcons~ipad']
71
+ path_keys.each do |path_key|
72
+ icons = info && (info[path_key] &&
73
+ info[path_key]['CFBundlePrimaryIcon'] &&
74
+ (info[path_key]['CFBundlePrimaryIcon']['CFBundleIconFile'] ||
75
+ info[path_key]['CFBundlePrimaryIcon']['CFBundleIconFiles']))
76
+ paths.push(*icons)
77
+ end
78
+
79
+ paths << 'Icon.png' if paths.size == 0
80
+
81
+ unless paths.is_a?(Array)
82
+ paths = [paths]
83
+ end
84
+
85
+ paths = paths.map do |path|
86
+ begin
87
+ @zipfile.entries.entries.map { |e| File.basename(e.name) }.select { |name| name.start_with?(path) }
88
+ rescue Exception => e
89
+ STDERR.puts "\n\nException #{e}\n\n"
90
+ nil
91
+ end
92
+ end.flatten.compact.map do |path|
93
+ [path, Proc.new { payload_file(path) }]
94
+ end
95
+
96
+ Hash[paths]
97
+ end
73
98
 
74
99
  def artwork
75
100
  payload_file('iTunesArtwork')
@@ -1,3 +1,3 @@
1
1
  module IPA
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
Binary file
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleIdentifier</key>
6
+ <string>com.example.MockApp</string>
7
+ <key>CFBundleName</key>
8
+ <string>MockApp</string>
9
+ <key>CFBundleDisplayName</key>
10
+ <string>Mock App</string>
11
+ <key>LSRequiresIPhoneOS</key>
12
+ <true />
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,39 @@
1
+ require 'test/unit'
2
+ require 'ipa'
3
+
4
+ include IPA
5
+
6
+ class IPAFileTest < Test::Unit::TestCase
7
+ IPA_PATH = 'test/fixtures/MockApp.ipa'
8
+
9
+ def test_ctor
10
+ ipa = IPAFile.new(IPA_PATH)
11
+ assert_not_nil(ipa)
12
+ ipa.close
13
+ end
14
+
15
+ def test_open
16
+ IPAFile.open(IPA_PATH) do |ipa|
17
+ assert_not_nil(ipa)
18
+ end
19
+ end
20
+
21
+ def test_info_dict
22
+ IPAFile.open(IPA_PATH) do |ipa|
23
+ assert_equal('MockApp', ipa.info['CFBundleName'])
24
+ assert_equal('Mock App', ipa.info['CFBundleDisplayName'])
25
+ assert_equal('com.example.MockApp', ipa.info['CFBundleIdentifier'])
26
+ assert(ipa.info['LSRequiresIPhoneOS'])
27
+ end
28
+ end
29
+
30
+ def test_mapped_keys
31
+ IPAFile.open(IPA_PATH) do |ipa|
32
+ assert_equal('MockApp', ipa.name)
33
+ assert_equal('Mock App', ipa.display_name)
34
+ assert_equal('com.example.MockApp', ipa.identifier)
35
+ assert(ipa.is_iphone)
36
+ end
37
+ end
38
+ end
39
+
metadata CHANGED
@@ -1,104 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
- - Sijmen J. Mulder
7
+ - Sijmen Mulder
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-25 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rubyzip
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 0.9.4
19
+ version: '1.1'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 0.9.4
26
+ version: '1.1'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: CFPropertyList
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 2.2.0
33
+ version: '2.3'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: 2.2.0
40
+ version: '2.3'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: 1.0.0
47
+ version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 1.0.0
54
+ version: '0'
62
55
  description: Reads metadata from iPhone/iPad IPA files, such as title, version, and
63
56
  icon files.
64
57
  email:
65
- - sjmulder@gmail.com
58
+ - ik@sjmulder.nl
66
59
  executables: []
67
60
  extensions: []
68
61
  extra_rdoc_files: []
69
62
  files:
70
- - .gitignore
63
+ - ".gitignore"
71
64
  - Gemfile
72
65
  - Gemfile.lock
66
+ - Licence.txt
73
67
  - Rakefile
74
68
  - ipa.gemspec
75
69
  - lib/ipa.rb
76
70
  - lib/ipa/version.rb
71
+ - test/fixtures/MockApp.ipa
72
+ - test/fixtures/MockApp/Payload/MockApp.app/Info.plist
73
+ - test/fixtures/MockApp/Payload/MockApp.app/Info.plist.xml
74
+ - test/test_ipa.rb
77
75
  homepage: https://github.com/sjmulder/ipa
78
- licenses: []
76
+ licenses:
77
+ - Public Domain
78
+ metadata: {}
79
79
  post_install_message:
80
80
  rdoc_options: []
81
81
  require_paths:
82
82
  - lib
83
83
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
84
  requirements:
86
- - - ! '>='
85
+ - - ">="
87
86
  - !ruby/object:Gem::Version
88
87
  version: '0'
89
- segments:
90
- - 0
91
- hash: 1781569824872270545
92
88
  required_rubygems_version: !ruby/object:Gem::Requirement
93
- none: false
94
89
  requirements:
95
- - - ! '>='
90
+ - - ">="
96
91
  - !ruby/object:Gem::Version
97
92
  version: 1.3.6
98
93
  requirements: []
99
94
  rubyforge_project: ipa
100
- rubygems_version: 1.8.24
95
+ rubygems_version: 2.2.2
101
96
  signing_key:
102
- specification_version: 3
97
+ specification_version: 4
103
98
  summary: Reads metadata from IPA files
104
99
  test_files: []