motion-cocoapods 1.0.3 → 1.0.4
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/lib/motion/project/cocoapods.rb +47 -20
- metadata +7 -3
@@ -27,6 +27,7 @@ unless defined?(Motion::Project::Config)
|
|
27
27
|
end
|
28
28
|
|
29
29
|
require 'cocoapods'
|
30
|
+
require 'yaml'
|
30
31
|
|
31
32
|
module Motion::Project
|
32
33
|
class Config
|
@@ -46,7 +47,8 @@ module Motion::Project
|
|
46
47
|
end
|
47
48
|
|
48
49
|
class CocoaPods
|
49
|
-
VERSION
|
50
|
+
VERSION = '1.0.4'
|
51
|
+
PODS_ROOT = 'vendor/Pods'
|
50
52
|
|
51
53
|
def initialize(config)
|
52
54
|
@config = config
|
@@ -59,8 +61,8 @@ module Motion::Project
|
|
59
61
|
else
|
60
62
|
cp_config.silent = true
|
61
63
|
end
|
62
|
-
cp_config.rootspec = @podfile
|
63
|
-
cp_config.integrate_targets = false if
|
64
|
+
cp_config.rootspec = @podfile unless cocoapods_v06_and_higher?
|
65
|
+
cp_config.integrate_targets = false if cocoapods_v06_and_higher?
|
64
66
|
cp_config.project_root = Pathname.new(config.project_dir) + 'vendor'
|
65
67
|
end
|
66
68
|
|
@@ -79,37 +81,62 @@ module Motion::Project
|
|
79
81
|
# For now we only support one Pods target, this will have to be expanded
|
80
82
|
# once we work on more spec support.
|
81
83
|
def install!
|
82
|
-
|
84
|
+
if bridgesupport_file.exist? && pods_installer.lock_file.exist?
|
85
|
+
installed_pods_before = installed_pods
|
86
|
+
end
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
@installer.project.build_configuration("Release").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"] = @config.deployment_target
|
88
|
+
unless cocoapods_v06_and_higher?
|
89
|
+
pods_installer.project.build_configuration("Debug").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"] = @config.deployment_target
|
90
|
+
pods_installer.project.build_configuration("Release").buildSettings["IPHONEOS_DEPLOYMENT_TARGET"] = @config.deployment_target
|
88
91
|
end
|
89
92
|
|
90
|
-
|
93
|
+
pods_installer.install!
|
94
|
+
|
95
|
+
# Let RubyMotion re-generate the BridgeSupport file whenever the list of
|
96
|
+
# installed pods changes.
|
97
|
+
if bridgesupport_file.exist? && installed_pods_before && installed_pods_before != installed_pods
|
98
|
+
bridgesupport_file.delete
|
99
|
+
end
|
91
100
|
|
92
|
-
@config.vendor_project(
|
101
|
+
@config.vendor_project(PODS_ROOT, :xcode,
|
93
102
|
:target => 'Pods',
|
94
103
|
:headers_dir => 'Headers',
|
95
104
|
:products => %w{ libPods.a }
|
96
105
|
)
|
97
106
|
|
98
|
-
|
99
|
-
if target_installer.respond_to?(:definition)
|
100
|
-
target_installer.definition.name == :default
|
101
|
-
else
|
102
|
-
# CocoaPods 0.6 forward compatibility
|
103
|
-
target_installer.target_definition.name == :default
|
104
|
-
end
|
105
|
-
end.xcconfig
|
106
|
-
|
107
|
-
if ldflags = xcconfig.to_hash['OTHER_LDFLAGS']
|
107
|
+
if ldflags = pods_xcconfig.to_hash['OTHER_LDFLAGS']
|
108
108
|
@config.frameworks.concat(ldflags.scan(/-framework\s+([^\s]+)/).map { |m| m[0] })
|
109
109
|
@config.frameworks.uniq!
|
110
110
|
@config.libs.concat(ldflags.scan(/-l([^\s]+)/).map { |m| "/usr/lib/lib#{m[0]}.dylib" })
|
111
111
|
@config.libs.uniq!
|
112
112
|
end
|
113
113
|
end
|
114
|
+
|
115
|
+
def installed_pods
|
116
|
+
YAML.load(pods_installer.lock_file.read)['PODS']
|
117
|
+
end
|
118
|
+
|
119
|
+
def bridgesupport_file
|
120
|
+
Pathname.new(@config.project_dir) + PODS_ROOT + 'Pods.bridgesupport'
|
121
|
+
end
|
122
|
+
|
123
|
+
def pods_xcconfig
|
124
|
+
pods_installer.target_installers.find do |target_installer|
|
125
|
+
if cocoapods_v06_and_higher?
|
126
|
+
target_installer.target_definition.name == :default
|
127
|
+
else
|
128
|
+
target_installer.definition.name == :default
|
129
|
+
end
|
130
|
+
end.xcconfig
|
131
|
+
end
|
132
|
+
|
133
|
+
def cocoapods_v06_and_higher?
|
134
|
+
self.class.cocoapods_v06_and_higher?
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.cocoapods_v06_and_higher?
|
138
|
+
# last 0.5.x version of CP
|
139
|
+
Gem::Version.new(Pod::VERSION) > Gem::Version.new('0.5.1')
|
140
|
+
end
|
114
141
|
end
|
115
142
|
end
|
metadata
CHANGED
@@ -5,8 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
|
8
|
+
- 4
|
9
|
+
segments_generated: true
|
10
|
+
version: 1.0.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Laurent Sansonetti
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2012-
|
18
|
+
date: 2012-06-20 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,6 +27,7 @@ dependencies:
|
|
26
27
|
- 0
|
27
28
|
- 5
|
28
29
|
- 1
|
30
|
+
segments_generated: true
|
29
31
|
version: 0.5.1
|
30
32
|
requirement: *id001
|
31
33
|
name: cocoapods
|
@@ -59,6 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
61
|
- !ruby/object:Gem::Version
|
60
62
|
segments:
|
61
63
|
- 0
|
64
|
+
segments_generated: true
|
62
65
|
version: "0"
|
63
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
67
|
requirements:
|
@@ -66,6 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
69
|
- !ruby/object:Gem::Version
|
67
70
|
segments:
|
68
71
|
- 0
|
72
|
+
segments_generated: true
|
69
73
|
version: "0"
|
70
74
|
requirements: []
|
71
75
|
|