motion-cocoapods 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7147eae504d4b985fa39b1664c329ab1a8597e5d
4
- data.tar.gz: c7c4632e7f67fe09a364db80d773ec800028a4df
3
+ metadata.gz: 35460145e8bb31279e20fde2db7ec5b3757d3ddb
4
+ data.tar.gz: f0f50eb4bcef6fe747e279dccc068a513907334f
5
5
  SHA512:
6
- metadata.gz: 424ac2cd2e7279f340e97749c4d823941668643cee78e92cef6552548524ce156f0789507274593538db93990d51bb1177a839b2a406ca2261fdaf96902a5a6e
7
- data.tar.gz: 0d356e066388ad2325191c52cb04f4bf9f95e8ef723dff83ca5c1a947e394508f645e8b2bd655317356153b38d65dff9db620b58f7a3cc8897cc99d7df770a05
6
+ metadata.gz: 9bd98db8e107aadc86c3968887e1a354cb62180e5c7be107f333f5165e3118ae4ae39f4129310ee8f507921558254381ae5383447c58117c986ef427db5978a8
7
+ data.tar.gz: 3124becb9828db0004cea2d9929dc51a2c7f57e12e4a441817bbce79a7c19de462b4027f0f1384f46123833ef7594a0d7847ef0b17b90a22147163db81fb1e6a
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # motion-cocoapods
2
2
 
