private-dumper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ #gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ end
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.8.7)
10
+ rcov (0.9.9)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.0.0)
17
+ jeweler (~> 1.5.2)
18
+ rcov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Johannes Fahrenkrug
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ = Private Dumper
2
+
3
+ A Ruby class-dump wrapper to create header files from private iOS frameworks
4
+
5
+ == About
6
+
7
+ Private Dumper is a tool to simplify the use of class-dump (http://www.codethecode.com/projects/class-dump/) to create header files from all private iOS frameworks so you can use them in your app (yes, yes, I know you can't put them on the AppStore then).
8
+
9
+ Usage:
10
+ private-dumper <iOS SDK version> <path to headers output directory>
11
+
12
+ Please provide both the iOS SDK version you want to dump (for example 4.2) and the path to the output directory.
13
+ Example: private-dumper 4.2 ~/Headers
14
+
15
+ in 2011 by Johannes Fahrenkrug
16
+ inspired by Erica Sadun's DumpFrameworks Perl script.
17
+
18
+ == Using private APIs in your Xcode project
19
+
20
+ This is how you can actually use private APIs in your app (mostly taken from this article by Aral Balkan: http://aralbalkan.com/2106):
21
+
22
+ 1. Run Private Dumper.
23
+ 2. Create a new Xcode Project.
24
+ 3. In Xcode, right-click the Frameworks folder, select "Add" -> "Existing Frameworks".
25
+ 4. Navigate to and then select the private framework(s) you want to include, for example "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/PrivateFrameworks/AccountSettings.framework". Beware, however, that you'll have to change to the actual device's SDK if you are running your app on the device and not in the simulator.
26
+ 5. Add the corresponding dumped header files for the private SDK you want to use to your Xcode project (drag & drop, for example).
27
+ 6. Possibly tweak the import statements in those header files a bit.
28
+ 7. Go to "Project" -> "Edit Project Settings", click on the Build tab, and scroll down to the Linking section. For the Other Linker Flags property, enter
29
+ -force_flat_namespace
30
+ and
31
+ -undefined suppress
32
+ 8. Finally include the dumped header files in your application's classes and use their private methods.
33
+ 9. Build & Run & Marvel
34
+
35
+ == Contributing to private-dumper
36
+
37
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
38
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
39
+ * Fork the project
40
+ * Start a feature/bugfix branch
41
+ * Commit and push until you are happy with your contribution
42
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
43
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
44
+
45
+ == Copyright
46
+
47
+ Copyright (c) 2011 Johannes Fahrenkrug. See LICENSE.txt for
48
+ further details.
49
+
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "private-dumper"
16
+ gem.homepage = "http://github.com/jfahrenkrug/private-dumper"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{A Ruby class-dump wrapper to create header files from private iOS frameworks}
19
+ gem.description = %Q{The private iOS iPhone and iPad frameworks are full of wonderful goodies that are just waiting to be discovered. The fantastic class-dump tool lets you peek into those frameworks and generates the header files that you need to use them in your project. Private Dumper greatly simplifies the process of dumping the header files of all private frameworks for a given SDK version.}
20
+ gem.email = "johannes@springenwerk.com"
21
+ gem.authors = ["Johannes Fahrenkrug"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "private-dumper #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'private-dumper.rb'
4
+
5
+ exit PrivateDumper::Application.run!(*ARGV)
6
+
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'private-dumper'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,83 @@
1
+ # 4 December 2011
2
+ # Framework Dumping utility; requires class-dump
3
+ # Inspired by Erica Sadun's DumpFrameworks perl script
4
+ #
5
+ # by Johannes Fahrenkrug, springenwerk.com
6
+
7
+ # This command must be in your path.
8
+ # http://www.codethecode.com/projects/class-dump/
9
+
10
+ module PrivateDumper
11
+ module Application
12
+
13
+ CLASS_DUMP = 'class-dump'
14
+
15
+ def self.run!(*args)
16
+
17
+ if args.size < 2
18
+ puts "Usage: "
19
+ puts "private-dumper <iOS SDK version> <path to headers output directory>"
20
+ puts
21
+ puts "Please provide both the iOS SDK version you want to dump (for example 4.2) and the path to the output directory."
22
+ puts "Example: private-dumper 4.2 ~/Headers"
23
+ puts
24
+ puts "NOTE: You need to have class-dump (http://www.codethecode.com/projects/class-dump/) installed and in your $PATH!"
25
+ return -1
26
+ end
27
+
28
+ sdk_version = args[0]
29
+
30
+ sdk_path = "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{sdk_version}.sdk/System/Library/"
31
+
32
+ if !File.exists?(sdk_path)
33
+ puts "The directory #{sdk_path} does not exist. Did you possibly provide an invalid SDK version?"
34
+ return -2
35
+ end
36
+
37
+ headers_path = args[1]
38
+
39
+ if !File.exists?(headers_path)
40
+ # we will try to create it...
41
+ Dir.mkdir(File.expand_path(headers_path))
42
+ end
43
+
44
+
45
+ if !File.exists?(headers_path)
46
+ puts "The output directory #{headers_path} does not exist and could not be created."
47
+ return -3
48
+ end
49
+
50
+ ["#{sdk_path}Frameworks", "#{sdk_path}PrivateFrameworks"].each do |frmwk_path|
51
+ puts frmwk_path
52
+
53
+ Dir["#{frmwk_path}/**/*.framework"].sort.each do |frmwk|
54
+ frmwk_name = File.basename(frmwk, '.*')
55
+ puts "Framework: #{frmwk_name}"
56
+ cmd = "#{CLASS_DUMP} -H -o #{headers_path}/#{frmwk_name} -s -S #{frmwk}"
57
+
58
+ if !system(cmd)
59
+ puts "Command #{cmd} failed with exit code #{$?.exitstatus}"
60
+ end
61
+ end
62
+ end
63
+
64
+ # Remove unnecessary imports
65
+ puts "Removing unnecessary imports..."
66
+ Dir["#{headers_path}/**/*.h"].each do |header|
67
+ # Read...
68
+ lines = []
69
+ File.open(header, 'r') do |header_file|
70
+ header_file.each_line do |line|
71
+ lines << line unless line =~ /#import "NSObject\.h"/
72
+ end
73
+ end
74
+
75
+ # Write...
76
+ File.open(header, 'w') {|header_file| header_file.puts lines.join("\n")}
77
+ end
78
+ puts "Done."
79
+ return 0
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{private-dumper}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Johannes Fahrenkrug"]
12
+ s.date = %q{2011-01-04}
13
+ s.default_executable = %q{private-dumper}
14
+ s.description = %q{The private iOS iPhone and iPad frameworks are full of wonderful goodies that are just waiting to be discovered. The fantastic class-dump tool lets you peek into those frameworks and generates the header files that you need to use them in your project. Private Dumper greatly simplifies the process of dumping the header files of all private frameworks for a given SDK version.}
15
+ s.email = %q{johannes@springenwerk.com}
16
+ s.executables = ["private-dumper"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "bin/private-dumper",
30
+ "helper.rb",
31
+ "lib/private-dumper.rb",
32
+ "private-dumper.gemspec",
33
+ "test_private-dumper.rb"
34
+ ]
35
+ s.homepage = %q{http://github.com/jfahrenkrug/private-dumper}
36
+ s.licenses = ["MIT"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.4.1}
39
+ s.summary = %q{A Ruby class-dump wrapper to create header files from private iOS frameworks}
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
46
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
47
+ s.add_development_dependency(%q<rcov>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
51
+ s.add_dependency(%q<rcov>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
56
+ s.add_dependency(%q<rcov>, [">= 0"])
57
+ end
58
+ end
59
+
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestPrivateDumper < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: private-dumper
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Johannes Fahrenkrug
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-04 00:00:00 -08:00
19
+ default_executable: private-dumper
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ name: bundler
24
+ type: :development
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ hash: 23
31
+ segments:
32
+ - 1
33
+ - 0
34
+ - 0
35
+ version: 1.0.0
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ name: jeweler
40
+ type: :development
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ hash: 7
47
+ segments:
48
+ - 1
49
+ - 5
50
+ - 2
51
+ version: 1.5.2
52
+ requirement: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ prerelease: false
55
+ name: rcov
56
+ type: :development
57
+ version_requirements: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirement: *id003
67
+ description: The private iOS iPhone and iPad frameworks are full of wonderful goodies that are just waiting to be discovered. The fantastic class-dump tool lets you peek into those frameworks and generates the header files that you need to use them in your project. Private Dumper greatly simplifies the process of dumping the header files of all private frameworks for a given SDK version.
68
+ email: johannes@springenwerk.com
69
+ executables:
70
+ - private-dumper
71
+ extensions: []
72
+
73
+ extra_rdoc_files:
74
+ - LICENSE.txt
75
+ - README.rdoc
76
+ files:
77
+ - .document
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - LICENSE.txt
81
+ - README.rdoc
82
+ - Rakefile
83
+ - VERSION
84
+ - bin/private-dumper
85
+ - helper.rb
86
+ - lib/private-dumper.rb
87
+ - private-dumper.gemspec
88
+ - test_private-dumper.rb
89
+ has_rdoc: true
90
+ homepage: http://github.com/jfahrenkrug/private-dumper
91
+ licenses:
92
+ - MIT
93
+ post_install_message:
94
+ rdoc_options: []
95
+
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ requirements: []
117
+
118
+ rubyforge_project:
119
+ rubygems_version: 1.4.1
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: A Ruby class-dump wrapper to create header files from private iOS frameworks
123
+ test_files: []
124
+