motion-cocoapods 1.0 → 1.0.1
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/README.rdoc +16 -0
- data/lib/motion/project/cocoapods.rb +66 -56
- metadata +28 -13
data/README.rdoc
CHANGED
@@ -29,6 +29,22 @@ motion-cocoapods allows RubyMotion projects to integrate with the CocoaPods depe
|
|
29
29
|
|
30
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
31
|
|
32
|
+
|
33
|
+
== Contribute
|
34
|
+
|
35
|
+
1. Setup a local development environment.
|
36
|
+
|
37
|
+
$ git clone git://github.com/HipByte/motion-cocoapods.git
|
38
|
+
$ cd motion-cocoapods
|
39
|
+
$ rake bootstrap
|
40
|
+
|
41
|
+
2. Verify that all the tests are passing.
|
42
|
+
|
43
|
+
$ rake spec
|
44
|
+
|
45
|
+
3. Create your patch and send a pull-request[http://help.github.com/send-pull-requests/].
|
46
|
+
|
47
|
+
|
32
48
|
== License
|
33
49
|
|
34
50
|
Copyright (c) 2012, Laurent Sansonetti <lrz@hipbyte.com>
|
@@ -28,70 +28,80 @@ end
|
|
28
28
|
|
29
29
|
require 'cocoapods'
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@podfile = Pod::Podfile.new {}
|
35
|
-
@podfile.platform :ios
|
31
|
+
module Motion::Project
|
32
|
+
class Config
|
33
|
+
variable :pods
|
36
34
|
|
37
|
-
|
38
|
-
|
35
|
+
def pods(&block)
|
36
|
+
@pods ||= Motion::Project::CocoaPods.new(self)
|
37
|
+
if block
|
38
|
+
@pods.instance_eval(&block)
|
39
|
+
@pods.resolve!
|
40
|
+
end
|
41
|
+
@pods
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
end
|
45
|
+
class CocoaPods
|
46
|
+
VERSION = '1.0.1'
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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)
|
48
|
+
def initialize(config)
|
49
|
+
@config = config
|
50
|
+
@podfile = Pod::Podfile.new {}
|
51
|
+
@podfile.platform :ios
|
66
52
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
53
|
+
Pod::Config.instance.silent = true
|
54
|
+
Pod::Config.instance.rootspec = @podfile
|
55
|
+
Pod::Config.instance.instance_variable_set(:@project_pods_root, Pathname.new(File.join(config.project_dir, 'vendor')))
|
56
|
+
end
|
72
57
|
|
73
|
-
|
74
|
-
|
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
|
58
|
+
def dependency(*name_and_version_requirements, &block)
|
59
|
+
@podfile.dependency(*name_and_version_requirements, &block)
|
82
60
|
end
|
83
|
-
end
|
84
|
-
end
|
85
61
|
|
86
|
-
|
87
|
-
|
62
|
+
def pods_installer
|
63
|
+
@installer ||= Pod::Installer.new(@podfile)
|
64
|
+
end
|
65
|
+
|
66
|
+
def resolve!
|
67
|
+
pods_installer.install_dependencies!
|
68
|
+
specs = pods_installer.build_specifications
|
69
|
+
header_paths = specs.map do |podspec|
|
70
|
+
podspec.expanded_source_files.select do |p|
|
71
|
+
File.extname(p) == '.h'
|
72
|
+
end.map do |p|
|
73
|
+
"-I\"" + File.expand_path(File.join('./vendor', File.dirname(p))) + "\""
|
74
|
+
end
|
75
|
+
end.flatten.join(' ')
|
76
|
+
specs.each do |podspec|
|
77
|
+
cflags = (podspec.compiler_flags or '') + ' ' + header_paths
|
78
|
+
source_files = podspec.expanded_source_files.map do |path|
|
79
|
+
# Remove the first part of the path which is the project directory.
|
80
|
+
path.to_s.split('/')[1..-1].join('/')
|
81
|
+
end
|
82
|
+
|
83
|
+
@config.vendor_project(podspec.pod_destroot, :static,
|
84
|
+
:cflags => cflags,
|
85
|
+
:source_files => source_files)
|
86
|
+
|
87
|
+
ldflags = podspec.xcconfig.to_hash['OTHER_LDFLAGS']
|
88
|
+
if ldflags
|
89
|
+
@config.frameworks.concat(ldflags.scan(/-framework\s+([^\s]+)/).map { |m| m[0] })
|
90
|
+
@config.frameworks.uniq!
|
91
|
+
@config.libs.concat(ldflags.scan(/-l([^\s]+)/).map { |m| "/usr/lib/lib#{m[0]}.dylib" })
|
92
|
+
@config.libs.uniq!
|
93
|
+
end
|
88
94
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
95
|
+
=begin
|
96
|
+
# Remove .h files that are not covered in the podspec, to avoid
|
97
|
+
# future preprocessor #include collisions.
|
98
|
+
headers_to_ignore = (Dir.chdir(podspec.pod_destroot) do
|
99
|
+
Dir.glob('*/**/*.h')
|
100
|
+
end) - source_files.select { |p| File.extname(p) == '.h' }
|
101
|
+
p headers_to_ignore,source_files.select { |p| File.extname(p) == '.h' } ,:ok
|
102
|
+
#headers_to_ignore.each { |p| FileUtils.rm_rf File.join(podspec.pod_destroot, p) }
|
103
|
+
=end
|
104
|
+
end
|
94
105
|
end
|
95
|
-
@pods
|
96
106
|
end
|
97
|
-
end
|
107
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-cocoapods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 0
|
9
|
-
|
8
|
+
- 1
|
9
|
+
segments_generated: true
|
10
|
+
version: 1.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Laurent Sansonetti
|
@@ -14,9 +15,24 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2012-05-
|
18
|
-
|
19
|
-
|
18
|
+
date: 2012-05-07 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
segments:
|
27
|
+
- 0
|
28
|
+
- 5
|
29
|
+
- 1
|
30
|
+
segments_generated: true
|
31
|
+
version: 0.5.1
|
32
|
+
requirement: *id001
|
33
|
+
name: cocoapods
|
34
|
+
prerelease: false
|
35
|
+
type: :runtime
|
20
36
|
description: motion-cocoapods allows RubyMotion projects to have access to the CocoaPods dependency manager.
|
21
37
|
email: lrz@hipbyte.com
|
22
38
|
executables: []
|
@@ -26,10 +42,11 @@ extensions: []
|
|
26
42
|
extra_rdoc_files: []
|
27
43
|
|
28
44
|
files:
|
29
|
-
- README.rdoc
|
30
|
-
- LICENSE
|
31
45
|
- lib/motion/project/cocoapods.rb
|
32
46
|
- lib/motion-cocoapods.rb
|
47
|
+
- README.rdoc
|
48
|
+
- LICENSE
|
49
|
+
has_rdoc: true
|
33
50
|
homepage: http://www.rubymotion.com
|
34
51
|
licenses: []
|
35
52
|
|
@@ -39,27 +56,25 @@ rdoc_options: []
|
|
39
56
|
require_paths:
|
40
57
|
- lib
|
41
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
59
|
requirements:
|
44
60
|
- - ">="
|
45
61
|
- !ruby/object:Gem::Version
|
46
|
-
hash: 3
|
47
62
|
segments:
|
48
63
|
- 0
|
64
|
+
segments_generated: true
|
49
65
|
version: "0"
|
50
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
67
|
requirements:
|
53
68
|
- - ">="
|
54
69
|
- !ruby/object:Gem::Version
|
55
|
-
hash: 3
|
56
70
|
segments:
|
57
71
|
- 0
|
72
|
+
segments_generated: true
|
58
73
|
version: "0"
|
59
74
|
requirements: []
|
60
75
|
|
61
76
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.3.6
|
63
78
|
signing_key:
|
64
79
|
specification_version: 3
|
65
80
|
summary: CocoaPods integration for RubyMotion projects
|