motion-pods 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ada6ff4d269e04e5ef9bd2ede61b10232aeabec
4
+ data.tar.gz: 3bbd3158532a32ad3dadc55715e0d27c334f0ed4
5
+ SHA512:
6
+ metadata.gz: 77f2c28c6ef48cd0589456b58f4b3721506483279f550db6fafbae44f6e8d16a36da3d83b6f3b286023611d1541a863a7f04374473ceff4d61f76818a0d65271
7
+ data.tar.gz: 3c5ee632d125711e0ad98b89b6489dfbc7f4ad35cf70c1664a43c2e1523657a7efef095d7fb34a1c036592d0e937fcf18441ff7cdedbe3339580677e1148c0e6
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012-2015, HipByte (lrz@hipbyte.com) and contributors.
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.
@@ -0,0 +1,148 @@
1
+ # motion-pods
2
+ [![Gem](https://img.shields.io/gem/v/motion-pods.svg)](https://rubygems.org/gems/motion-pods)
3
+ [![Build Status](https://img.shields.io/travis/jbender/motion-pods.svg)](https://travis-ci.org/jbender/motion-pods)
4
+ [![Code Climate](https://img.shields.io/codeclimate/github/jbender/motion-pods.svg)](https://codeclimate.com/github/jbender/motion-pods)
5
+
6
+ A fork of [motion-cocoapods](https://github.com/HipByte/motion-cocoapods), motion-pods allows RubyMotion projects to integrate with the
7
+ [CocoaPods](https://cocoapods.org/) dependency manager.
8
+
9
+
10
+ ## Installation
11
+
12
+ ```
13
+ $ [sudo] gem install motion-pods
14
+ ```
15
+
16
+ Or if you use Bundler:
17
+
18
+ ```ruby
19
+ gem 'motion-pods'
20
+ ```
21
+
22
+
23
+ ## Setup
24
+
25
+ 1. Edit the `Rakefile` of your RubyMotion project and add the following require
26
+ line:
27
+
28
+ ```ruby
29
+ require 'rubygems'
30
+ require 'motion-pods'
31
+ ```
32
+
33
+ 2. Still in the `Rakefile`, set your dependencies using the same language as
34
+ you would do in [Podfiles](https://guides.cocoapods.org/syntax/podfile.html).
35
+
36
+ ```ruby
37
+ Motion::Project::App.setup do |app|
38
+ # ...
39
+ app.pods do
40
+ pod 'AFNetworking'
41
+ end
42
+ end
43
+ ```
44
+
45
+ 3. If this is the first time using CocoaPods on your machine, you'll need to
46
+ let CocoaPods do some setup work with the following command:
47
+
48
+ ```
49
+ $ [bundle exec] pod setup
50
+ ```
51
+
52
+
53
+ ## Tasks
54
+
55
+ To tell motion-pods to download your dependencies, run the following rake
56
+ task:
57
+
58
+ ```
59
+ $ [bundle exec] rake pod:install
60
+ ```
61
+
62
+ That’s all. The build system will properly download the given pods and their
63
+ dependencies. On the next build of your application it will pod the pods and
64
+ link them to your application executable.
65
+
66
+ If the `vendor/Podfile.lock` file exists, this will be used to install specific
67
+ versions. To update the versions, use the following rake task:
68
+
69
+ ```
70
+ $ [bundle exec] rake pod:update
71
+ ```
72
+
73
+ ## Options
74
+
75
+ If necessary, you can pass `vendor_project` options to the `pods` configuration
76
+ method. These options are described [here](http://www.rubymotion.com/developer-center/guides/project-management/#_vendoring_3rd_party_libraries).
77
+ For instance, to only generate BridgeSupport metadata for a single pod, which
78
+ might be needed if a dependency that you’re not using directly is causing issues
79
+ (such as C++ headers), you can specify that like so:
80
+
81
+ ```ruby
82
+ Motion::Project::App.setup do |app|
83
+ app.pods :headers_dir => 'Headers/AFNetworking' do
84
+ pod 'AFNetworking'
85
+ # ...
86
+ end
87
+ end
88
+ ```
89
+
90
+ By default the output of CocoaPods doing its work is silenced. If, however, you
91
+ would like to see the output, you can set the `COCOAPODS_VERBOSE` env variable:
92
+
93
+ ```
94
+ $ [bundle exec] rake pod:install COCOAPODS_VERBOSE=1
95
+ ```
96
+
97
+ As part of the install and update tasks, the specification repostories will get
98
+ updated. You can disable this with the `COCOAPODS_NO_REPO_UPDATE` env variable:
99
+
100
+ ```
101
+ $ [bundle exec] rake pod:install COCOAPODS_NO_REPO_UPDATE=1
102
+ ```
103
+
104
+
105
+ ## Contribute
106
+
107
+ 1. Setup a local development environment.
108
+
109
+ ```
110
+ $ git clone git://github.com/jbender/motion-pods.git
111
+ $ cd motion-pods
112
+ $ [bundle exec] rake bootstrap
113
+ ```
114
+
115
+ 2. Verify that all the tests are passing.
116
+
117
+ ```
118
+ $ [bundle exec] rake spec
119
+ ```
120
+
121
+ 3. Create your patch and send a
122
+ [pull-request](https://help.github.com/send-pull-requests/).
123
+
124
+
125
+ ## License
126
+
127
+ Copyright (c) 2012-2015, HipByte (lrz@hipbyte.com) and contributors.
128
+ All rights reserved.
129
+
130
+ Redistribution and use in source and binary forms, with or without
131
+ modification, are permitted provided that the following conditions are met:
132
+
133
+ 1. Redistributions of source code must retain the above copyright notice, this
134
+ list of conditions and the following disclaimer.
135
+ 2. Redistributions in binary form must reproduce the above copyright notice,
136
+ this list of conditions and the following disclaimer in the documentation
137
+ and/or other materials provided with the distribution.
138
+
139
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
140
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
141
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
142
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
143
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
144
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
145
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
146
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
147
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
148
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,40 @@
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
+ # External dependencies
30
+ require 'xcodeproj'
31
+ require 'cocoapods'
32
+ require 'yaml'
33
+
34
+ # Gem files
35
+ require 'motion/pods/version'
36
+ require 'motion/pods/main'
37
+ require 'tasks/pod'
38
+
39
+ # Monkeypatch Motion::Project to add CocoaPod methods
40
+ require 'motion/project/monkeypatches'
@@ -0,0 +1,404 @@
1
+ # Copyright (c) 2012-2014, 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
+ module Motion
26
+ class CocoaPods
27
+ PODS_ROOT = 'vendor/Pods'
28
+ TARGET_NAME = 'RubyMotion'
29
+ PUBLIC_HEADERS_ROOT = File.join(PODS_ROOT, 'Headers/Public')
30
+ PODS_ROOT_MATCHER = /(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/
31
+ SUPPORT_FILES = File.join(PODS_ROOT, "Target Support Files/Pods-#{TARGET_NAME}")
32
+
33
+ attr_accessor :podfile
34
+
35
+ def initialize(config, vendor_options)
36
+ @config = config
37
+ @vendor_options = vendor_options
38
+
39
+ platform =
40
+ case @config.deploy_platform
41
+ when 'MacOSX' then :osx
42
+ when 'iPhoneOS' then :ios
43
+ when 'AppleTVOS' then :tvos
44
+ when 'WatchOS' then :watchos
45
+ else App.fail "Unknown CocoaPods platform: #{@config.deploy_platform}"
46
+ end
47
+
48
+ @podfile = Pod::Podfile.new(Pathname.new(Rake.original_dir) + 'Rakefile') {}
49
+ @podfile.platform(platform, config.deployment_target)
50
+ @podfile.target(TARGET_NAME)
51
+ cocoapods_config.podfile = @podfile
52
+ cocoapods_config.skip_repo_update = true
53
+ cocoapods_config.installation_root = Pathname.new(File.expand_path(config.project_dir)) + 'vendor'
54
+
55
+ if cocoapods_config.verbose = !!ENV["COCOAPODS_VERBOSE"]
56
+ require 'claide'
57
+ end
58
+
59
+ configure_project
60
+ end
61
+
62
+ # Adds the Pods project to the RubyMotion config as a vendored project and
63
+ #
64
+ def configure_project
65
+ @config.resources_dirs << resources_dir.to_s
66
+
67
+ # TODO: replace this all once Xcodeproj has the proper xcconfig parser.
68
+ return unless xcconfig_hash && ldflags
69
+ configure_xcconfig
70
+ end
71
+
72
+ # DSL
73
+ #-------------------------------------------------------------------------#
74
+
75
+ def source(source)
76
+ @podfile.source(source)
77
+ end
78
+
79
+ def pod(*name_and_version_requirements, &block)
80
+ @podfile.pod(*name_and_version_requirements, &block)
81
+ end
82
+
83
+ # Deprecated.
84
+ def dependency(*name_and_version_requirements, &block)
85
+ @podfile.dependency(*name_and_version_requirements, &block)
86
+ end
87
+
88
+ def post_install(&block)
89
+ @podfile.post_install(&block)
90
+ end
91
+
92
+ # Installation
93
+ #-------------------------------------------------------------------------#
94
+
95
+ def pods_installer
96
+ @installer ||= Pod::Installer.new(
97
+ cocoapods_config.sandbox,
98
+ @podfile,
99
+ cocoapods_config.lockfile
100
+ )
101
+ end
102
+
103
+ # Performs a CocoaPods Installation.
104
+ #
105
+ # For now we only support one Pods target, this will have to be expanded
106
+ # once we work on more spec support.
107
+ #
108
+ # Let RubyMotion re-generate the BridgeSupport file whenever the list of
109
+ # installed pods changes.
110
+ #
111
+ def install!(update)
112
+ pods_installer.update = update
113
+ pods_installer.installation_options.integrate_targets = false
114
+ pods_installer.install!
115
+ install_resources
116
+ copy_cocoapods_env_and_prefix_headers
117
+ end
118
+
119
+ # TODO: this probably breaks in cases like resource bundles etc, need to test.
120
+ def install_resources
121
+ FileUtils.rm_rf(resources_dir)
122
+ FileUtils.mkdir_p(resources_dir)
123
+ resources.each { |file| install_resource(file, resources_dir) }
124
+ end
125
+
126
+ def install_resource(file, resources_dir)
127
+ FileUtils.cp_r(file, resources_dir) if file.exist?
128
+ rescue ArgumentError => exc
129
+ raise unless exc.message =~ /same file/
130
+ end
131
+
132
+ def copy_cocoapods_env_and_prefix_headers
133
+ headers = Dir.glob([
134
+ "#{PODS_ROOT}/*.h",
135
+ "#{PODS_ROOT}/*.pch",
136
+ "#{PODS_ROOT}/Target Support Files/**/*.h",
137
+ "#{PODS_ROOT}/Target Support Files/**/*.pch"
138
+ ])
139
+
140
+ headers.each do |header|
141
+ src = File.basename(header)
142
+ dst = src.sub(/\.pch$/, ".h")
143
+ dst_path = File.join(PUBLIC_HEADERS_ROOT, "____#{dst}")
144
+
145
+ next if File.exist?(dst_path)
146
+
147
+ FileUtils.mkdir_p(PUBLIC_HEADERS_ROOT)
148
+ FileUtils.cp(header, dst_path)
149
+ end
150
+ end
151
+
152
+ # Helpers
153
+ #-------------------------------------------------------------------------#
154
+
155
+ # This is the output that gets shown in `rake config`, so it should be
156
+ # short and sweet.
157
+ #
158
+ def inspect
159
+ cocoapods_config
160
+ .lockfile
161
+ .to_hash["PODS"]
162
+ .map { |pod| pod.is_a?(Hash) ? pod.keys.first : pod }
163
+ .inspect
164
+ end
165
+
166
+ def cocoapods_config
167
+ Pod::Config.instance
168
+ end
169
+
170
+ def analyzer
171
+ Pod::Installer::Analyzer.new(
172
+ cocoapods_config.sandbox,
173
+ @podfile,
174
+ cocoapods_config.lockfile
175
+ )
176
+ end
177
+
178
+ def pods_xcconfig
179
+ path =
180
+ Pathname.new(@config.project_dir) +
181
+ SUPPORT_FILES +
182
+ "Pods-#{TARGET_NAME}.release.xcconfig"
183
+ Xcodeproj::Config.new(path) if path.exist?
184
+ end
185
+
186
+ def xcconfig_hash
187
+ return unless pods_xcconfig
188
+
189
+ @xcconfig_hash ||= pods_xcconfig.to_hash
190
+ end
191
+
192
+ # Do not copy `.framework` bundles, these should be handled through RM's
193
+ # `embedded_frameworks` config attribute.
194
+ #
195
+ def resources
196
+ resources = []
197
+ resource_path =
198
+ Pathname.new(@config.project_dir) +
199
+ SUPPORT_FILES +
200
+ "Pods-#{TARGET_NAME}-resources.sh"
201
+
202
+ File.open(resource_path) { |f|
203
+ f.each_line do |line|
204
+ matched = line.match(/install_resource\s+(.*)/)
205
+
206
+ next unless matched
207
+
208
+ path = (matched[1].strip)[1..-2]
209
+
210
+ path.sub!("${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}", ".build")
211
+
212
+ next if File.extname(path) == ".framework"
213
+
214
+ resources << Pathname.new(@config.project_dir) + PODS_ROOT + path
215
+ end
216
+ }
217
+ resources.uniq
218
+ end
219
+
220
+ def resources_dir
221
+ Pathname.new(@config.project_dir) + PODS_ROOT + "Resources"
222
+ end
223
+
224
+ private
225
+
226
+ def configure_xcconfig
227
+ lib_search_paths, lib_search_path_flags = parse_search_paths_and_flags
228
+
229
+ # Get the name of all static libraries that come pre-built with pods
230
+ @pre_built_static_libs =
231
+ lib_search_paths.map { |path| static_libraries_in_path(path) }.flatten
232
+
233
+ # Collect the Pod products
234
+ pods_libs, libs_to_compile = categorize_libs(lib_search_path_flags)
235
+
236
+ @config.libs.concat(libs_to_compile.compact)
237
+ @config.libs.uniq!
238
+
239
+ @header_dirs = ["Headers/Public"]
240
+
241
+ case @config.deploy_platform
242
+ when "MacOSX" then configure_for_osx(framework_search_paths)
243
+ when "iPhoneOS" then configure_for_iphone(framework_search_paths)
244
+ end
245
+
246
+ @config.frameworks.concat(frameworks)
247
+ @config.frameworks.uniq!
248
+
249
+ @config.weak_frameworks.concat(weak_frameworks)
250
+ @config.weak_frameworks.uniq!
251
+
252
+ @config.vendor_project(PODS_ROOT, :xcode, {
253
+ :target => "Pods-#{TARGET_NAME}",
254
+ :headers_dir => "{#{@header_dirs.join(',')}}",
255
+ :products => pods_libs.map { |lib_name| "lib#{lib_name}.a" },
256
+ :allow_empty_products => (pods_libs.empty? ? true : false),
257
+ }.merge(@vendor_options))
258
+ end
259
+
260
+ def categorize_libs(lib_search_path_flags)
261
+ pods_libs = []
262
+ libs_to_compile = []
263
+
264
+ linked_libraries.each do |library|
265
+ path = parsed_library_path(library, lib_search_path_flags)
266
+
267
+ case path
268
+ when String then libs_to_compile << path
269
+ when :pod then pods_libs << library
270
+ end
271
+ end
272
+
273
+ [pods_libs.flatten, libs_to_compile]
274
+ end
275
+
276
+ def configure_for_iphone(framework_search_paths)
277
+ pods_root = cocoapods_config.installation_root + "Pods"
278
+ # If we would really specify these as ‘frameworks’ then the linker
279
+ # would not link the archive into the application, because it does not
280
+ # see any references to any of the symbols in the archive. Treating it
281
+ # as a static library (which it is) with `-ObjC` fixes this.
282
+ #
283
+ framework_search_paths.each do |framework_search_path|
284
+ frameworks.reject! do |framework|
285
+ path = File.join(framework_search_path, "#{framework}.framework")
286
+ if File.exist?(path)
287
+ @config.libs << "-ObjC '#{File.join(path, framework)}'"
288
+ # This is needed until (and if) CocoaPods links framework
289
+ # headers into `Headers/Public` by default:
290
+ #
291
+ # https://github.com/CocoaPods/CocoaPods/pull/2722
292
+ #
293
+ header_dir = Pathname.new(path) + "Headers"
294
+ @header_dirs << header_dir.realpath.relative_path_from(pods_root).to_s
295
+ true
296
+ else
297
+ false
298
+ end
299
+ end
300
+ end
301
+ end
302
+
303
+ def configure_for_osx(framework_search_paths)
304
+ @config.framework_search_paths.concat(framework_search_paths)
305
+ @config.framework_search_paths.uniq!
306
+
307
+ framework_search_paths.each do |framework_search_path|
308
+ frameworks.reject! do |framework|
309
+ path = File.join(framework_search_path, "#{framework}.framework")
310
+ if File.exist?(path)
311
+ @config.embedded_frameworks << path
312
+ true
313
+ else
314
+ false
315
+ end
316
+ end
317
+ end
318
+ end
319
+
320
+ def frameworks
321
+ ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |match| match[0] }
322
+ end
323
+
324
+ def framework_search_paths
325
+ search_paths = xcconfig_hash["FRAMEWORK_SEARCH_PATHS"]
326
+
327
+ return [] unless search_paths
328
+
329
+ search_paths.strip!
330
+
331
+ return [] if search_paths.empty?
332
+
333
+ framework_search_paths = []
334
+
335
+ search_paths.scan(/"([^"]+)"/) do |search_path|
336
+ path = search_path.first.gsub!(PODS_ROOT_MATCHER, "#{@config.project_dir}/#{PODS_ROOT}")
337
+ framework_search_paths << path if path
338
+ end
339
+
340
+ # If we couldn't parse any search paths, then presumably nothing was properly quoted, so
341
+ # fallback to just assuming the whole value is one path.
342
+ if framework_search_paths.empty?
343
+ path = search_paths.gsub!(PODS_ROOT_MATCHER, "#{@config.project_dir}/#{PODS_ROOT}")
344
+ framework_search_paths << path if path
345
+ end
346
+
347
+ framework_search_paths
348
+ end
349
+
350
+ def ldflags
351
+ xcconfig_hash["OTHER_LDFLAGS"]
352
+ end
353
+
354
+ def linked_libraries
355
+ ldflags.scan(/-l"?([^\s"]+)"?/)
356
+ end
357
+
358
+ def parse_search_paths_and_flags
359
+ flags = xcconfig_hash["LIBRARY_SEARCH_PATHS"] || ""
360
+
361
+ search_paths = []
362
+
363
+ flags = flags.split(/\s/).map do |path|
364
+ next if path =~ /(\$\(inherited\))|(\$\{inherited\})/
365
+
366
+ path.gsub!(
367
+ /(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/,
368
+ File.join(@config.project_dir, PODS_ROOT)
369
+ )
370
+
371
+ search_paths << path.delete('"')
372
+
373
+ '-L ' << path
374
+ end
375
+
376
+ [search_paths, flags.compact.join(' ')]
377
+ end
378
+
379
+ def parsed_library_path(library, lib_search_path_flags)
380
+ lib_name = library[0]
381
+
382
+ return unless lib_name
383
+
384
+ # For CocoaPods 0.37.x or below. This block is marked as deprecated.
385
+ if lib_name.start_with?('Pods-')
386
+ :pod
387
+ elsif @pre_built_static_libs.include?("lib#{lib_name}.a")
388
+ "#{lib_search_path_flags} -ObjC -l#{lib_name}"
389
+ elsif File.exist?("/usr/lib/lib#{lib_name}.dylib")
390
+ "/usr/lib/lib#{lib_name}.dylib"
391
+ else
392
+ :pod
393
+ end
394
+ end
395
+
396
+ def static_libraries_in_path(path)
397
+ Dir[File.join(path, "**/*.a")].map { |f| File.basename(f) }
398
+ end
399
+
400
+ def weak_frameworks
401
+ ldflags.scan(/-weak_framework\s+([^\s]+)/).map { |match| match[0] }
402
+ end
403
+ end
404
+ end
@@ -0,0 +1,404 @@
1
+ # Copyright (c) 2012-2014, 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
+ module Motion
26
+ class Pods
27
+ PODS_ROOT = 'vendor/Pods'
28
+ TARGET_NAME = 'RubyMotion'
29
+ PUBLIC_HEADERS_ROOT = File.join(PODS_ROOT, 'Headers/Public')
30
+ PODS_ROOT_MATCHER = /(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/
31
+ SUPPORT_FILES = File.join(PODS_ROOT, "Target Support Files/Pods-#{TARGET_NAME}")
32
+
33
+ attr_accessor :podfile
34
+
35
+ def initialize(config, vendor_options)
36
+ @config = config
37
+ @vendor_options = vendor_options
38
+
39
+ platform =
40
+ case @config.deploy_platform
41
+ when 'MacOSX' then :osx
42
+ when 'iPhoneOS' then :ios
43
+ when 'AppleTVOS' then :tvos
44
+ when 'WatchOS' then :watchos
45
+ else App.fail "Unknown CocoaPods platform: #{@config.deploy_platform}"
46
+ end
47
+
48
+ @podfile = Pod::Podfile.new(Pathname.new(Rake.original_dir) + 'Rakefile') {}
49
+ @podfile.platform(platform, config.deployment_target)
50
+ @podfile.target(TARGET_NAME)
51
+ cocoapods_config.podfile = @podfile
52
+ cocoapods_config.skip_repo_update = true
53
+ cocoapods_config.installation_root = Pathname.new(File.expand_path(config.project_dir)) + 'vendor'
54
+
55
+ if cocoapods_config.verbose = !!ENV["COCOAPODS_VERBOSE"]
56
+ require 'claide'
57
+ end
58
+
59
+ configure_project
60
+ end
61
+
62
+ # Adds the Pods project to the RubyMotion config as a vendored project and
63
+ #
64
+ def configure_project
65
+ @config.resources_dirs << resources_dir.to_s
66
+
67
+ # TODO: replace this all once Xcodeproj has the proper xcconfig parser.
68
+ return unless xcconfig_hash && ldflags
69
+ configure_xcconfig
70
+ end
71
+
72
+ # DSL
73
+ #-------------------------------------------------------------------------#
74
+
75
+ def source(source)
76
+ @podfile.source(source)
77
+ end
78
+
79
+ def pod(*name_and_version_requirements, &block)
80
+ @podfile.pod(*name_and_version_requirements, &block)
81
+ end
82
+
83
+ # Deprecated.
84
+ def dependency(*name_and_version_requirements, &block)
85
+ @podfile.dependency(*name_and_version_requirements, &block)
86
+ end
87
+
88
+ def post_install(&block)
89
+ @podfile.post_install(&block)
90
+ end
91
+
92
+ # Installation
93
+ #-------------------------------------------------------------------------#
94
+
95
+ def pods_installer
96
+ @installer ||= Pod::Installer.new(
97
+ cocoapods_config.sandbox,
98
+ @podfile,
99
+ cocoapods_config.lockfile
100
+ )
101
+ end
102
+
103
+ # Performs a CocoaPods Installation.
104
+ #
105
+ # For now we only support one Pods target, this will have to be expanded
106
+ # once we work on more spec support.
107
+ #
108
+ # Let RubyMotion re-generate the BridgeSupport file whenever the list of
109
+ # installed pods changes.
110
+ #
111
+ def install!(update)
112
+ pods_installer.update = update
113
+ pods_installer.installation_options.integrate_targets = false
114
+ pods_installer.install!
115
+ install_resources
116
+ copy_cocoapods_env_and_prefix_headers
117
+ end
118
+
119
+ # TODO: this probably breaks in cases like resource bundles etc, need to test.
120
+ def install_resources
121
+ FileUtils.rm_rf(resources_dir)
122
+ FileUtils.mkdir_p(resources_dir)
123
+ resources.each { |file| install_resource(file, resources_dir) }
124
+ end
125
+
126
+ def install_resource(file, resources_dir)
127
+ FileUtils.cp_r(file, resources_dir) if file.exist?
128
+ rescue ArgumentError => exc
129
+ raise unless exc.message =~ /same file/
130
+ end
131
+
132
+ def copy_cocoapods_env_and_prefix_headers
133
+ headers = Dir.glob([
134
+ "#{PODS_ROOT}/*.h",
135
+ "#{PODS_ROOT}/*.pch",
136
+ "#{PODS_ROOT}/Target Support Files/**/*.h",
137
+ "#{PODS_ROOT}/Target Support Files/**/*.pch"
138
+ ])
139
+
140
+ headers.each do |header|
141
+ src = File.basename(header)
142
+ dst = src.sub(/\.pch$/, ".h")
143
+ dst_path = File.join(PUBLIC_HEADERS_ROOT, "____#{dst}")
144
+
145
+ next if File.exist?(dst_path)
146
+
147
+ FileUtils.mkdir_p(PUBLIC_HEADERS_ROOT)
148
+ FileUtils.cp(header, dst_path)
149
+ end
150
+ end
151
+
152
+ # Helpers
153
+ #-------------------------------------------------------------------------#
154
+
155
+ # This is the output that gets shown in `rake config`, so it should be
156
+ # short and sweet.
157
+ #
158
+ def inspect
159
+ cocoapods_config
160
+ .lockfile
161
+ .to_hash["PODS"]
162
+ .map { |pod| pod.is_a?(Hash) ? pod.keys.first : pod }
163
+ .inspect
164
+ end
165
+
166
+ def cocoapods_config
167
+ Pod::Config.instance
168
+ end
169
+
170
+ def analyzer
171
+ Pod::Installer::Analyzer.new(
172
+ cocoapods_config.sandbox,
173
+ @podfile,
174
+ cocoapods_config.lockfile
175
+ )
176
+ end
177
+
178
+ def pods_xcconfig
179
+ path =
180
+ Pathname.new(@config.project_dir) +
181
+ SUPPORT_FILES +
182
+ "Pods-#{TARGET_NAME}.release.xcconfig"
183
+ Xcodeproj::Config.new(path) if path.exist?
184
+ end
185
+
186
+ def xcconfig_hash
187
+ return unless pods_xcconfig
188
+
189
+ @xcconfig_hash ||= pods_xcconfig.to_hash
190
+ end
191
+
192
+ # Do not copy `.framework` bundles, these should be handled through RM's
193
+ # `embedded_frameworks` config attribute.
194
+ #
195
+ def resources
196
+ resources = []
197
+ resource_path =
198
+ Pathname.new(@config.project_dir) +
199
+ SUPPORT_FILES +
200
+ "Pods-#{TARGET_NAME}-resources.sh"
201
+
202
+ File.open(resource_path) { |f|
203
+ f.each_line do |line|
204
+ matched = line.match(/install_resource\s+(.*)/)
205
+
206
+ next unless matched
207
+
208
+ path = (matched[1].strip)[1..-2]
209
+
210
+ path.sub!("${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}", ".build")
211
+
212
+ next if File.extname(path) == ".framework"
213
+
214
+ resources << Pathname.new(@config.project_dir) + PODS_ROOT + path
215
+ end
216
+ }
217
+ resources.uniq
218
+ end
219
+
220
+ def resources_dir
221
+ Pathname.new(@config.project_dir) + PODS_ROOT + "Resources"
222
+ end
223
+
224
+ private
225
+
226
+ def configure_xcconfig
227
+ lib_search_paths, lib_search_path_flags = parse_search_paths_and_flags
228
+
229
+ # Get the name of all static libraries that come pre-built with pods
230
+ @pre_built_static_libs =
231
+ lib_search_paths.map { |path| static_libraries_in_path(path) }.flatten
232
+
233
+ # Collect the Pod products
234
+ pods_libs, libs_to_compile = categorize_libs(lib_search_path_flags)
235
+
236
+ @config.libs.concat(libs_to_compile.compact)
237
+ @config.libs.uniq!
238
+
239
+ @header_dirs = ["Headers/Public"]
240
+
241
+ case @config.deploy_platform
242
+ when "MacOSX" then configure_for_osx(framework_search_paths)
243
+ when "iPhoneOS" then configure_for_iphone(framework_search_paths)
244
+ end
245
+
246
+ @config.frameworks.concat(frameworks)
247
+ @config.frameworks.uniq!
248
+
249
+ @config.weak_frameworks.concat(weak_frameworks)
250
+ @config.weak_frameworks.uniq!
251
+
252
+ @config.vendor_project(PODS_ROOT, :xcode, {
253
+ :target => "Pods-#{TARGET_NAME}",
254
+ :headers_dir => "{#{@header_dirs.join(',')}}",
255
+ :products => pods_libs.map { |lib_name| "lib#{lib_name}.a" },
256
+ :allow_empty_products => (pods_libs.empty? ? true : false),
257
+ }.merge(@vendor_options))
258
+ end
259
+
260
+ def categorize_libs(lib_search_path_flags)
261
+ pods_libs = []
262
+ libs_to_compile = []
263
+
264
+ linked_libraries.each do |library|
265
+ path = parsed_library_path(library, lib_search_path_flags)
266
+
267
+ case path
268
+ when String then libs_to_compile << path
269
+ when :pod then pods_libs << library
270
+ end
271
+ end
272
+
273
+ [pods_libs.flatten, libs_to_compile]
274
+ end
275
+
276
+ def configure_for_iphone(framework_search_paths)
277
+ pods_root = cocoapods_config.installation_root + "Pods"
278
+ # If we would really specify these as ‘frameworks’ then the linker
279
+ # would not link the archive into the application, because it does not
280
+ # see any references to any of the symbols in the archive. Treating it
281
+ # as a static library (which it is) with `-ObjC` fixes this.
282
+ #
283
+ framework_search_paths.each do |framework_search_path|
284
+ frameworks.reject! do |framework|
285
+ path = File.join(framework_search_path, "#{framework}.framework")
286
+ if File.exist?(path)
287
+ @config.libs << "-ObjC '#{File.join(path, framework)}'"
288
+ # This is needed until (and if) CocoaPods links framework
289
+ # headers into `Headers/Public` by default:
290
+ #
291
+ # https://github.com/CocoaPods/CocoaPods/pull/2722
292
+ #
293
+ header_dir = Pathname.new(path) + "Headers"
294
+ @header_dirs << header_dir.realpath.relative_path_from(pods_root).to_s
295
+ true
296
+ else
297
+ false
298
+ end
299
+ end
300
+ end
301
+ end
302
+
303
+ def configure_for_osx(framework_search_paths)
304
+ @config.framework_search_paths.concat(framework_search_paths)
305
+ @config.framework_search_paths.uniq!
306
+
307
+ framework_search_paths.each do |framework_search_path|
308
+ frameworks.reject! do |framework|
309
+ path = File.join(framework_search_path, "#{framework}.framework")
310
+ if File.exist?(path)
311
+ @config.embedded_frameworks << path
312
+ true
313
+ else
314
+ false
315
+ end
316
+ end
317
+ end
318
+ end
319
+
320
+ def frameworks
321
+ ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |match| match[0] }
322
+ end
323
+
324
+ def framework_search_paths
325
+ search_paths = xcconfig_hash["FRAMEWORK_SEARCH_PATHS"]
326
+
327
+ return [] unless search_paths
328
+
329
+ search_paths.strip!
330
+
331
+ return [] if search_paths.empty?
332
+
333
+ framework_search_paths = []
334
+
335
+ search_paths.scan(/"([^"]+)"/) do |search_path|
336
+ path = search_path.first.gsub!(PODS_ROOT_MATCHER, "#{@config.project_dir}/#{PODS_ROOT}")
337
+ framework_search_paths << path if path
338
+ end
339
+
340
+ # If we couldn't parse any search paths, then presumably nothing was properly quoted, so
341
+ # fallback to just assuming the whole value is one path.
342
+ if framework_search_paths.empty?
343
+ path = search_paths.gsub!(PODS_ROOT_MATCHER, "#{@config.project_dir}/#{PODS_ROOT}")
344
+ framework_search_paths << path if path
345
+ end
346
+
347
+ framework_search_paths
348
+ end
349
+
350
+ def ldflags
351
+ xcconfig_hash["OTHER_LDFLAGS"]
352
+ end
353
+
354
+ def linked_libraries
355
+ ldflags.scan(/-l"?([^\s"]+)"?/)
356
+ end
357
+
358
+ def parse_search_paths_and_flags
359
+ flags = xcconfig_hash["LIBRARY_SEARCH_PATHS"] || ""
360
+
361
+ search_paths = []
362
+
363
+ flags = flags.split(/\s/).map do |path|
364
+ next if path =~ /(\$\(inherited\))|(\$\{inherited\})/
365
+
366
+ path.gsub!(
367
+ /(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/,
368
+ File.join(@config.project_dir, PODS_ROOT)
369
+ )
370
+
371
+ search_paths << path.delete('"')
372
+
373
+ '-L ' << path
374
+ end
375
+
376
+ [search_paths, flags.compact.join(' ')]
377
+ end
378
+
379
+ def parsed_library_path(library, lib_search_path_flags)
380
+ lib_name = library[0]
381
+
382
+ return unless lib_name
383
+
384
+ # For CocoaPods 0.37.x or below. This block is marked as deprecated.
385
+ if lib_name.start_with?('Pods-')
386
+ :pod
387
+ elsif @pre_built_static_libs.include?("lib#{lib_name}.a")
388
+ "#{lib_search_path_flags} -ObjC -l#{lib_name}"
389
+ elsif File.exist?("/usr/lib/lib#{lib_name}.dylib")
390
+ "/usr/lib/lib#{lib_name}.dylib"
391
+ else
392
+ :pod
393
+ end
394
+ end
395
+
396
+ def static_libraries_in_path(path)
397
+ Dir[File.join(path, "**/*.a")].map { |f| File.basename(f) }
398
+ end
399
+
400
+ def weak_frameworks
401
+ ldflags.scan(/-weak_framework\s+([^\s]+)/).map { |match| match[0] }
402
+ end
403
+ end
404
+ end
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2012-2013, 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
+ module Motion
26
+ class Pods
27
+ VERSION = '0.9.0'
28
+ end
29
+ end
@@ -0,0 +1,56 @@
1
+ # Copyright (c) 2012-2014, 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
+ module Motion
26
+ module Project
27
+ class Config
28
+ variable :pods
29
+
30
+ def pods(vendor_options = {}, &block)
31
+ @pods ||= Motion::Pods.new(self, vendor_options)
32
+ @pods.instance_eval(&block) if block
33
+ @pods
34
+ end
35
+ end
36
+
37
+ class App
38
+ class << self
39
+ def build_with_cocoapods(platform, opts = {})
40
+ unless File.exist?(Motion::Pods::PODS_ROOT)
41
+ $stderr.puts(
42
+ "[!] No CocoaPods dependencies found in " \
43
+ "#{Motion::Pods::PODS_ROOT}, run the " \
44
+ "`[bundle exec] rake pod:install` task."
45
+ )
46
+ exit 1
47
+ end
48
+ build_without_cocoapods(platform, opts)
49
+ end
50
+
51
+ alias_method "build_without_cocoapods", "build"
52
+ alias_method "build", "build_with_cocoapods"
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,74 @@
1
+ # Copyright (c) 2012-2014, 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
+ namespace :pod do
26
+ task :update_spec_repos do
27
+ if ENV['COCOCAPODS_NO_UPDATE']
28
+ $stderr.puts(
29
+ '[!] The COCOCAPODS_NO_UPDATE env variable has been deprecated, use ' \
30
+ 'COCOAPODS_NO_REPO_UPDATE instead.'
31
+ )
32
+ ENV['COCOAPODS_NO_REPO_UPDATE'] = '1'
33
+ end
34
+
35
+ show_output = !ENV['COCOAPODS_NO_REPO_UPDATE_OUTPUT']
36
+
37
+ unless ENV['COCOAPODS_NO_REPO_UPDATE']
38
+ Pod::SourcesManager.update(nil, show_output)
39
+ end
40
+ end
41
+
42
+ desc "Download and integrate newly added pods"
43
+ task :install => :update_spec_repos do
44
+ # TODO: Should ideally not have to be controller manually.
45
+ Pod::UserInterface.title_level = 1
46
+
47
+ pods = App.config.pods
48
+
49
+ # TODO: fix this, see https://git.io/vae3Z
50
+ need_install = (pods.analyzer.needs_install? rescue true)
51
+
52
+ # TODO: Should ideally not have to be controller manually.
53
+ Pod::UserInterface.title_level = 0
54
+
55
+ pods.install!(false) if need_install
56
+ end
57
+
58
+ desc "Update outdated pods"
59
+ task :update => :update_spec_repos do
60
+ pods = App.config.pods
61
+ pods.install!(true)
62
+ end
63
+ end
64
+
65
+ namespace :clean do
66
+ # This gets appended to the already existing clean:all task.
67
+ task :all do
68
+ dir = Motion::Pods::PODS_ROOT
69
+ if File.exist?(dir)
70
+ App.info 'Delete', dir
71
+ rm_rf dir
72
+ end
73
+ end
74
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-pods
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Laurent Sansonetti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cocoapods
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0.beta.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0.beta.4
27
+ description: motion-cocoapods allows RubyMotion projects to have access to the CocoaPods
28
+ dependency manager.
29
+ email: lrz@hipbyte.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE
35
+ - README.md
36
+ - lib/motion-pods.rb
37
+ - lib/motion/cocoapods/main.rb
38
+ - lib/motion/pods/main.rb
39
+ - lib/motion/pods/version.rb
40
+ - lib/motion/project/monkeypatches.rb
41
+ - lib/tasks/pod.rb
42
+ homepage: http://www.rubymotion.com
43
+ licenses:
44
+ - MIT
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.4.8
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: CocoaPods integration for RubyMotion projects
66
+ test_files: []