3
+ [![Build Status](https://travis-ci.org/HipByte/motion-cocoapods.svg?branch=master)](https://travis-ci.org/HipByte/motion-cocoapods) [![Gem Version](https://badge.fury.io/rb/motion-cocoapods.svg)](https://badge.fury.io/rb/motion-cocoapods)
4
+
3
5
  motion-cocoapods allows RubyMotion projects to integrate with the
4
6
  [CocoaPods](https://cocoapods.org/) dependency manager.
5
7
 
@@ -39,6 +41,18 @@ gem 'motion-cocoapods'
39
41
  end
40
42
  ```
41
43
 
44
+ You can use `use_frameworks!` to install pods as frameworks (**NOTE** This feature requires RubyMotion 4.18+).
45
+
46
+ ```ruby
47
+ Motion::Project::App.setup do |app|
48
+ # ...
49
+ app.pods do
50
+ use_frameworks!
51
+ pod 'AFNetworking'
52
+ end
53
+ end
54
+ ```
55
+
42
56
  3. If this is the first time using CocoaPods on your machine, you'll need to
43
57
  let CocoaPods do some setup work with the following command:
44
58
 
@@ -91,14 +105,6 @@ would like to see the output, you can set the `COCOAPODS_VERBOSE` env variable:
91
105
  $ [bundle exec] rake pod:install COCOAPODS_VERBOSE=1
92
106
  ```
93
107
 
94
- As part of the install and update tasks, the specification repostories will get
95
- updated. You can disable this with the `COCOAPODS_NO_REPO_UPDATE` env variable:
96
-
97
- ```
98
- $ [bundle exec] rake pod:install COCOAPODS_NO_REPO_UPDATE=1
99
- ```
100
-
101
-
102
108
  ## Contribute
103
109
 
104
110
  1. Setup a local development environment.
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # Copyright (c) 2012-2014, Laurent Sansonetti <lrz@hipbyte.com>
2
3
  # All rights reserved.
3
4
  #
@@ -28,7 +29,6 @@ end
28
29
 
29
30
  require 'xcodeproj'
30
31
  require 'cocoapods'
31
- require 'yaml'
32
32
 
33
33
  module Motion::Project
34
34
  class Config
@@ -39,6 +39,7 @@ module Motion::Project
39
39
  if block
40
40
  @pods.instance_eval(&block)
41
41
  end
42
+ @pods.configure_project
42
43
  @pods
43
44
  end
44
45
  end
@@ -51,6 +52,15 @@ module Motion::Project
51
52
  exit 1
52
53
  end
53
54
  build_without_cocoapods(platform, opts)
55
+
56
+ # Install the resource which will be generated after built
57
+ installed_resources = App.config.pods.install_resources
58
+ unless installed_resources.empty?
59
+ app_resources_dir = config.app_resources_dir(platform)
60
+ installed_resources.each do |path|
61
+ App.builder.copy_resource(path.to_s, File.join(app_resources_dir, path.basename.to_s))
62
+ end
63
+ end
54
64
  end
55
65
 
56
66
  alias_method "build_without_cocoapods", "build"
@@ -70,6 +80,7 @@ module Motion::Project
70
80
  def initialize(config, vendor_options)
71
81
  @config = config
72
82
  @vendor_options = vendor_options
83
+ @use_frameworks = false
73
84
 
74
85
  case @config.deploy_platform
75
86
  when 'MacOSX'
@@ -93,144 +104,91 @@ module Motion::Project
93
104
  if cp_config.verbose = !!ENV['COCOAPODS_VERBOSE']
94
105
  require 'claide'
95
106
  end
96
-
97
- configure_project
98
107
  end
99
108
 
100
109
  # Adds the Pods project to the RubyMotion config as a vendored project and
101
110
  #
102
111
  def configure_project
103
- @config.resources_dirs << resources_dir.to_s
104
-
105
- # TODO replace this all once Xcodeproj has the proper xcconfig parser.
106
112
  if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS']
107
- lib_search_path_flags = xcconfig['LIBRARY_SEARCH_PATHS'] || ""
108
- lib_search_paths = []
109
- lib_search_path_flags = lib_search_path_flags.split(/\s/).map do |path|
110
- if path =~ /(\$\(inherited\))|(\$\{inherited\})|(\$CONFIGURATION_BUILD_DIR)|(\$PODS_CONFIGURATION_BUILD_DIR)/
111
- nil
112
- else
113
- path = path.gsub(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, File.join(@config.project_dir, PODS_ROOT))
114
- lib_search_paths << path.gsub('"', '')
115
- '-L ' << path
116
- end
117
- end.compact.join(' ')
118
-
119
- # Get the name of all static libraries that come pre-built with pods
120
- pre_built_static_libs = lib_search_paths.map do |path|
121
- Dir[File.join(path, '**/*.a')].map { |f| File.basename(f) }
122
- end.flatten
113
+ @config.resources_dirs << resources_dir.to_s
123
114
 
124
- # Collect the Pod products
125
- pods_libs = []
126
-
127
- @config.libs.concat(ldflags.scan(/-l"?([^\s"]+)"?/).map { |m|
128
- lib_name = m[0]
129
- next if lib_name.nil?
130
- if lib_name.start_with?('Pods-')
131
- # For CocoaPods 0.37.x or below. This block is marked as deprecated.
132
- pods_libs << lib_name
133
- nil
134
- elsif pre_built_static_libs.include?("lib#{lib_name}.a")
135
- "#{lib_search_path_flags} -ObjC -l#{lib_name}"
136
- elsif File.exist?("/usr/lib/lib#{lib_name}.dylib")
137
- "/usr/lib/lib#{lib_name}.dylib"
138
- else
139
- pods_libs << lib_name
140
- nil
141
- end
142
- }.compact)
143
- @config.libs.uniq!
115
+ frameworks = installed_frameworks[:pre_built]
116
+ if frameworks
117
+ @config.embedded_frameworks += frameworks
118
+ @config.embedded_frameworks.uniq!
119
+ end
144
120
 
145
- framework_search_paths = []
146
- if search_paths = xcconfig['FRAMEWORK_SEARCH_PATHS']
147
- search_paths = search_paths.strip
148
- unless search_paths.empty?
149
- search_paths.scan(/"([^"]+)"/) do |search_path|
150
- path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
151
- framework_search_paths << path if path
152
- end
153
- # If we couldn't parse any search paths, then presumably nothing was properly quoted, so
154
- # fallback to just assuming the whole value is one path.
155
- if framework_search_paths.empty?
156
- path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
157
- framework_search_paths << path if path
158
- end
159
- end
121
+ if @use_frameworks
122
+ configure_project_frameworks
123
+ else
124
+ configure_project_static_libraries
160
125
  end
126
+ end
127
+ end
161
128
 
162
- header_dirs = ['Headers/Public']
129
+ def configure_project_frameworks
130
+ if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS']
131
+ # Add libraries to @config.libs
132
+ pods_libraries
163
133
 
164
- # We want to set the proper header search paths otherwise we might generate incorrect bridgesupport
165
- header_search_paths = []
166
- if search_paths = xcconfig['HEADER_SEARCH_PATHS']
167
- search_paths = search_paths.strip
168
- unless search_paths.empty?
169
- search_paths.scan(/"([^"]+)"/) do |search_path|
170
- path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
171
- header_search_paths << File.expand_path(path) if path
172
- end
173
- # If we couldn't parse any search paths, then presumably nothing was properly quoted, so
174
- # fallback to just assuming the whole value is one path.
175
- if header_search_paths.empty?
176
- path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
177
- header_search_paths << File.expand_path(path) if path
178
- end
179
- end
134
+ frameworks = ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |m| m[0] }
135
+ if build_frameworks = installed_frameworks[:build]
136
+ build_frameworks = build_frameworks.map { |path| File.basename(path, ".framework") }
137
+ frameworks.delete_if { |f| build_frameworks.include?(f) }
180
138
  end
