cocoapods-packager-next 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +4 -0
  4. data/.rubocop-cocoapods.yml +71 -0
  5. data/.rubocop.yml +38 -0
  6. data/.travis.yml +17 -0
  7. data/Gemfile +12 -0
  8. data/Gemfile.lock +129 -0
  9. data/LICENSE +22 -0
  10. data/README.md +39 -0
  11. data/Rakefile +29 -0
  12. data/cocoapods-packager-next.gemspec +22 -0
  13. data/lib/cocoapods-packager/builder.rb +334 -0
  14. data/lib/cocoapods-packager/framework.rb +66 -0
  15. data/lib/cocoapods-packager/mangle.rb +32 -0
  16. data/lib/cocoapods-packager/pod_utils.rb +250 -0
  17. data/lib/cocoapods-packager/spec_builder.rb +63 -0
  18. data/lib/cocoapods-packager/symbols.rb +42 -0
  19. data/lib/cocoapods-packager/user_interface/build_failed_report.rb +15 -0
  20. data/lib/cocoapods_packager.rb +5 -0
  21. data/lib/cocoapods_plugin.rb +8 -0
  22. data/lib/pod/command/package.rb +177 -0
  23. data/scripts/lstconst.sh +9 -0
  24. data/scripts/lstsym.sh +8 -0
  25. data/spec/command/error_spec.rb +81 -0
  26. data/spec/command/package_spec.rb +420 -0
  27. data/spec/command/subspecs_spec.rb +30 -0
  28. data/spec/fixtures/Archs.podspec +13 -0
  29. data/spec/fixtures/Builder.podspec +25 -0
  30. data/spec/fixtures/CPDColors.podspec +19 -0
  31. data/spec/fixtures/FH.podspec +18 -0
  32. data/spec/fixtures/KFData.podspec +73 -0
  33. data/spec/fixtures/LibraryConsumerDemo/.gitignore +22 -0
  34. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.h +17 -0
  35. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.m +27 -0
  36. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/Info.plist +40 -0
  37. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/main.m +16 -0
  38. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.pbxproj +311 -0
  39. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  40. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/xcshareddata/xcschemes/LibraryConsumer.xcscheme +100 -0
  41. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcworkspace/contents.xcworkspacedata +10 -0
  42. data/spec/fixtures/LibraryConsumerDemo/Podfile +5 -0
  43. data/spec/fixtures/LibraryDemo.podspec +14 -0
  44. data/spec/fixtures/LocalSources/LICENSE +0 -0
  45. data/spec/fixtures/LocalSources/LocalNikeKit.h +4 -0
  46. data/spec/fixtures/LocalSources/LocalNikeKit.m +9 -0
  47. data/spec/fixtures/LocalSources/LocalNikeKit.podspec +19 -0
  48. data/spec/fixtures/NikeKit.podspec +19 -0
  49. data/spec/fixtures/OpenSans.podspec +18 -0
  50. data/spec/fixtures/PackagerTest/.gitignore +21 -0
  51. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.h +15 -0
  52. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.m +49 -0
  53. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
  54. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
  55. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Info.plist +38 -0
  56. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Prefix.pch +16 -0
  57. data/spec/fixtures/PackagerTest/PackagerTest/en.lproj/InfoPlist.strings +2 -0
  58. data/spec/fixtures/PackagerTest/PackagerTest/main.m +18 -0
  59. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.pbxproj +507 -0
  60. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  61. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/xcshareddata/xcschemes/PackagerTest.xcscheme +110 -0
  62. data/spec/fixtures/PackagerTest/PackagerTest.xcworkspace/contents.xcworkspacedata +1 -0
  63. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests-Info.plist +22 -0
  64. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests.m +34 -0
  65. data/spec/fixtures/PackagerTest/PackagerTestTests/en.lproj/InfoPlist.strings +2 -0
  66. data/spec/fixtures/PackagerTest/Podfile +10 -0
  67. data/spec/fixtures/PackagerTest/Podfile.lock +36 -0
  68. data/spec/fixtures/Weakly.podspec +13 -0
  69. data/spec/fixtures/a.podspec +19 -0
  70. data/spec/fixtures/foo-bar.podspec +19 -0
  71. data/spec/fixtures/layer-client-messaging-schema.podspec +13 -0
  72. data/spec/integration/project_spec.rb +70 -0
  73. data/spec/spec_helper.rb +79 -0
  74. data/spec/unit/pod/utils_spec.rb +58 -0
  75. data/spec/unit/specification/builder_spec.rb +62 -0
  76. data/spec/unit/specification/spec_builder_spec.rb +61 -0
  77. data/spec/unit/user_interface/build_failed_report_spec.rb +11 -0
  78. metadata +223 -0
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:PackagerTest.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,110 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "0610"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "A1DE56B419AA4A97000339C6"
18
+ BuildableName = "PackagerTest.app"
19
+ BlueprintName = "PackagerTest"
20
+ ReferencedContainer = "container:PackagerTest.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ <BuildActionEntry
24
+ buildForTesting = "YES"
25
+ buildForRunning = "YES"
26
+ buildForProfiling = "NO"
27
+ buildForArchiving = "NO"
28
+ buildForAnalyzing = "YES">
29
+ <BuildableReference
30
+ BuildableIdentifier = "primary"
31
+ BlueprintIdentifier = "A1DE56CF19AA4A97000339C6"
32
+ BuildableName = "PackagerTestTests.xctest"
33
+ BlueprintName = "PackagerTestTests"
34
+ ReferencedContainer = "container:PackagerTest.xcodeproj">
35
+ </BuildableReference>
36
+ </BuildActionEntry>
37
+ </BuildActionEntries>
38
+ </BuildAction>
39
+ <TestAction
40
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42
+ shouldUseLaunchSchemeArgsEnv = "YES"
43
+ buildConfiguration = "Debug">
44
+ <Testables>
45
+ <TestableReference
46
+ skipped = "NO">
47
+ <BuildableReference
48
+ BuildableIdentifier = "primary"
49
+ BlueprintIdentifier = "A1DE56CF19AA4A97000339C6"
50
+ BuildableName = "PackagerTestTests.xctest"
51
+ BlueprintName = "PackagerTestTests"
52
+ ReferencedContainer = "container:PackagerTest.xcodeproj">
53
+ </BuildableReference>
54
+ </TestableReference>
55
+ </Testables>
56
+ <MacroExpansion>
57
+ <BuildableReference
58
+ BuildableIdentifier = "primary"
59
+ BlueprintIdentifier = "A1DE56B419AA4A97000339C6"
60
+ BuildableName = "PackagerTest.app"
61
+ BlueprintName = "PackagerTest"
62
+ ReferencedContainer = "container:PackagerTest.xcodeproj">
63
+ </BuildableReference>
64
+ </MacroExpansion>
65
+ </TestAction>
66
+ <LaunchAction
67
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
68
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69
+ launchStyle = "0"
70
+ useCustomWorkingDirectory = "NO"
71
+ buildConfiguration = "Debug"
72
+ ignoresPersistentStateOnLaunch = "NO"
73
+ debugDocumentVersioning = "YES"
74
+ allowLocationSimulation = "YES">
75
+ <BuildableProductRunnable>
76
+ <BuildableReference
77
+ BuildableIdentifier = "primary"
78
+ BlueprintIdentifier = "A1DE56B419AA4A97000339C6"
79
+ BuildableName = "PackagerTest.app"
80
+ BlueprintName = "PackagerTest"
81
+ ReferencedContainer = "container:PackagerTest.xcodeproj">
82
+ </BuildableReference>
83
+ </BuildableProductRunnable>
84
+ <AdditionalOptions>
85
+ </AdditionalOptions>
86
+ </LaunchAction>
87
+ <ProfileAction
88
+ shouldUseLaunchSchemeArgsEnv = "YES"
89
+ savedToolIdentifier = ""
90
+ useCustomWorkingDirectory = "NO"
91
+ buildConfiguration = "Release"
92
+ debugDocumentVersioning = "YES">
93
+ <BuildableProductRunnable>
94
+ <BuildableReference
95
+ BuildableIdentifier = "primary"
96
+ BlueprintIdentifier = "A1DE56B419AA4A97000339C6"
97
+ BuildableName = "PackagerTest.app"
98
+ BlueprintName = "PackagerTest"
99
+ ReferencedContainer = "container:PackagerTest.xcodeproj">
100
+ </BuildableReference>
101
+ </BuildableProductRunnable>
102
+ </ProfileAction>
103
+ <AnalyzeAction
104
+ buildConfiguration = "Debug">
105
+ </AnalyzeAction>
106
+ <ArchiveAction
107
+ buildConfiguration = "Release"
108
+ revealArchiveInOrganizer = "YES">
109
+ </ArchiveAction>
110
+ </Scheme>
@@ -0,0 +1 @@
1
+ <?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:PackagerTest.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/></Workspace>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>${EXECUTABLE_NAME}</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundlePackageType</key>
14
+ <string>BNDL</string>
15
+ <key>CFBundleShortVersionString</key>
16
+ <string>1.0</string>
17
+ <key>CFBundleSignature</key>
18
+ <string>????</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>1</string>
21
+ </dict>
22
+ </plist>
@@ -0,0 +1,34 @@
1
+ //
2
+ // PackagerTestTests.m
3
+ // PackagerTestTests
4
+ //
5
+ // Created by Boris Bügling on 24/08/14.
6
+ // Copyright (c) 2014 CocoaPods. All rights reserved.
7
+ //
8
+
9
+ #import <XCTest/XCTest.h>
10
+
11
+ @interface PackagerTestTests : XCTestCase
12
+
13
+ @end
14
+
15
+ @implementation PackagerTestTests
16
+
17
+ - (void)setUp
18
+ {
19
+ [super setUp];
20
+ // Put setup code here. This method is called before the invocation of each test method in the class.
21
+ }
22
+
23
+ - (void)tearDown
24
+ {
25
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
26
+ [super tearDown];
27
+ }
28
+
29
+ - (void)testExample
30
+ {
31
+ XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32
+ }
33
+
34
+ @end
@@ -0,0 +1,2 @@
1
+ /* Localized versions of Info.plist keys */
2
+
@@ -0,0 +1,10 @@
1
+ source 'https://github.com/CocoaPods/Specs.git'
2
+
3
+ platform :ios, "6.0"
4
+
5
+ target "PackagerTest" do
6
+
7
+ pod 'AFNetworking'
8
+
9
+ end
10
+
@@ -0,0 +1,36 @@
1
+ PODS:
2
+ - AFNetworking (2.3.1):
3
+ - AFNetworking/NSURLConnection (= 2.3.1)
4
+ - AFNetworking/NSURLSession (= 2.3.1)
5
+ - AFNetworking/Reachability (= 2.3.1)
6
+ - AFNetworking/Security (= 2.3.1)
7
+ - AFNetworking/Serialization (= 2.3.1)
8
+ - AFNetworking/UIKit (= 2.3.1)
9
+ - AFNetworking/NSURLConnection (2.3.1):
10
+ - AFNetworking/Reachability
11
+ - AFNetworking/Security
12
+ - AFNetworking/Serialization
13
+ - AFNetworking/NSURLSession (2.3.1):
14
+ - AFNetworking/Reachability
15
+ - AFNetworking/Security
16
+ - AFNetworking/Serialization
17
+ - AFNetworking/Reachability (2.3.1)
18
+ - AFNetworking/Security (2.3.1)
19
+ - AFNetworking/Serialization (2.3.1)
20
+ - AFNetworking/UIKit (2.3.1):
21
+ - AFNetworking/NSURLConnection
22
+ - AFNetworking/NSURLSession
23
+
24
+ DEPENDENCIES:
25
+ - AFNetworking
26
+
27
+ SPEC REPOS:
28
+ https://github.com/cocoapods/specs.git:
29
+ - AFNetworking
30
+
31
+ SPEC CHECKSUMS:
32
+ AFNetworking: 05b9f6e3aa5ac45bc383b4bb108ef338080a26c7
33
+
34
+ PODFILE CHECKSUM: 5099f0db5f9f3c3a6167fc27cde4e08d429a30ec
35
+
36
+ COCOAPODS: 1.7.3
@@ -0,0 +1,13 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = "Weakly"
3
+ s.version = "0.1.0"
4
+ s.summary = "Yo"
5
+ s.homepage = "http://google.com"
6
+ s.license = "MIT"
7
+ s.author = { "Boris Bügling" => "boris@icculus.org" }
8
+ s.platform = :ios, '8.0'
9
+ s.source = { :git => "https://github.com/neonichu/CPDColors.git", :tag => s.version }
10
+ s.source_files = 'Code'
11
+
12
+ s.dependency 'PromiseKit', '~> 1.5'
13
+ end
@@ -0,0 +1,19 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'a'
3
+ s.version = '0.0.1'
4
+ s.summary = 'Objective-C implementation of the Nike+ API.'
5
+ s.homepage = 'https://github.com/neonichu/NikeKit'
6
+ s.license = {:type => 'MIT', :file => 'LICENSE'}
7
+ s.authors = { 'Boris Bügling' => 'http://buegling.com' }
8
+ s.source = { :git => 'https://github.com/neonichu/NikeKit.git', :tag => s.version.to_s }
9
+ s.platform = :ios, '8.0'
10
+
11
+ s.public_header_files = '*.h'
12
+ s.source_files = '*.{h,m}'
13
+ s.frameworks = 'Foundation'
14
+ s.requires_arc = true
15
+
16
+ s.dependency 'AFNetworking'
17
+ s.dependency 'ISO8601DateFormatter'
18
+ s.dependency 'KZPropertyMapper'
19
+ end
@@ -0,0 +1,19 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'foo-bar'
3
+ s.version = '0.0.1'
4
+ s.summary = 'Objective-C implementation of the Nike+ API.'
5
+ s.homepage = 'https://github.com/neonichu/NikeKit'
6
+ s.license = {:type => 'MIT', :file => 'LICENSE'}
7
+ s.authors = { 'Boris Bügling' => 'http://buegling.com' }
8
+ s.source = { :git => 'https://github.com/neonichu/NikeKit.git', :tag => s.version.to_s }
9
+ s.platform = :ios, '8.0'
10
+
11
+ s.public_header_files = '*.h'
12
+ s.source_files = '*.{h,m}'
13
+ s.frameworks = 'Foundation'
14
+ s.requires_arc = true
15
+
16
+ s.dependency 'AFNetworking'
17
+ s.dependency 'ISO8601DateFormatter'
18
+ s.dependency 'KZPropertyMapper'
19
+ end
@@ -0,0 +1,13 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = "layer-client-messaging-schema"
3
+ s.version = "20140715104949748"
4
+ s.summary = "Packages the database schema and migrations for layer-client-messaging-schema"
5
+ s.homepage = "http://github.com/layerhq"
6
+ s.author = { "Steven Jones" => "steven@layer.com" }
7
+ s.source = { :git => "https://github.com/neonichu/CPDColors.git",
8
+ :tag => "0.1.0" }
9
+ s.license = 'Commercial'
10
+ s.requires_arc = true
11
+ s.platform = :ios, '7.0'
12
+ s.resource_bundles = { 'layer-client-messaging-schema' => ['Code/**/*.h'] }
13
+ end
@@ -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::Package 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
@@ -0,0 +1,58 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Package do
5
+ after do
6
+ Dir.glob("Pods").each { |dir| Pathname.new(dir).rmtree }
7
+ end
8
+
9
+ it "uses additional spec repos passed on the command line" do
10
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
11
+ nil::NilClass.any_instance.stubs(:install!)
12
+ Installer.expects(:new).with {
13
+ |sandbox, podfile| podfile.sources == ['foo', 'bar']
14
+ }
15
+
16
+ command = Command.parse(%w{ package spec/fixtures/KFData.podspec --spec-sources=foo,bar})
17
+ command.send(:install_pod, :osx, nil)
18
+
19
+ end
20
+
21
+ it "uses only the master repo if no spec repos were passed" do
22
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
23
+ nil::NilClass.any_instance.stubs(:install!)
24
+ Installer.expects(:new).with {
25
+ |sandbox, podfile| podfile.sources == ['https://github.com/CocoaPods/Specs.git']
26
+ }
27
+
28
+ command = Command.parse(%w{ package spec/fixtures/KFData.podspec })
29
+ command.send(:install_pod, :osx, nil)
30
+ end
31
+
32
+ it "creates separate static and dynamic target if dynamic is passed" do
33
+ source_dir = Dir.pwd
34
+
35
+ Pod::Config.instance.sources_manager.stubs(:search).returns(nil)
36
+
37
+ command = Command.parse(%w{ package spec/fixtures/NikeKit.podspec -dynamic})
38
+ t, w = command.send(:create_working_directory)
39
+
40
+ command.config.installation_root = Pathname.new(w)
41
+ command.config.sandbox_root = 'Pods'
42
+
43
+ static_sandbox = command.send(:build_static_sandbox, true)
44
+ static_installer = command.send(:install_pod, :ios, static_sandbox)
45
+
46
+ dynamic_sandbox = command.send(:build_dynamic_sandbox, static_sandbox, static_installer)
47
+ command.send(:install_dynamic_pod, dynamic_sandbox, static_sandbox, static_installer, Platform.ios)
48
+
49
+ static_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Static")
50
+ dynamic_sandbox_dir = Dir.new(Dir.pwd << "/Pods/Dynamic")
51
+
52
+ static_sandbox_dir.to_s.should.not.be.empty
53
+ dynamic_sandbox_dir.to_s.should.not.be.empty
54
+
55
+ Dir.chdir(source_dir)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,62 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Builder do
5
+ describe 'In general' do
6
+ before do
7
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
8
+ @static_sandbox_dir = temporary_directory + 'Pods'
9
+ @installer = stub('Installer', :pod_targets => [])
10
+ @builder = Builder.new(Platform.new(:ios), @installer, nil, @static_sandbox_dir, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
11
+ end
12
+
13
+ it 'copies the license file if it exists' do
14
+ path = @static_sandbox_dir + 'Builder/LICENSE.md'
15
+ path.dirname.mkpath
16
+ File.open(path, 'w') { |f| f.puts 'Permission is granted...' }
17
+ @spec.stubs(:license).returns({ :file => 'LICENSE.md'})
18
+ FileUtils.expects(:cp).with(path, '.')
19
+ @builder.send(:copy_license)
20
+ FileUtils.rm_rf(path.dirname)
21
+ end
22
+ end
23
+
24
+ describe 'Xcodebuild command' do
25
+ describe 'compiler flags' do
26
+ before do
27
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
28
+ @installer = stub('Installer', :pod_targets => [])
29
+ end
30
+
31
+ it "includes proper compiler flags for iOS" do
32
+ @builder = Builder.new(Platform.new(:ios), @installer, nil, nil, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
33
+ @builder.expects(:xcodebuild).with("GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_Builder=PodsDummy_PodPackage_Builder' -DBASE_FLAG -DIOS_FLAG", "ARCHS='x86_64 i386 arm64 armv7 armv7s' OTHER_CFLAGS='-fembed-bitcode -Qunused-arguments'").returns(nil)
34
+ @builder.send(:compile)
35
+ end
36
+
37
+ it "includes proper compiler flags for OSX" do
38
+ @builder = Builder.new(Platform.new(:osx), @installer, nil, nil, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
39
+ @builder.expects(:xcodebuild).with("GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_Builder=PodsDummy_PodPackage_Builder' -DBASE_FLAG -DOSX_FLAG", nil).returns(nil)
40
+ @builder.send(:compile)
41
+ end
42
+ end
43
+
44
+ describe 'on build failure' do
45
+ before do
46
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
47
+ @installer = stub('Installer', :pod_targets => [])
48
+ @builder = Builder.new(Platform.new(:ios), @installer, nil, nil, nil, nil, @spec, nil, nil, nil, nil, nil, nil)
49
+ end
50
+
51
+ it 'dumps report and terminates' do
52
+ UI::BuildFailedReport.expects(:report).returns(nil)
53
+
54
+ should.raise SystemExit do
55
+ # TODO: check that it dumps report
56
+ @builder.send(:compile)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,61 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe SpecBuilder do
5
+ def compare_attributes(first_spec, second_spec, attribute_name)
6
+ first_spec.attributes_hash[attribute_name].should ==
7
+ second_spec.attributes_hash[attribute_name]
8
+
9
+ %w(ios osx).each do |platform|
10
+ first_spec.attributes_hash[platform][attribute_name].should ==
11
+ second_spec.attributes_hash[platform][attribute_name]
12
+ end
13
+ end
14
+
15
+ def specification_from_builder(builder)
16
+ spec_string = builder.spec_metadata
17
+ spec_string += builder.spec_platform(Platform.ios)
18
+ spec_string += builder.spec_platform(Platform.osx)
19
+ spec_string += builder.spec_close
20
+
21
+ return Specification.from_string(spec_string, 'Builder.podspec')
22
+ end
23
+
24
+ describe 'Preserve attributes from source specification' do
25
+ before do
26
+ @spec = Specification.from_file('spec/fixtures/Builder.podspec')
27
+ @builder = SpecBuilder.new(@spec, nil, false, nil)
28
+ end
29
+
30
+ it "preserves platform.frameworks" do
31
+ spec = specification_from_builder(@builder)
32
+ compare_attributes(spec, @spec, 'frameworks')
33
+ end
34
+
35
+ it "preserves platform.weak_frameworks" do
36
+ spec = specification_from_builder(@builder)
37
+ compare_attributes(spec, @spec, 'weak_frameworks')
38
+ end
39
+
40
+ it "preserves platform.libraries" do
41
+ spec = specification_from_builder(@builder)
42
+ compare_attributes(spec, @spec, 'libraries')
43
+ end
44
+
45
+ it "preserves platform.requires_arc" do
46
+ spec = specification_from_builder(@builder)
47
+ compare_attributes(spec, @spec, 'requires_arc')
48
+ end
49
+
50
+ it "preserves platform.deployment_target" do
51
+ spec = specification_from_builder(@builder)
52
+ compare_attributes(spec, @spec, 'deployment_target')
53
+ end
54
+
55
+ it "preserves platform.xcconfig" do
56
+ spec = specification_from_builder(@builder)
57
+ compare_attributes(spec, @spec, 'xcconfig')
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ module UserInterface
5
+ describe BuildFailedReport do
6
+ it 'should format a report correctly' do
7
+ UI::BuildFailedReport.report('a', ['b']).should == "Build command failed: a\nOutput:\n b\n"
8
+ end
9
+ end
10
+ end
11
+ end