ipa-parser 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/bin/pngcrush +0 -0
- data/ipa-parser.gemspec +26 -0
- data/lib/ipa-parser/version.rb +3 -0
- data/lib/ipa-parser.rb +89 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ed686f4924c31562fc5bea3c07f13f9581afa8c2
|
4
|
+
data.tar.gz: 9cea8903b5fce639d155c1692d627bcd1469c4b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 66b96d1cb0f12d0b53ebdbe623b555df51286eb888d8c39dc312cd2abbbdd5fece70b3a146230cb604e93bb925fdc8d068cbbdbf2fd47cc3a1de870f87a42a92
|
7
|
+
data.tar.gz: 16bb40b28c07f46416abded3490bd8a34e6be131c0fb08505fb163a9a918125eb1ce23d60e55145194a61bbee6e6fd48949525e8e5432faf7f22e5f20e5153df
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.DS_Store
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 astro2linus
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# IpaParser
|
2
|
+
|
3
|
+
Extract information from a ipa file
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'ipa-parser'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ipa-parser
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
ipa_file = IpaParser::IpaFile.new(/path/to/your/ipa_file)
|
22
|
+
|
23
|
+
ipa_file.name
|
24
|
+
|
25
|
+
ipa_file.display_name
|
26
|
+
|
27
|
+
ipa_file.identifier
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it ( https://github.com/[my-github-username]/ipa-parser/fork )
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/pngcrush
ADDED
Binary file
|
data/ipa-parser.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ipa-parser/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ipa-parser"
|
8
|
+
spec.version = IpaParser::VERSION
|
9
|
+
spec.authors = ["astro2linus"]
|
10
|
+
spec.email = ["astro2linus@gmail.com"]
|
11
|
+
spec.summary = %q{Extract information from a iPA file}
|
12
|
+
spec.description = %q{Extract information from a iPA file}
|
13
|
+
spec.homepage = "http://rubygems.org/gems/ipa-parser"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'CFPropertyList', '~> 2.2.0'
|
22
|
+
spec.add_dependency 'rubyzip', '~> 1.1.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
data/lib/ipa-parser.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require "ipa-parser/version"
|
2
|
+
require 'cfpropertylist'
|
3
|
+
require 'zip'
|
4
|
+
|
5
|
+
module IpaParser
|
6
|
+
class IpaFile
|
7
|
+
|
8
|
+
MAPPED_INFO_KEYS = {
|
9
|
+
name: 'CFBundleName',
|
10
|
+
display_name: 'CFBundleDisplayName',
|
11
|
+
identifier: 'CFBundleIdentifier',
|
12
|
+
supported_platforms: 'CFBundleSupportedPlatforms',
|
13
|
+
min_os_version: 'MinimumOSVersion',
|
14
|
+
is_iphone: 'LSRequiresIPhoneOS',
|
15
|
+
version: 'CFBundleVersion'
|
16
|
+
}
|
17
|
+
|
18
|
+
MAPPED_INFO_KEYS.each do |key, orig_key|
|
19
|
+
define_method key do
|
20
|
+
info[orig_key]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(ipa_file)
|
25
|
+
@ipa_file = Zip::File.open(ipa_file)
|
26
|
+
end
|
27
|
+
|
28
|
+
def info
|
29
|
+
@ipa_file.each do |entry|
|
30
|
+
if entry.name.match(/Payload\/(.)*\.app\/Info.plist/)
|
31
|
+
@plist_path = entry.name
|
32
|
+
@plist_bin = entry.get_input_stream.read
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
plist = CFPropertyList::List.new(:data => @plist_bin)
|
37
|
+
data = CFPropertyList.native_types(plist.value)
|
38
|
+
end
|
39
|
+
|
40
|
+
def icons
|
41
|
+
matched_entries = []
|
42
|
+
icon_file_names.each do |file_name|
|
43
|
+
@ipa_file.each do |entry|
|
44
|
+
if entry.name.match(/Payload\/(.)*\.app\/#{file_name}(.)*.png/)
|
45
|
+
matched_entries << @ipa_file.read(entry.name)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
matched_entries
|
50
|
+
end
|
51
|
+
|
52
|
+
# normally the last icon has the highest resolution
|
53
|
+
# icons in the ipa file are crushed, cannot display in browsers other than Safari
|
54
|
+
def crushed_icon
|
55
|
+
icons.last
|
56
|
+
end
|
57
|
+
|
58
|
+
def icon_file_names
|
59
|
+
begin
|
60
|
+
# icon names may or may not include '.png', so remove .png suffix for consistence
|
61
|
+
info["CFBundleIcons"]["CFBundlePrimaryIcon"]["CFBundleIconFiles"].map { |f| File::basename(f, '.png' ) }
|
62
|
+
rescue NoMethodError => e
|
63
|
+
[]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def icon
|
68
|
+
if crushed_icon
|
69
|
+
crushed_file = Tempfile.new('crushed_icon.png')
|
70
|
+
uncrushed_file = Tempfile.new('uncrushed_icon.png')
|
71
|
+
begin
|
72
|
+
crushed_file.write(crushed_icon)
|
73
|
+
png_bin = File.expand_path("../../bin/pngcrush", __FILE__)
|
74
|
+
cmd = "#{png_bin} -revert-iphone-optimizations "
|
75
|
+
cmd << crushed_file.path + " " + uncrushed_file.path
|
76
|
+
`#{cmd}`
|
77
|
+
@data = uncrushed_file.read
|
78
|
+
ensure
|
79
|
+
crushed_file.close
|
80
|
+
uncrushed_file.close
|
81
|
+
crushed_file.unlink
|
82
|
+
uncrushed_file.unlink
|
83
|
+
end
|
84
|
+
end
|
85
|
+
@data
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ipa-parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- astro2linus
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: CFPropertyList
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubyzip
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Extract information from a iPA file
|
70
|
+
email:
|
71
|
+
- astro2linus@gmail.com
|
72
|
+
executables:
|
73
|
+
- pngcrush
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/pngcrush
|
83
|
+
- ipa-parser.gemspec
|
84
|
+
- lib/ipa-parser.rb
|
85
|
+
- lib/ipa-parser/version.rb
|
86
|
+
homepage: http://rubygems.org/gems/ipa-parser
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.2.2
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Extract information from a iPA file
|
110
|
+
test_files: []
|