181
- header_search_paths = header_search_paths.map { |p| "-I'#{p}'" }.join(' ')
182
- # Initialize ':bridgesupport_cflags', in case the use
139
+ static_frameworks = pods_frameworks(frameworks)
140
+ static_frameworks_paths = static_frameworks_paths(static_frameworks)
141
+ search_path = static_frameworks_paths.inject("") { |s, path|
142
+ s += " -I'#{path}' -I'#{path}/Headers'"
143
+ }
183
144
  @vendor_options[:bridgesupport_cflags] ||= ''
184
- @vendor_options[:bridgesupport_cflags] << " #{header_search_paths}"
145
+ @vendor_options[:bridgesupport_cflags] << " #{header_search_path} #{framework_search_path} #{search_path}"
185
146
 
186
- frameworks = ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |m| m[0] }
147
+ @config.weak_frameworks.concat(ldflags.scan(/-weak_framework\s+([^\s]+)/).map { |m| m[0] })
148
+ @config.weak_frameworks.uniq!
187
149
 
188
- case @config.deploy_platform
189
- when 'MacOSX'
190
- @config.framework_search_paths.concat(framework_search_paths)
191
- @config.framework_search_paths.uniq!
192
- framework_search_paths.each do |framework_search_path|
193
- frameworks.reject! do |framework|
194
- path = File.join(framework_search_path, "#{framework}.framework")
195
- if File.exist?(path)
196
- @config.embedded_frameworks << path
197
- true
198
- else
199
- false
200
- end
201
- end
202
- end
203
- when 'iPhoneOS', 'AppleTVOS', 'WatchOS'
204
- pods_root = cp_config.installation_root + 'Pods'
205
- # If we would really specify these as ‘frameworks’ then the linker
206
- # would not link the archive into the application, because it does not
207
- # see any references to any of the symbols in the archive. Treating it
208
- # as a static library (which it is) with `-ObjC` fixes this.
209
- #
210
- framework_search_paths.each do |framework_search_path|
211
- frameworks.reject! do |framework|
212
- path = File.join(framework_search_path, "#{framework}.framework")
213
- if File.exist?(path)
214
- @config.libs << "-ObjC '#{File.join(path, framework)}'"
215
- true
216
- else
217
- false
218
- end
219
- end
150
+ vendors = @config.vendor_project(PODS_ROOT, :xcode, {
151
+ :target => "Pods-#{TARGET_NAME}",
152
+ :products => build_frameworks.map { |name| "#{name}.framework" },
153
+ :allow_empty_products => build_frameworks.empty?,
154
+ }.merge(@vendor_options))
155
+
156
+ vendor = vendors.last
157
+ if vendor.respond_to?(:build_bridgesupport)
158
+ static_frameworks_paths.each do |path|
159
+ path = File.expand_path(path)
160
+ bs_file = File.join(Builder.common_build_dir, "#{path}.bridgesupport")
161
+ headers = Dir.glob(File.join(path, '**{,/*/**}/*.h'))
162
+ @config.vendor_project(PODS_ROOT, :bridgesupport, {
163
+ :bs_file => bs_file,
164
+ :headers => headers,
165
+ }.merge(@vendor_options))
220
166
  end
221
167
  end
168
+ end
169
+ end
170
+
171
+ def configure_project_static_libraries
172
+ # TODO replace this all once Xcodeproj has the proper xcconfig parser.
173
+ if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS']
174
+ # Collect the Pod products
175
+ pods_libs = pods_libraries
222
176
 
223
- @config.frameworks.concat(frameworks)
224
- @config.frameworks.uniq!
177
+ # Initialize ':bridgesupport_cflags', in case the use
178
+ @vendor_options[:bridgesupport_cflags] ||= ''
179
+ @vendor_options[:bridgesupport_cflags] << " #{header_search_path} #{framework_search_path}"
180
+
181
+ frameworks = ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |m| m[0] }
182
+ pods_frameworks(frameworks)
225
183
 
