motion-cocoapods 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.rdoc +55 -0
- data/lib/motion-cocoapods.rb +25 -0
- data/lib/motion/project/cocoapods.rb +97 -0
- metadata +67 -0
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012, Laurent Sansonetti <lrz@hipbyte.com>
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
17
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
18
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
19
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
20
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
21
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
22
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
= motion-cocoapods
|
2
|
+
|
3
|
+
motion-cocoapods allows RubyMotion projects to integrate with the CocoaPods dependency manager.
|
4
|
+
|
5
|
+
== Requirements
|
6
|
+
|
7
|
+
* CocoaPods (see http://cocoapods.org).
|
8
|
+
|
9
|
+
* RubyMotion 1.0 or greater (see http://www.rubymotion.com).
|
10
|
+
|
11
|
+
== Installation
|
12
|
+
|
13
|
+
$ sudo gem install motion-cocoapods
|
14
|
+
|
15
|
+
== Setup
|
16
|
+
|
17
|
+
1. Edit the +Rakefile+ of your RubyMotion project and add the following require line.
|
18
|
+
|
19
|
+
require 'motion-cocoapods'
|
20
|
+
|
21
|
+
2. Still in the +Rakefile+, set your dependencies using the same language as you would do in Podfiles.
|
22
|
+
|
23
|
+
Motion::Project::App.setup do |app|
|
24
|
+
# ...
|
25
|
+
app.pods do
|
26
|
+
dependency 'JSONKit'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
That's all. The build system will properly download the given pods and their dependencies, build them and link them to your application executable.
|
31
|
+
|
32
|
+
== License
|
33
|
+
|
34
|
+
Copyright (c) 2012, Laurent Sansonetti <lrz@hipbyte.com>
|
35
|
+
All rights reserved.
|
36
|
+
|
37
|
+
Redistribution and use in source and binary forms, with or without
|
38
|
+
modification, are permitted provided that the following conditions are met:
|
39
|
+
|
40
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
41
|
+
list of conditions and the following disclaimer.
|
42
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
43
|
+
this list of conditions and the following disclaimer in the documentation
|
44
|
+
and/or other materials provided with the distribution.
|
45
|
+
|
46
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
47
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
48
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
49
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
50
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
51
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
52
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
53
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
54
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
55
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (c) 2012, Laurent Sansonetti <lrz@hipbyte.com>
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer in the documentation
|
11
|
+
# and/or other materials provided with the distribution.
|
12
|
+
#
|
13
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
14
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
15
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
16
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
17
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
18
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
19
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
20
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
21
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
22
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
23
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
|
25
|
+
require 'motion/project/cocoapods'
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Copyright (c) 2012, Laurent Sansonetti <lrz@hipbyte.com>
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer in the documentation
|
11
|
+
# and/or other materials provided with the distribution.
|
12
|
+
#
|
13
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
14
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
15
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
16
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
17
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
18
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
19
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
20
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
21
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
22
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
23
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
|
25
|
+
unless defined?(Motion::Project::Config)
|
26
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'cocoapods'
|
30
|
+
|
31
|
+
class CocoaPodsConfig
|
32
|
+
def initialize(config)
|
33
|
+
@config = config
|
34
|
+
@podfile = Pod::Podfile.new {}
|
35
|
+
@podfile.platform :ios
|
36
|
+
|
37
|
+
Pod::Config.instance.silent = true
|
38
|
+
Pod::Config.instance.instance_variable_set(:@project_pods_root, Pathname.new(File.join(config.project_dir, 'vendor')))
|
39
|
+
end
|
40
|
+
|
41
|
+
def dependency(*name_and_version_requirements, &block)
|
42
|
+
@podfile.dependency(*name_and_version_requirements, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def resolve!
|
46
|
+
installer = Pod::Installer.new(@podfile)
|
47
|
+
installer.install_dependencies!
|
48
|
+
specs = installer.build_specifications
|
49
|
+
header_paths = specs.map do |podspec|
|
50
|
+
podspec.expanded_source_files.select do |p|
|
51
|
+
File.extname(p) == '.h'
|
52
|
+
end.map do |p|
|
53
|
+
"-I\"" + File.expand_path(File.join('./vendor', File.dirname(p))) + "\""
|
54
|
+
end
|
55
|
+
end.flatten.join(' ')
|
56
|
+
specs.each do |podspec|
|
57
|
+
cflags = (podspec.compiler_flags or '') + ' ' + header_paths
|
58
|
+
source_files = podspec.expanded_source_files.map do |path|
|
59
|
+
# Remove the first part of the path which is the project directory.
|
60
|
+
path.to_s.split('/')[1..-1].join('/')
|
61
|
+
end
|
62
|
+
|
63
|
+
@config.vendor_project(podspec.pod_destroot, :static,
|
64
|
+
:cflags => cflags,
|
65
|
+
:source_files => source_files)
|
66
|
+
|
67
|
+
ldflags = podspec.xcconfig.to_hash['OTHER_LDFLAGS']
|
68
|
+
if ldflags
|
69
|
+
@config.frameworks += (ldflags.scan(/-framework\s+([^\s]+)/)[0] or [])
|
70
|
+
@config.libs += (ldflags.scan(/-l([^\s]+)/)[0] or []).map { |n| "/usr/lib/lib#{n}.dylib" }
|
71
|
+
end
|
72
|
+
|
73
|
+
=begin
|
74
|
+
# Remove .h files that are not covered in the podspec, to avoid
|
75
|
+
# future preprocessor #include collisions.
|
76
|
+
headers_to_ignore = (Dir.chdir(podspec.pod_destroot) do
|
77
|
+
Dir.glob('*/**/*.h')
|
78
|
+
end) - source_files.select { |p| File.extname(p) == '.h' }
|
79
|
+
p headers_to_ignore,source_files.select { |p| File.extname(p) == '.h' } ,:ok
|
80
|
+
#headers_to_ignore.each { |p| FileUtils.rm_rf File.join(podspec.pod_destroot, p) }
|
81
|
+
=end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
module Motion; module Project; class Config
|
87
|
+
variable :pods
|
88
|
+
|
89
|
+
def pods(&block)
|
90
|
+
@pods ||= CocoaPodsConfig.new(self)
|
91
|
+
if block
|
92
|
+
@pods.instance_eval(&block)
|
93
|
+
@pods.resolve!
|
94
|
+
end
|
95
|
+
@pods
|
96
|
+
end
|
97
|
+
end; end; end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-cocoapods
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: "1.0"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Laurent Sansonetti
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2012-05-03 00:00:00 Z
|
18
|
+
dependencies: []
|
19
|
+
|
20
|
+
description: motion-cocoapods allows RubyMotion projects to have access to the CocoaPods dependency manager.
|
21
|
+
email: lrz@hipbyte.com
|
22
|
+
executables: []
|
23
|
+
|
24
|
+
extensions: []
|
25
|
+
|
26
|
+
extra_rdoc_files: []
|
27
|
+
|
28
|
+
files:
|
29
|
+
- README.rdoc
|
30
|
+
- LICENSE
|
31
|
+
- lib/motion/project/cocoapods.rb
|
32
|
+
- lib/motion-cocoapods.rb
|
33
|
+
homepage: http://www.rubymotion.com
|
34
|
+
licenses: []
|
35
|
+
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.8.21
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: CocoaPods integration for RubyMotion projects
|
66
|
+
test_files: []
|
67
|
+
|