cocoapods-packagerthk 0.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.
@@ -0,0 +1,81 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe 'Packagerthk' do
5
+ after do
6
+ Dir.glob("CPDColors-*").each { |dir| Pathname.new(dir).rmtree }
7
+ Dir.glob("layer-client-messaging-schema-*").each { |dir| Pathname.new(dir).rmtree }
8
+ Dir.glob("OpenSans-*").each { |dir| Pathname.new(dir).rmtree }
9
+ Dir.glob("Weakly-*").each { |dir| Pathname.new(dir).rmtree }
10
+ end
11
+
12
+ it 'presents the help if a directory is provided' do
13
+ should.raise CLAide::Help do
14
+ command = Command.parse(%w{ package spec })
15
+ end.message.should.match /is a directory/
16
+ end
17
+
18
+ it 'presents the help if a random file is provided instead of a specification' do
19
+ should.raise CLAide::Help do
20
+ command = Command.parse(%w{ package README.md })
21
+ end.message.should.match /is not a podspec/
22
+ end
23
+
24
+ it 'presents the help if a podspec with binary-only dependencies is used' do
25
+ command = Command.parse(%w{ package spec/fixtures/CPDColors.podspec })
26
+ should.raise CLAide::Help do
27
+ command.validate!
28
+ end.message.should.match /binary-only/
29
+ end
30
+
31
+ it 'presents the help if only --bundle-identifier is specified' do
32
+ command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec --bundle-identifier=com.example.NikeKit })
33
+ should.raise CLAide::Help do
34
+ command.validate!
35
+ end.message.should.match /--bundle-identifier option can only be used for dynamic frameworks/
36
+ end
37
+
38
+ it 'presents the help if both --exclude-deps and --dynamic are specified' do
39
+ command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec --exclude-deps --dynamic })
40
+ should.raise CLAide::Help do
41
+ command.validate!
42
+ end.message.should.match /--exclude-deps option can only be used for static libraries/
43
+ end
44
+
45
+ it 'presents the help if --local is specified without .podspec path' do
46
+ command = Command.parse(%w{ package AFNetworking --local })
47
+ should.raise CLAide::Help do
48
+ command.validate!
49
+ end.message.should.match /--local option can only be used when a local `.podspec` path is given/
50
+ end
51
+
52
+ it 'can package a podspec with only resources' do
53
+ command = Command.parse(%w{ package spec/fixtures/layer-client-messaging-schema.podspec --no-mangle })
54
+ command.run
55
+
56
+ true.should == true # To make the test pass without any shoulds
57
+ end
58
+
59
+ it 'can package a podspec with binary-only dependencies if --no-mangle is specified' do
60
+ command = Command.parse(%w{ package spec/fixtures/CPDColors.podspec --no-mangle })
61
+ command.run
62
+
63
+ true.should == true # To make the test pass without any shoulds
64
+ end
65
+
66
+ it 'can package a podspec with resource bundles' do
67
+ command = Command.parse(%w{ package spec/fixtures/OpenSans.podspec })
68
+ command.run
69
+
70
+ bundles = Dir.glob('OpenSans-*/ios/OpenSans.framework/Versions/A/Resources/*.bundle')
71
+ bundles.count.should == 1
72
+ end
73
+
74
+ it 'can package a podspec with weak frameworks without strong linking' do
75
+ command = Command.parse(%w{ package spec/fixtures/Weakly.podspec })
76
+ command.run
77
+
78
+ `otool -l Weakly-*/ios/Weakly.framework/Weakly`.should.not.match /AssetsLibrary/
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,420 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+
5
+ DONT_CODESIGN = true
6
+
7
+ describe Command::Spec::Packagethk do
8
+ describe 'CLAide' do
9
+ after do
10
+ Dir.glob("Archs-*").each { |dir| Pathname.new(dir).rmtree }
11
+ Dir.glob("CPDColors-*").each { |dir| Pathname.new(dir).rmtree }
12
+ Dir.glob("KFData-*").each { |dir| Pathname.new(dir).rmtree }
13
+ Dir.glob("NikeKit-*").each { |dir| Pathname.new(dir).rmtree }
14
+ Dir.glob("LocalNikeKit-*").each { |dir| Pathname.new(dir).rmtree }
15
+ Dir.glob("foo-bar-*").each { |dir| Pathname.new(dir).rmtree }
16
+ Dir.glob("a-*").each { |dir| Pathname.new(dir).rmtree }
17
+ Dir.glob("FH-*").each { |dir| Pathname.new(dir).rmtree }
18
+ Dir.glob("FirebaseAnalytics-*").each { |dir| Pathname.new(dir).rmtree }
19
+ end
20
+
21
+ def reject_block_symbols(symbols)
22
+ symbols
23
+ .reject { |e| e =~ /__block_descriptor.*/ }
24
+ .reject { |e| e =~ /__destroy_helper_block.*/ }
25
+ .reject { |e| e =~ /__copy_helper_block.*/ }
26
+ end
27
+
28
+ it 'registers itself' do
29
+ Command.parse(%w{ package }).should.be.instance_of Command::Packagethk
30
+ end
31
+
32
+ it 'presents the help if no spec is provided' do
33
+ command = Command.parse(%w{ package })
34
+ should.raise CLAide::Help do
35
+ command.validate!
36
+ end.message.should.match /required/
37
+ end
38
+
39
+ it "errors if it cannot find a spec" do
40
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
41
+
42
+ command = Command.parse(%w{ package KFData })
43
+ should.raise CLAide::Help do
44
+ command.run
45
+ end.message.should.match /Unable to find/
46
+ end
47
+
48
+
49
+ it "should produce a dynamic library when dynamic is specified" do
50
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
51
+
52
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
53
+ command.run
54
+
55
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
56
+ file_command = "file #{lib}"
57
+ output = `#{file_command}`.lines.to_a
58
+
59
+ output[0].should.match /Mach-O universal binary with 5 architectures/
60
+ output[1].should.match /Mach-O dynamically linked shared library i386/
61
+ end
62
+
63
+ it "should produce a dSYM when dynamic is specified" do
64
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
65
+
66
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
67
+ command.run
68
+
69
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework.dSYM/Contents/Resources/DWARF/NikeKit").first
70
+ file_command = "file #{lib}"
71
+ output = `#{file_command}`.lines.to_a
72
+
73
+ output[0].should.match /Mach-O universal binary with 3 architectures/
74
+ output[1].should.match /Mach-O dSYM companion file arm/
75
+ end
76
+
77
+ it "should link category symbols when dynamic is specified" do
78
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
79
+
80
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
81
+ command.run
82
+
83
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
84
+ file_command = "nm #{lib}"
85
+ output = `#{file_command}`.lines.to_a
86
+
87
+ match = output.detect { |line| line =~ /UIButton\(AFNetworking\)/ }
88
+ match.should.not.be.empty
89
+ end
90
+
91
+ it "should produce a dynamic library for OSX when dynamic is specified" do
92
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
93
+
94
+ command = Command.parse(['package', fixture('KFData.podspec'), '--dynamic'])
95
+ command.run
96
+
97
+ lib = Dir.glob("KFData-*/osx/KFData.framework/KFData").first
98
+ file_command = "file #{lib}"
99
+ output = `#{file_command}`.lines.to_a
100
+
101
+ output[0].should.match /Mach-O 64-bit dynamically linked shared library x86_64/
102
+ end
103
+
104
+ it "should produce a dSYM for OSX when dynamic is specified" do
105
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
106
+
107
+ command = Command.parse(['package', fixture('KFData.podspec'), '--dynamic'])
108
+ command.run
109
+
110
+ lib = Dir.glob("KFData-*/osx/KFData.framework.dSYM/Contents/Resources/DWARF/KFData").first
111
+ file_command = "file #{lib}"
112
+ output = `#{file_command}`.lines.to_a
113
+
114
+ output[0].should.match /Mach-O 64-bit dSYM companion file x86_64/
115
+ end
116
+
117
+ it "should produce the default plist for iOS and OSX when --dynamic is specified but --bundle-identifier is not" do
118
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
119
+
120
+ command = Command.parse(['package', fixture('KFData.podspec'), '--dynamic'])
121
+ command.run
122
+
123
+ ios_plist = File.expand_path(Dir.glob("KFData-*/ios/KFData.framework/Info.plist").first)
124
+ osx_plist = File.expand_path(Dir.glob("KFData-*/osx/KFData.framework/Resources/Info.plist").first)
125
+
126
+ ios_bundle_id = `defaults read #{ios_plist} CFBundleIdentifier`
127
+ osx_bundle_id = `defaults read #{osx_plist} CFBundleIdentifier`
128
+
129
+ ios_bundle_id.should.match /org.cocoapods.KFData/
130
+ osx_bundle_id.should.match /org.cocoapods.KFData/
131
+ end
132
+
133
+ it "should produce the correct plist for iOS and OSX when --dynamic and --bundle-identifier are specified" do
134
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
135
+
136
+ command = Command.parse(['package', fixture('KFData.podspec'), '--dynamic', '--bundle-identifier=com.example.KFData'])
137
+ command.run
138
+
139
+ ios_plist = File.expand_path(Dir.glob("KFData-*/ios/KFData.framework/Info.plist").first)
140
+ osx_plist = File.expand_path(Dir.glob("KFData-*/osx/KFData.framework/Resources/Info.plist").first)
141
+
142
+ ios_bundle_id = `defaults read #{ios_plist} CFBundleIdentifier`
143
+ osx_bundle_id = `defaults read #{osx_plist} CFBundleIdentifier`
144
+
145
+ ios_bundle_id.should.match /com.example.KFData/
146
+ osx_bundle_id.should.match /com.example.KFData/
147
+ end
148
+
149
+ it "should produce a static library when dynamic is not specified" do
150
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
151
+
152
+ command = Command.parse(['package', fixture('NikeKit.podspec')])
153
+ command.run
154
+
155
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
156
+ file_command = "file #{lib}"
157
+ output = `#{file_command}`.lines.to_a
158
+
159
+ output[0].should.match /Mach-O universal binary with 5 architectures/
160
+ output[1].should.match /current ar archive/
161
+ end
162
+
163
+ it "produces package using local sources when --local is specified" do
164
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
165
+
166
+ command = Command.parse(['package', fixture('LocalSources/LocalNikeKit.podspec'), '--local'])
167
+ command.run
168
+
169
+ lib = Dir.glob("LocalNikeKit-*/ios/LocalNikeKit.framework/LocalNikeKit").first
170
+ symbols = Symbols.symbols_from_library(lib)
171
+ symbols.should.include('LocalNikeKit')
172
+ symbols.should.not.include('BBUNikePlusActivity')
173
+ end
174
+
175
+ it "includes vendor symbols both from itself and pod dependencies" do
176
+ command = Command.parse(%w{ package FirebaseAnalytics --no-mangle })
177
+ command.run
178
+
179
+ lib = Dir.glob("FirebaseAnalytics-*/ios/FirebaseAnalytics.framework/FirebaseAnalytics").first
180
+ symbols = Symbols.symbols_from_library(lib)
181
+ # from itself
182
+ symbols.should.include('FIRAnalytics')
183
+ # from pod dependency
184
+ symbols.should.include('FIRApp')
185
+ end
186
+
187
+ it "does not include vendor symbols from pod dependencies if option --exclude-deps is specified" do
188
+ command = Command.parse(%w{ package FirebaseAnalytics --no-mangle --exclude-deps})
189
+ command.run
190
+
191
+ lib = Dir.glob("FirebaseAnalytics-*/ios/FirebaseAnalytics.framework/FirebaseAnalytics").first
192
+ symbols = Symbols.symbols_from_library(lib)
193
+ # from itself
194
+ symbols.should.include('FIRAnalytics')
195
+ # from pod dependency
196
+ symbols.should.not.include('FIRApp')
197
+ end
198
+
199
+ it "includes only available architectures when packaging an iOS Pod with binary dependencies" do
200
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
201
+
202
+ command = Command.parse(['package', fixture('Archs.podspec'), '--no-mangle'])
203
+ command.run
204
+
205
+ lib = Dir.glob("Archs-*/ios/Archs.framework/Archs").first
206
+ `lipo #{lib} -verify_arch x86_64 i386 armv7 arm64`
207
+ $?.success?.should == true
208
+ end
209
+
210
+ it "mangles symbols if the Pod has dependencies" do
211
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
212
+
213
+ command = Command.parse(['package', fixture('NikeKit.podspec')])
214
+ command.run
215
+
216
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
217
+ symbols = Symbols.symbols_from_library(lib).uniq.sort.reject { |e| e =~ /PodNikeKit/ }
218
+ symbols = reject_block_symbols(symbols)
219
+
220
+ symbols.should == %w{ BBUNikePlusActivity BBUNikePlusSessionManager
221
+ BBUNikePlusTag }
222
+ end
223
+
224
+ it "mangles symbols if the Pod has dependencies and framework is dynamic" do
225
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
226
+
227
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
228
+ command.run
229
+
230
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
231
+ symbols = Symbols.symbols_from_library(lib).uniq.sort.reject { |e| e =~ /PodNikeKit/ }
232
+ symbols = reject_block_symbols(symbols)
233
+
234
+ symbols.should == %w{ BBUNikePlusActivity BBUNikePlusSessionManager
235
+ BBUNikePlusTag NikeKitVersionNumber NikeKitVersionString }
236
+ end
237
+
238
+ it "mangles symbols if the Pod has dependencies regardless of name" do
239
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
240
+
241
+ command = Command.parse(['package', fixture('a.podspec')])
242
+ command.run
243
+
244
+ lib = Dir.glob("a-*/ios/a.framework/a").first
245
+ symbols = Symbols.symbols_from_library(lib).uniq.sort.reject { |e| e =~ /Poda/ }
246
+ symbols = reject_block_symbols(symbols)
247
+ symbols.should == %w{ BBUNikePlusActivity BBUNikePlusSessionManager
248
+ BBUNikePlusTag }
249
+ end
250
+
251
+ it "does not mangle symbols if option --no-mangle is specified" do
252
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
253
+
254
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--no-mangle'])
255
+ command.run
256
+
257
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
258
+ symbols = Symbols.symbols_from_library(lib).uniq.sort.select { |e| e =~ /PodNikeKit/ }
259
+ symbols.should == []
260
+ end
261
+
262
+ it "does not mangle symbols if option --no-mangle and --dynamic are specified" do
263
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
264
+
265
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--no-mangle', '--dynamic'])
266
+ command.run
267
+
268
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
269
+ symbols = Symbols.symbols_from_library(lib).uniq.sort.select { |e| e =~ /PodNikeKit/ }
270
+ symbols.should == []
271
+ end
272
+
273
+ it "does not include symbols from dependencies if option --exclude-deps is specified" do
274
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
275
+
276
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--exclude-deps'])
277
+ command.run
278
+
279
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
280
+ symbols = Symbols.symbols_from_library(lib).uniq.sort.select { |e| e =~ /AFNetworking|ISO8601DateFormatter|KZPropertyMapper/ }
281
+ symbols.should == []
282
+ end
283
+
284
+ it "includes the correct architectures when packaging an iOS Pod" do
285
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
286
+
287
+ command = Command.parse(['package', fixture('NikeKit.podspec')])
288
+ command.run
289
+
290
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
291
+ `lipo #{lib} -verify_arch x86_64 i386 armv7 armv7s arm64`
292
+ $?.success?.should == true
293
+ end
294
+
295
+ it "includes the correct architectures when packaging an iOS Pod as --dynamic" do
296
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
297
+
298
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
299
+ command.run
300
+
301
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
302
+ `lipo #{lib} -verify_arch armv7 armv7s arm64`
303
+ $?.success?.should == true
304
+ end
305
+
306
+ it "includes Bitcode for device arch slices when packaging an iOS Pod" do
307
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
308
+
309
+ command = Command.parse(['package', fixture('NikeKit.podspec')])
310
+ command.run
311
+
312
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
313
+
314
+ #Check for __LLVM segment in each device architecture
315
+ `lipo -extract armv7 #{lib} -o armv7.a && otool -l armv7.a`.should.match /__LLVM/
316
+ `lipo -extract armv7s #{lib} -o armv7s.a && otool -l armv7s.a`.should.match /__LLVM/
317
+ `lipo -extract arm64 #{lib} -o arm64.a && otool -l arm64.a`.should.match /__LLVM/
318
+ `rm armv7.a armv7s.a arm64.a`
319
+ end
320
+
321
+ it "includes Bitcode for device arch slices when packaging an dynamic iOS Pod" do
322
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
323
+
324
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
325
+ command.run
326
+
327
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
328
+
329
+ #Check for __LLVM segment in each device architecture
330
+ `lipo -extract armv7 #{lib} -o armv7.a && otool -l armv7.a`.should.match /__LLVM/
331
+ `lipo -extract armv7s #{lib} -o armv7s.a && otool -l armv7s.a`.should.match /__LLVM/
332
+ `lipo -extract arm64 #{lib} -o arm64.a && otool -l arm64.a`.should.match /__LLVM/
333
+ `rm armv7.a armv7s.a arm64.a`
334
+ end
335
+
336
+ it "does not include Bitcode for simulator arch slices when packaging an iOS Pod" do
337
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
338
+
339
+ command = Command.parse(['package', fixture('NikeKit.podspec')])
340
+ command.run
341
+
342
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
343
+
344
+ #Check for __LLVM segment in each simulator architecture
345
+ `lipo -extract i386 #{lib} -o i386.a && otool -l i386.a`.should.not.match /__LLVM/
346
+ `lipo -extract x86_64 #{lib} -o x86_64.a && otool -l x86_64.a`.should.not.match /__LLVM/
347
+ `rm i386.a x86_64.a`
348
+ end
349
+
350
+ it "does not include Bitcode for simulator arch slices when packaging an dynamic iOS Pod" do
351
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
352
+
353
+ command = Command.parse(['package', fixture('NikeKit.podspec'), '--dynamic'])
354
+ command.run
355
+
356
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
357
+
358
+ #Check for __LLVM segment in each simulator architecture
359
+ `lipo -extract i386 #{lib} -o i386.a && otool -l i386.a`.should.not.match /__LLVM/
360
+ `lipo -extract x86_64 #{lib} -o x86_64.a && otool -l x86_64.a`.should.not.match /__LLVM/
361
+ `rm i386.a x86_64.a`
362
+ end
363
+
364
+ it "does not include local ModuleCache references" do
365
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
366
+
367
+ command = Command.parse(['package', fixture('NikeKit.podspec')])
368
+ command.run
369
+
370
+ lib = Dir.glob("NikeKit-*/ios/NikeKit.framework/NikeKit").first
371
+
372
+ #Check for ModuleCache references
373
+ `strings #{lib}`.should.not.match /ModuleCache/
374
+ end
375
+
376
+ it "does not fail when the pod name contains a dash" do
377
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
378
+
379
+ command = Command.parse(['package', fixture('foo-bar.podspec')])
380
+ command.run
381
+
382
+ true.should == true # To make the test pass without any shoulds
383
+ end
384
+
385
+ it "runs with a path to a spec" do
386
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
387
+
388
+ command = Command.parse(['package', fixture('KFData.podspec')])
389
+ command.run
390
+
391
+ true.should == true # To make the test pass without any shoulds
392
+ end
393
+
394
+ it "it respects module_map directive" do
395
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
396
+
397
+ command = Command.parse(['package', fixture('FH.podspec')])
398
+ command.run
399
+
400
+ modulemap_contents = File.read(Dir.glob("FH-*/ios/FH.framework/Modules/module.modulemap").first)
401
+ module_map = <<MAP
402
+ framework module FH {
403
+ umbrella header "FeedHenry.h"
404
+
405
+ export *
406
+ module * { export * }
407
+ }
408
+ MAP
409
+ modulemap_contents.should == module_map
410
+ end
411
+
412
+ it "runs with a spec in the master repository" do
413
+ command = Command.parse(%w{ package KFData })
414
+ command.run
415
+
416
+ true.should == true # To make the test pass without any shoulds
417
+ end
418
+ end
419
+ end
420
+ end
@@ -0,0 +1,30 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Spec::Packagethk do
5
+ describe 'Subspecs' do
6
+ after do
7
+ Dir.glob("KFData-*").each { |dir| Pathname.new(dir).rmtree }
8
+ end
9
+
10
+ it 'can package a single subspec' do
11
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
12
+
13
+ command = Command.parse(%w{ package spec/fixtures/KFData.podspec --subspecs=Core})
14
+ command.run
15
+
16
+ true.should == true # To make the test pass without any shoulds
17
+ end
18
+
19
+ it 'can package a list of subspecs' do
20
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
21
+
22
+ command = Command.parse(%w{ package spec/fixtures/KFData.podspec --subspecs=Core,Compatibility})
23
+ command.run
24
+
25
+ true.should == true # To make the test pass without any shoulds
26
+ end
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,70 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+
5
+ DONT_CODESIGN = true
6
+
7
+ describe Command::Spec::Packagethk do
8
+ describe 'IntegrationTests' do
9
+ after do
10
+ Dir.glob("NikeKit-*").each { |dir| Pathname.new(dir).rmtree }
11
+ Dir.glob("LibraryDemo-*").each { |dir| Pathname.new(dir).rmtree }
12
+ FileUtils.rm_rf('spec/fixtures/PackagerTest/NikeKit.framework')
13
+ end
14
+
15
+ it 'Allow integration into project alongside CocoaPods' do
16
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
17
+
18
+ command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec })
19
+ command.run
20
+ `cp -Rp NikeKit-*/ios/NikeKit.framework spec/fixtures/PackagerTest`
21
+
22
+ log = ''
23
+
24
+ Dir.chdir('spec/fixtures/PackagerTest') do
25
+ `pod install 2>&1`
26
+ log << `xcodebuild -workspace PackagerTest.xcworkspace -scheme PackagerTest -sdk iphonesimulator CODE_SIGN_IDENTITY=- 2>&1`
27
+ end
28
+
29
+ puts log if $?.exitstatus != 0
30
+ $?.exitstatus.should == 0
31
+ end
32
+
33
+ it 'Allow integration of dynamic framework into project alongside CocoaPods' do
34
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
35
+
36
+ command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec --dynamic })
37
+ command.run
38
+ `cp -Rp NikeKit-*/ios/NikeKit.framework spec/fixtures/PackagerTest`
39
+
40
+ log = ''
41
+
42
+ Dir.chdir('spec/fixtures/PackagerTest') do
43
+ `pod install 2>&1`
44
+ log << `xcodebuild -workspace PackagerTest.xcworkspace -scheme PackagerTest -sdk iphonesimulator CODE_SIGN_IDENTITY=- 2>&1`
45
+ end
46
+
47
+ puts log if $?.exitstatus != 0
48
+ $?.exitstatus.should == 0
49
+ end
50
+
51
+ it 'allows integration of a library without dependencies' do
52
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
53
+
54
+ command = Command.parse(%w{ package spec/fixtures/LibraryDemo.podspec })
55
+ command.run
56
+
57
+ log = ''
58
+
59
+ Dir.chdir('spec/fixtures/LibraryConsumerDemo') do
60
+ `pod install 2>&1`
61
+ log << `xcodebuild -workspace LibraryConsumer.xcworkspace -scheme LibraryConsumer 2>&1`
62
+ log << `xcodebuild -sdk iphonesimulator -workspace LibraryConsumer.xcworkspace -scheme LibraryConsumer 2>&1`
63
+ end
64
+
65
+ puts log if $?.exitstatus != 0
66
+ $?.exitstatus.should == 0
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,79 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'pathname'
5
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
6
+ $:.unshift((ROOT + 'lib').to_s)
7
+ $:.unshift((ROOT + 'spec').to_s)
8
+
9
+ require 'bundler/setup'
10
+ require 'bacon'
11
+ require 'mocha-on-bacon'
12
+ require 'pretty_bacon'
13
+ require 'cocoapods'
14
+
15
+ require 'cocoapods_plugin'
16
+
17
+ #-----------------------------------------------------------------------------#
18
+
19
+ module Pod
20
+
21
+ # Disable the wrapping so the output is deterministic in the tests.
22
+ #
23
+ UI.disable_wrap = true
24
+
25
+ # Redirects the messages to an internal store.
26
+ #
27
+ module UI
28
+ @output = ''
29
+ @warnings = ''
30
+
31
+ class << self
32
+ attr_accessor :output
33
+ attr_accessor :warnings
34
+
35
+ def puts(message = '')
36
+ @output << "#{message}\n"
37
+ end
38
+
39
+ def warn(message = '', actions = [])
40
+ @warnings << "#{message}\n"
41
+ end
42
+
43
+ def print(message)
44
+ @output << message
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ #-----------------------------------------------------------------------------#
51
+
52
+ module SpecHelper
53
+ def self.fixture(name)
54
+ Fixture.fixture(name)
55
+ end
56
+
57
+ def self.temporary_directory
58
+ ROOT + 'tmp'
59
+ end
60
+
61
+ module Fixture
62
+ ROOT = Pathname('fixtures').expand_path(__dir__)
63
+
64
+ def fixture(name)
65
+ ROOT + name
66
+ end
67
+ module_function :fixture
68
+ end
69
+ end
70
+
71
+ module Bacon
72
+ class Context
73
+ include SpecHelper::Fixture
74
+
75
+ def temporary_directory
76
+ SpecHelper.temporary_directory
77
+ end
78
+ end
79
+ end