226
184
  @config.weak_frameworks.concat(ldflags.scan(/-weak_framework\s+([^\s]+)/).map { |m| m[0] })
227
185
  @config.weak_frameworks.uniq!
228
186
 
229
187
  @config.vendor_project(PODS_ROOT, :xcode, {
230
188
  :target => "Pods-#{TARGET_NAME}",
231
- :headers_dir => "{#{header_dirs.join(',')}}",
189
+ :headers_dir => "Headers/Public",
232
190
  :products => pods_libs.map { |lib_name| "lib#{lib_name}.a" },
233
- :allow_empty_products => (pods_libs.empty? ? true : false),
191
+ :allow_empty_products => pods_libs.empty?,
234
192
  }.merge(@vendor_options))
235
193
  end
236
194
  end
@@ -255,6 +213,11 @@ module Motion::Project
255
213
  @podfile.post_install(&block)
256
214
  end
257
215
 
216
+ def use_frameworks!(flag = true)
217
+ @use_frameworks = flag
218
+ @podfile.use_frameworks!(flag)
219
+ end
220
+
258
221
  # Installation
259
222
  #-------------------------------------------------------------------------#
260
223
 
@@ -271,6 +234,8 @@ module Motion::Project
271
234
  # installed pods changes.
272
235
  #
273
236
  def install!(update)
237
+ FileUtils.rm_rf(resources_dir)
238
+
274
239
  pods_installer.update = update
275
240
  pods_installer.installation_options.integrate_targets = false
276
241
  pods_installer.install!
@@ -281,17 +246,24 @@ module Motion::Project
281
246
  # TODO this probably breaks in cases like resource bundles etc, need to test.
282
247
  #
283
248
  def install_resources
284
- FileUtils.rm_rf(resources_dir)
285
249
  FileUtils.mkdir_p(resources_dir)
250
+
251
+ installed_resources = []
286
252
  resources.each do |file|
287
253
  begin
288
- FileUtils.cp_r(file, resources_dir) if file.exist?
254
+ dst = resources_dir + file.basename
255
+ if file.exist? && !dst.exist?
256
+ FileUtils.cp_r(file, resources_dir)
257
+ installed_resources << dst
258
+ end
289
259
  rescue ArgumentError => exc
290
260
  unless exc.message =~ /same file/
291
261
  raise
292
262
  end
293
263
  end
294
264
  end
265
+
266
+ installed_resources
295
267
  end
296
268
 
297
269
  PUBLIC_HEADERS_ROOT = File.join(PODS_ROOT, 'Headers/Public')
@@ -331,8 +303,11 @@ module Motion::Project
331
303
  end
332
304
 
333
305
  def pods_xcconfig
334
- path = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}.release.xcconfig"
335
- Xcodeproj::Config.new(path) if path.exist?
306
+ @pods_xcconfig ||= begin
307
+ path = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}.release.xcconfig"
308
+ Xcodeproj::Config.new(path) if path.exist?
309
+ end
310
+ @pods_xcconfig
336
311
  end
337
312
 
338
313
  def pods_xcconfig_hash
@@ -341,6 +316,185 @@ module Motion::Project
341
316
  end
342
317
  end
343
318
 
