appcrush 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/appcrush +94 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c08eda7fad0f8355727e39ef234c12da8e21b5dd
4
+ data.tar.gz: 6d9cc9d81cad5a1f77373f68a04e71700b0c1150
5
+ SHA512:
6
+ metadata.gz: 3f0a3ca520d0538e848544f2452057560440a822a65ee68341104e77f71d1370967527b6ed0b7140f0fa2bd0d1dc71b65be4ce7b2e9967541cab62352676af4d
7
+ data.tar.gz: 13f32c396794b4d2347d11addc0518b045f5275e9497e1dab7165f0b78b9dea7185b68a065d3e09bcf257b3a4db0a15ae8c3e79c7491276ad69e3fb9d6a802db
data/bin/appcrush ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/ruby -rubygems
2
+
3
+ # Point appcrush at an .ipa file from the iTunes AppStore and it
4
+ # - expands the zip file
5
+ # - finds all the images
6
+ # - runs pngcrush with the revert-iphone-optimizations option on each image
7
+ #
8
+ # Requirements Xcode with iOS SDK 3.2 or higher
9
+ #
10
+ # Usage: appcrush '/Users/boctor/Music/iTunes/Mobile Applications/iBooks.ipa'
11
+ #
12
+ # Credit:
13
+ # Author: Peter Boctor
14
+ # http://idevrecipes.com
15
+ # https://github.com/boctor/idev-recipes/Utilities/appcrush
16
+ # Version 1.0
17
+ #
18
+ # Copyright (c) 2011 Peter Boctor
19
+ #
20
+ # Author: Zachary Friedman (kulte)
21
+ # https://github.com/kulte/appcrush
22
+ # Version 1.0
23
+ #
24
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
25
+ # of this software and associated documentation files (the "Software"), to deal
26
+ # in the Software without restriction, including without limitation the rights
27
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
+ # copies of the Software, and to permit persons to whom the Software is
29
+ # furnished to do so, subject to the following conditions:
30
+ #
31
+ # The above copyright notice and this permission notice shall be included in
32
+ # all copies or substantial portions of the Software.
33
+ #
34
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
40
+ # THE SOFTWARE
41
+ #
42
+
43
+ # Only pngcrush in 3.2 and above supports revert-iphone-optimizations
44
+ # See http://developer.apple.com/library/ios/#qa/qa2010/qa1681.html
45
+ # Modify original appcrush script written by Peter Boctor to account for the new
46
+ # location of the developer tools
47
+ developer_root = "`xcode-select --print-path`".chop
48
+ pngcrush = "#{developer_root}/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush"
49
+
50
+ if ARGV.empty?
51
+ puts "Usage: ./appcrush path/to/ipa"
52
+ exit
53
+ end
54
+
55
+ destination = File.join(ENV['HOME'], 'Desktop')
56
+
57
+ ARGV.each do |ipa|
58
+ if File.extname(ipa) == '.ipa'
59
+ # Get the app name by stripping out the extension from the file name
60
+ app_name = File.basename(ipa, ".*")
61
+
62
+ # Get the expanded dir by stripping out the extension from the file path
63
+ expanded_dir = ipa.sub(File.extname(ipa), '')
64
+
65
+ # In case the dir is already there, try and remove it
66
+ system "rm -drf '#{expanded_dir}'"
67
+
68
+ # Extract .ipa zip file
69
+ system "unzip -q '#{ipa}' -d '#{expanded_dir}'"
70
+
71
+ images_dir_path = File.join(destination, "#{app_name} Images")
72
+
73
+ # In case the destination directory is already there, try and remove it
74
+ system "rm -drf '#{images_dir_path}'"
75
+
76
+ # Create the destination directory
77
+ Dir.mkdir(images_dir_path)
78
+
79
+ # Iterate through all png images
80
+ Dir.glob(File.join(expanded_dir, 'Payload', "*.app", '*.png')).each do |png_file|
81
+ # and revert the iphone optimizations
82
+ system "#{pngcrush} -q -revert-iphone-optimizations -d '#{images_dir_path}' '#{png_file}'"
83
+ end
84
+
85
+ # Iterate through all jpg images
86
+ Dir.glob(File.join(expanded_dir, 'Payload', "*.app", '*.jpg')).each do |jpg_file|
87
+ # and move each to the destination directory
88
+ system "mv '#{jpg_file}' '#{images_dir_path}'"
89
+ end
90
+
91
+ # Cleanup. Delete the expanded dir
92
+ system "rm -drf '#{expanded_dir}'"
93
+ end
94
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appcrush
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Peter Boctor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Gemified version of the original appcrush script written by Peter Boctor
14
+ to run unzip and extract images from an IPA package.
15
+ email: hello@robinchou.com
16
+ executables:
17
+ - appcrush
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/appcrush
22
+ homepage: http://rubygems.org/gems/appcrush
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.6
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: The popular AppCrush as a rubygem!
46
+ test_files: []