motion-objc-runtime-bundler-fix 0.0.3

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Dave Lee
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,29 @@
1
+ # motion-objc-runtime
2
+
3
+ motion-objc-runtime exposes the Objective-C runtime API. This allows
4
+ RubyMotion access building blocks necessary to provide the
5
+ metaprogramming capabilities currently lacking in RubyMotion. By
6
+ exposing the ObjC runtime, `define_method` and other metaprogramming
7
+ staples can be enabled for RubyMotion apps.
8
+
9
+ The Objective-C runtime is exposed the same way RubyMotion exposes C
10
+ functions from UIKit and other iOS frameworks, via BrideSupport files
11
+ created by the `gen_bridge_metadata` command.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your RubyMotion app's Rakefile:
16
+
17
+ require 'motion-objc-runtime'
18
+
19
+ ## Usage
20
+
21
+ See Apple's [Objective-C Runtime Reference](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html)
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,50 @@
1
+ unless defined? Motion::Project::App
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ # TODO: Find a good home for the .bridgesupport file
6
+ BRIDGESUPPORT_FILE = './objc-runtime.bridgesupport'
7
+
8
+ SDK_DIR = "Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.sdk"
9
+ OBJC_INCLUDE_DIR = 'usr/include/objc'
10
+
11
+ # TODO: Regenerate bridgesupport when relevant settings have changed
12
+ def generate_bridgesupport(config)
13
+ return BRIDGESUPPORT_FILE if File.exist? BRIDGESUPPORT_FILE
14
+
15
+ sdk = File.join(config['xcode_dir'], SDK_DIR % config['sdk_version'])
16
+ objc_include_dir = File.join(sdk, OBJC_INCLUDE_DIR)
17
+ gen_bridge_metadata = '/usr/bin/gen_bridge_metadata'
18
+ opts = '--format complete --no-64-bit'
19
+ cflags = "-I#{objc_include_dir}"
20
+ cflags << " -miphoneos-version-min=#{config['deployment_target']}"
21
+ opts << %' --cflags "#{cflags}"'
22
+ header = "#{objc_include_dir}/runtime.h"
23
+
24
+ # see man gen_bridge_metadata
25
+ `RUBYOPT='' #{gen_bridge_metadata} #{opts} #{header} > #{BRIDGESUPPORT_FILE}`
26
+ end
27
+
28
+ # Tap into App::setup to appropriately generate the Objective-C
29
+ # runtime bridgesupport file after completion of the project's setup
30
+ # block. Performing post-setup allows access to the project's config
31
+ # settings.
32
+ #
33
+ # This depends on the RubyMotion toolchain. If it changes structure,
34
+ # the technique used here will break.
35
+ class << Motion::Project::App
36
+ real_setup = instance_method(:setup).bind(Motion::Project::App)
37
+
38
+ # Define a new setup method that calls the real setup method and
39
+ # then, if necessary, generate the bridgesupport file and add it to
40
+ # the configuration.
41
+ define_method :setup do |&block|
42
+ real_setup.call(&block)
43
+ generate_bridgesupport(config.variables)
44
+ configs.each_value do |app|
45
+ unless app.bridgesupport_files.include? BRIDGESUPPORT_FILE
46
+ app.bridgesupport_files << BRIDGESUPPORT_FILE
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |gem|
3
+ gem.name = 'motion-objc-runtime-bundler-fix'
4
+ gem.description = 'Exposes Objective-C runtime in RubyMotion'
5
+ gem.homepage = "https://github.com/kastiglione/#{gem.name}"
6
+ gem.version = '0.0.3'
7
+
8
+ gem.authors = ['Dave Lee']
9
+ gem.email = ['dave@kastiglione.com']
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.require_paths = ['lib']
13
+
14
+ gem.summary = <<-END.gsub(/^ +/, '')
15
+ motion-objc-runtime exposes the Objective-C runtime API. This
16
+ allows RubyMotion access building blocks necessary to provide the
17
+ metaprogramming capabilities currently lacking in RubyMotion. By
18
+ exposing the ObjC runtime, #define_method and other
19
+ metaprogramming staples can be enabled for RubyMotion apps.
20
+ END
21
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-objc-runtime-bundler-fix
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 3
9
+ version: 0.0.3
10
+ platform: ruby
11
+ authors:
12
+ - Dave Lee
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-08-18 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Exposes Objective-C runtime in RubyMotion
22
+ email:
23
+ - dave@kastiglione.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - LICENSE
33
+ - README.md
34
+ - Rakefile
35
+ - lib/motion-objc-runtime.rb
36
+ - motion-objc-runtime.gemspec
37
+ has_rdoc: true
38
+ homepage: https://github.com/kastiglione/motion-objc-runtime-bundler-fix
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.6
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: "motion-objc-runtime exposes the Objective-C runtime API. This allows RubyMotion access building blocks necessary to provide the metaprogramming capabilities currently lacking in RubyMotion. By exposing the ObjC runtime, #define_method and other metaprogramming staples can be enabled for RubyMotion apps."
67
+ test_files: []
68
+