319
+ def pods_libraries
320
+ xcconfig = pods_xcconfig_hash
321
+ ldflags = xcconfig['OTHER_LDFLAGS']
322
+
323
+ # Get the name of all static libraries that come pre-built with pods
324
+ pre_built_static_libs = lib_search_paths.map do |path|
325
+ Dir[File.join(path, '**/*.a')].map { |f| File.basename(f) }
326
+ end.flatten
327
+
328
+ pods_libs = []
329
+ @config.libs.concat(ldflags.scan(/-l"?([^\s"]+)"?/).map { |m|
330
+ lib_name = m[0]
331
+ next if lib_name.nil?
332
+ if lib_name.start_with?('Pods-')
333
+ # For CocoaPods 0.37.x or below. This block is marked as deprecated.
334
+ pods_libs << lib_name
335
+ nil
336
+ elsif pre_built_static_libs.include?("lib#{lib_name}.a")
337
+ "#{lib_search_path_flags} -ObjC -l#{lib_name}"
338
+ elsif File.exist?("/usr/lib/lib#{lib_name}.dylib")
339
+ "/usr/lib/lib#{lib_name}.dylib"
340
+ else
341
+ pods_libs << lib_name
342
+ nil
343
+ end
344
+ }.compact)
345
+ @config.libs.uniq!
346
+
347
+ pods_libs
348
+ end
349
+
350
+ def pods_frameworks(frameworks)
351
+ frameworks = frameworks.dup
352
+ if installed_frameworks[:pre_built]
353
+ installed_frameworks[:pre_built].each do |pre_built|
354
+ frameworks.delete(File.basename(pre_built, ".framework"))
355
+ end
356
+ end
357
+
358
+ static_frameworks = []
359
+ case @config.deploy_platform
360
+ when 'MacOSX'
361
+ @config.framework_search_paths.concat(framework_search_paths)
362
+ @config.framework_search_paths.uniq!
363
+ framework_search_paths.each do |framework_search_path|
364
+ frameworks.reject! do |framework|
365
+ path = File.join(framework_search_path, "#{framework}.framework")
366
+ if File.exist?(path)
367
+ @config.embedded_frameworks << path
368
+ @config.embedded_frameworks.uniq!
369
+ true
370
+ else
371
+ false
372
+ end
373
+ end
374
+ end
375
+ when 'iPhoneOS', 'AppleTVOS', 'WatchOS'
376
+ # If we would really specify these as ‘frameworks’ then the linker
377
+ # would not link the archive into the application, because it does not
378
+ # see any references to any of the symbols in the archive. Treating it
379
+ # as a static library (which it is) with `-ObjC` fixes this.
380
+ #
381
+ framework_search_paths.each do |framework_search_path|
382
+ frameworks.reject! do |framework|
383
+ path = File.join(framework_search_path, "#{framework}.framework")
384
+ if File.exist?(path)
385
+ @config.libs << "-ObjC '#{File.join(path, framework)}'"
386
+ @config.libs.uniq!
387
+ static_frameworks << framework
388
+ true
389
+ else
390
+ false
391
+ end
392
+ end
393
+ end
394
+ end
395
+
396
+ @config.frameworks.concat(frameworks)
397
+ @config.frameworks.uniq!
398
+
399
+ static_frameworks
400
+ end
401
+
402
+ def lib_search_path_flags
403
+ lib_search_paths
404
+ @lib_search_path_flags
405
+ end
406
+
407
+ def lib_search_paths
408
+ @lib_search_paths ||= begin
409
+ xcconfig = pods_xcconfig_hash
410
+ @lib_search_path_flags = xcconfig['LIBRARY_SEARCH_PATHS'] || ""
411
+
412
+ paths = []
413
+ @lib_search_path_flags = @lib_search_path_flags.split(/\s/).map do |path|
414
+ if path =~ /(\$\(inherited\))|(\$\{inherited\})|(\$CONFIGURATION_BUILD_DIR)|(\$PODS_CONFIGURATION_BUILD_DIR)/
415
+ nil
416
+ else
417
+ path = path.gsub(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, File.join(@config.project_dir, PODS_ROOT))
418
+ paths << path.gsub('"', '')
419
+ end
420
+ end.compact.join(' ')
421
+ paths
422
+ end
423
+
424
+ @lib_search_paths
425
+ end
426
+
427
+ def framework_search_paths
428
+ @framework_search_paths ||= begin
429
+ xcconfig = pods_xcconfig_hash
430
+
431
+ paths = []
432
+ if search_paths = xcconfig['FRAMEWORK_SEARCH_PATHS']
433
+ search_paths = search_paths.strip
434
+ unless search_paths.empty?
435
+ search_paths.scan(/"([^"]+)"/) do |search_path|
436
+ path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
437
+ paths << path if path
438
+ end
439
+ # If we couldn't parse any search paths, then presumably nothing was properly quoted, so
440
+ # fallback to just assuming the whole value is one path.
441
+ if paths.empty?
442
+ path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
443
+ paths << path if path
444
+ end
445
+ end
446
+ end
447
+ paths
448
+ end
449
+
450
+ @framework_search_paths
451
+ end
452
+
453
+ def framework_search_path
454
+ framework_search_paths.map { |p| "-F'#{File.expand_path(File.join(p, '..'))}'" }.join(' ')
455
+ end
456
+
457
+ def header_search_paths
458
+ @header_search_paths ||= begin
459
+ xcconfig = pods_xcconfig_hash
460
+
461
+ paths = []
462
+ if search_paths = xcconfig['HEADER_SEARCH_PATHS']
463
+ search_paths = search_paths.strip
464
+ unless search_paths.empty?
465
+ search_paths.scan(/"([^"]+)"/) do |search_path|
466
+ path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
467
+ paths << File.expand_path(path) if path
468
+ end
469
+ # If we couldn't parse any search paths, then presumably nothing was properly quoted, so
470
+ # fallback to just assuming the whole value is one path.
471
+ if paths.empty?
472
+ path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
473
+ paths << File.expand_path(path) if path
474
+ end
475
+ end
476
+ end
477
+ paths
478
+ end
479
+
480
+ @header_search_paths
481
+ end
482
+
483
+ def header_search_path
484
+ header_search_paths.map { |p| "-I'#{p}'" }.join(' ')
485
+ end
486
+
487
+ def static_frameworks_paths(frameworks)
488
+ paths = []
489
+ framework_search_paths.each do |framework_search_path|
490
+ paths += Dir.glob("#{framework_search_path}/*.framework")
491
+ end
492
+ paths.keep_if { |path|
493
+ frameworks.include?(File.basename(path, ".framework"))
494
+ }
495
+ paths
496
+ end
497
+
344
498
  # Do not copy `.framework` bundles, these should be handled through RM's
345
499
  # `embedded_frameworks` config attribute.
346
500
  #
@@ -350,7 +504,9 @@ module Motion::Project
350
504
  f.each_line do |line|
351
505
  if matched = line.match(/install_resource\s+(.*)/)
352
506
  path = (matched[1].strip)[1..-2]
353
- path.sub!("${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}", ".build")
507
+ if path.include?("$PODS_CONFIGURATION_BUILD_DIR")
508
+ path = File.join(".build", File.basename(path))
509
+ end
354
510
  unless File.extname(path) == '.framework'
355
511
  resources << Pathname.new(@config.project_dir) + PODS_ROOT + path
356
512
  end
@@ -363,12 +519,42 @@ module Motion::Project
363
519
  def resources_dir
364
520
  Pathname.new(@config.project_dir) + PODS_ROOT + 'Resources'
365
521
  end
522
+
523
+ def installed_frameworks
524
+ return @installed_frameworks if @installed_frameworks
525
+
526
+ @installed_frameworks = {}
527
+ path = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}-frameworks.sh"
528
+ return @installed_frameworks unless path.exist?
529
+
530
+ @installed_frameworks[:pre_built] = []
531
+ @installed_frameworks[:build] = []
532
+
533
+ File.open(path) { |f|
534
+ f.each_line do |line|
535
+ if matched = line.match(/install_framework\s+(.*)/)
536
+ path = (matched[1].strip)[1..-2]
537
+ if path.include?('${PODS_ROOT}')
538
+ path = path.sub('${PODS_ROOT}', PODS_ROOT)
539
+ @installed_frameworks[:pre_built] << File.join(@config.project_dir, path)
540
+ @installed_frameworks[:pre_built].uniq!
541
+ elsif path.include?('$BUILT_PRODUCTS_DIR')
542
+ path = path.sub('$BUILT_PRODUCTS_DIR', "#{PODS_ROOT}/.build")
543
+ @installed_frameworks[:build] << File.join(@config.project_dir, path)
544
+ @installed_frameworks[:build].uniq!
545
+ end
546
+ end
547
+ end
548
+ }
549
+ @installed_frameworks
550
+ end
551
+
366
552
  end
367
553
  end
368
554
 
369
555
  namespace :pod do
370
556
  task :update_spec_repos do
371
- $stderr.puts '[!] If you need to update CocoaPods repogitory to install newer libraries, please run "pod repo update" command before.'
557
+ $stderr.puts '[!] If you need to update CocoaPods repository to install newer libraries, please run "pod repo update" command before.'
372
558
  end
373
559
 
374
560
  desc "Download and integrate newly added pods"
@@ -24,6 +24,6 @@
24
24
 
25
25
  module Motion::Project
26
26
  class CocoaPods
27
- VERSION = '1.8.1'
27
+ VERSION = '1.9.0'
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Sansonetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-19 00:00:00.000000000 Z
11
+ date: 2017-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -38,7 +38,7 @@ files:
38
38
  - lib/motion/project/version.rb
39
39
  homepage: http://www.rubymotion.com
40
40
  licenses:
41
- - MIT
41
+ - BSD-2-Clause
42
42
  metadata: {}
43
43
  post_install_message:
44
44
  rdoc_options: []
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.4.5.1
59
+ rubygems_version: 2.6.11
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: CocoaPods integration for RubyMotion projects