Commit 921492d5 authored by Samuel E. Giddins's avatar Samuel E. Giddins Committed by Samuel Giddins

Introduce new Podfile DSL

wip

get tests passing

[Gemfile] Point to git for Core
parent 71ce9d47
...@@ -17,7 +17,7 @@ gem 'json', :git => 'https://github.com/segiddins/json.git', :branch => 'seg-1.7 ...@@ -17,7 +17,7 @@ gem 'json', :git => 'https://github.com/segiddins/json.git', :branch => 'seg-1.7
group :development do group :development do
cp_gem 'claide', 'CLAide' cp_gem 'claide', 'CLAide'
cp_gem 'cocoapods-core', 'Core' cp_gem 'cocoapods-core', 'Core', 'seg-podfile-refactor'
cp_gem 'cocoapods-deintegrate', 'cocoapods-deintegrate' cp_gem 'cocoapods-deintegrate', 'cocoapods-deintegrate'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader' cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins' cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
......
...@@ -7,8 +7,8 @@ GIT ...@@ -7,8 +7,8 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 0851a1e712e1e1c206ed03f67a25ef28af52fa69 revision: 3114804fac0ab28cd17ceb7d6fc29d0ca9c88e6e
branch: master branch: seg-podfile-refactor
specs: specs:
cocoapods-core (0.39.0) cocoapods-core (0.39.0)
activesupport (>= 4.0.2) activesupport (>= 4.0.2)
......
...@@ -87,15 +87,9 @@ module Pod ...@@ -87,15 +87,9 @@ module Pod
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
private protected
# Add build settings, which ensure that the pod targets can be imported def settings_to_import_pod_targets
# from the integrating target by all sort of imports, which are:
# - `#import <…>`
# - `#import "…"`
# - `@import …;` / `import …`
#
def generate_settings_to_import_pod_targets
if target.requires_frameworks? if target.requires_frameworks?
framework_header_search_paths = pod_targets.select(&:should_build?).map do |target| framework_header_search_paths = pod_targets.select(&:should_build?).map do |target|
if target.scoped? if target.scoped?
...@@ -118,17 +112,32 @@ module Pod ...@@ -118,17 +112,32 @@ module Pod
if pod_targets.any? { |t| t.should_build? && t.scoped? } if pod_targets.any? { |t| t.should_build? && t.scoped? }
build_settings['FRAMEWORK_SEARCH_PATHS'] = '"$PODS_FRAMEWORK_BUILD_PATH"' build_settings['FRAMEWORK_SEARCH_PATHS'] = '"$PODS_FRAMEWORK_BUILD_PATH"'
end end
@xcconfig.merge!(build_settings) build_settings
else else
# Make headers discoverable from $PODS_ROOT/Headers directory # Make headers discoverable from $PODS_ROOT/Headers directory
header_search_paths = target.sandbox.public_headers.search_paths(target.platform) header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
build_settings = { {
# by `#import "…"` # by `#import "…"`
'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths), 'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths),
# by `#import <…>` # by `#import <…>`
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem'), 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem'),
} }
@xcconfig.merge!(build_settings) end
end
private
# Add build settings, which ensure that the pod targets can be imported
# from the integrating target by all sort of imports, which are:
# - `#import <…>`
# - `#import "…"`
# - `@import …;` / `import …`
#
def generate_settings_to_import_pod_targets
@xcconfig.merge!(settings_to_import_pod_targets)
target.search_paths_aggregate_targets.each do |search_paths_target|
generator = AggregateXCConfig.new(search_paths_target, configuration_name)
@xcconfig.merge!(generator.settings_to_import_pod_targets)
end end
end end
......
...@@ -225,9 +225,14 @@ module Pod ...@@ -225,9 +225,14 @@ module Pod
# #
def generate_targets def generate_targets
pod_targets = generate_pod_targets(result.specs_by_target) pod_targets = generate_pod_targets(result.specs_by_target)
result.specs_by_target.map do |target_definition, _| aggregate_targets = result.specs_by_target.keys.reject(&:abstract?).map do |target_definition|
generate_target(target_definition, pod_targets) generate_target(target_definition, pod_targets)
end end
aggregate_targets.each do |target|
target.search_paths_aggregate_targets = aggregate_targets.select do |aggregate_target|
target.target_definition.targets_to_inherit_search_paths.include?(aggregate_target.target_definition)
end
end
end end
# Setup the aggregate target for a single user target # Setup the aggregate target for a single user target
...@@ -246,6 +251,7 @@ module Pod ...@@ -246,6 +251,7 @@ module Pod
if config.integrate_targets? if config.integrate_targets?
target_inspection = result.target_inspections[target_definition] target_inspection = result.target_inspections[target_definition]
raise "missing inspection: #{target_definition.name}" unless target_inspection
target.user_project = target_inspection.project target.user_project = target_inspection.project
target.client_root = target.user_project_path.dirname.realpath target.client_root = target.user_project_path.dirname.realpath
target.user_target_uuids = target_inspection.project_target_uuids target.user_target_uuids = target_inspection.project_target_uuids
...@@ -665,8 +671,9 @@ module Pod ...@@ -665,8 +671,9 @@ module Pod
inspection_result = {} inspection_result = {}
UI.section 'Inspecting targets to integrate' do UI.section 'Inspecting targets to integrate' do
inspectors = podfile.target_definition_list.map do |target_definition| inspectors = podfile.target_definition_list.map do |target_definition|
next if target_definition.abstract?
TargetInspector.new(target_definition, config.installation_root) TargetInspector.new(target_definition, config.installation_root)
end end.compact
inspectors.group_by(&:compute_project_path).each do |project_path, target_inspectors| inspectors.group_by(&:compute_project_path).each do |project_path, target_inspectors|
project = Xcodeproj::Project.open(project_path) project = Xcodeproj::Project.open(project_path)
target_inspectors.each do |inspector| target_inspectors.each do |inspector|
......
...@@ -102,18 +102,9 @@ module Pod ...@@ -102,18 +102,9 @@ module Pod
# #
def compute_targets(user_project) def compute_targets(user_project)
native_targets = user_project.native_targets native_targets = user_project.native_targets
if link_with = target_definition.link_with target = native_targets.find { |t| t.name == target_definition.name.to_s }
targets = native_targets.select { |t| link_with.include?(t.name) } targets = [target].compact
raise Informative, "Unable to find the targets named #{link_with.map { |x| "`#{x}`" }.to_sentence}" \ raise Informative, "Unable to find a target named `#{target_definition.name}`" if targets.empty?
"to link with target definition `#{target_definition.name}`" if targets.empty?
elsif target_definition.link_with_first_target?
targets = [native_targets.first].compact
raise Informative, 'Unable to find a target' if targets.empty?
else
target = native_targets.find { |t| t.name == target_definition.name.to_s }
targets = [target].compact
raise Informative, "Unable to find a target named `#{target_definition.name}`" if targets.empty?
end
targets targets
end end
......
...@@ -27,6 +27,7 @@ module Pod ...@@ -27,6 +27,7 @@ module Pod
# #
def validate def validate
validate_pod_directives validate_pod_directives
validate_no_abstract_only_pods!
@validated = true @validated = true
end end
...@@ -38,7 +39,7 @@ module Pod ...@@ -38,7 +39,7 @@ module Pod
def valid? def valid?
validate unless @validated validate unless @validated
@validated && errors.size == 0 @validated && errors.empty?
end end
# A message describing any errors in the # A message describing any errors in the
...@@ -81,6 +82,22 @@ module Pod ...@@ -81,6 +82,22 @@ module Pod
' download strategies. This is not allowed' ' download strategies. This is not allowed'
end end
end end
def validate_no_abstract_only_pods!
abstract_pods = ->(target_definition) do
if !target_definition.abstract? || !target_definition.children.empty?
target_definition.children.flat_map do |td|
abstract_pods[td]
end
else
target_definition.dependencies
end
end
pods = podfile.root_target_definitions.flat_map(&abstract_pods).uniq
pods.each do |pod|
add_error "The dependency `#{pod}` is not used in any concrete target."
end
end
end end
end end
end end
...@@ -17,6 +17,7 @@ module Pod ...@@ -17,6 +17,7 @@ module Pod
@target_definition = target_definition @target_definition = target_definition
@sandbox = sandbox @sandbox = sandbox
@pod_targets = [] @pod_targets = []
@search_paths_aggregate_targets = []
@file_accessors = [] @file_accessors = []
@xcconfigs = {} @xcconfigs = {}
end end
...@@ -103,6 +104,8 @@ module Pod ...@@ -103,6 +104,8 @@ module Pod
# #
attr_accessor :pod_targets attr_accessor :pod_targets
attr_accessor :search_paths_aggregate_targets
# @param [String] build_configuration The build configuration for which the # @param [String] build_configuration The build configuration for which the
# the pod targets should be returned. # the pod targets should be returned.
# #
......
...@@ -665,12 +665,14 @@ module Pod ...@@ -665,12 +665,14 @@ module Pod
urls = source_urls urls = source_urls
Pod::Podfile.new do Pod::Podfile.new do
urls.each { |u| source(u) } urls.each { |u| source(u) }
use_frameworks!(use_frameworks) target 'App' do
platform(platform_name, deployment_target) use_frameworks!(use_frameworks)
if local platform(platform_name, deployment_target)
pod name, :path => podspec.dirname.to_s if local
else pod name, :path => podspec.dirname.to_s
pod name, :podspec => podspec.to_s else
pod name, :podspec => podspec.to_s
end
end end
end end
end end
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
//
// SampleProjectTests.m
// SampleProjectTests
//
// Created by Samuel Giddins on 9/7/15.
// Copyright © 2015 LJR Software Limited. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface SampleProjectTests : XCTestCase
@end
@implementation SampleProjectTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end
...@@ -58,8 +58,7 @@ module Pod ...@@ -58,8 +58,7 @@ module Pod
describe '#compute_targets' do describe '#compute_targets' do
it 'returns the targets specified in the target definition' do it 'returns the targets specified in the target definition' do
target_definition = Podfile::TargetDefinition.new(:default, nil) target_definition = Podfile::TargetDefinition.new('UserTarget', nil)
target_definition.link_with = ['UserTarget']
user_project = Xcodeproj::Project.new('path') user_project = Xcodeproj::Project.new('path')
user_project.new_target(:application, 'FirstTarget', :ios) user_project.new_target(:application, 'FirstTarget', :ios)
user_project.new_target(:application, 'UserTarget', :ios) user_project.new_target(:application, 'UserTarget', :ios)
...@@ -70,13 +69,12 @@ module Pod ...@@ -70,13 +69,12 @@ module Pod
end end
it 'raises if it is unable to find the targets specified by the target definition' do it 'raises if it is unable to find the targets specified by the target definition' do
target_definition = Podfile::TargetDefinition.new(:default, nil) target_definition = Podfile::TargetDefinition.new('UserTarget', nil)
target_definition.link_with = %w(UserTarget AnotherUserTarget)
user_project = Xcodeproj::Project.new('path') user_project = Xcodeproj::Project.new('path')
target_inspector = TargetInspector.new(target_definition, config.installation_root) target_inspector = TargetInspector.new(target_definition, config.installation_root)
e = lambda { target_inspector.send(:compute_targets, user_project) }.should.raise Informative e = lambda { target_inspector.send(:compute_targets, user_project) }.should.raise Informative
e.message.should.match /Unable to find the targets named `UserTarget` and `AnotherUserTarget`/ e.message.should.match /Unable to find a target named `UserTarget`/
end end
it 'returns the target with the same name of the target definition' do it 'returns the target with the same name of the target definition' do
...@@ -98,27 +96,6 @@ module Pod ...@@ -98,27 +96,6 @@ module Pod
e = lambda { target_inspector.send(:compute_targets, user_project) }.should.raise Informative e = lambda { target_inspector.send(:compute_targets, user_project) }.should.raise Informative
e.message.should.match /Unable to find a target named/ e.message.should.match /Unable to find a target named/
end end
it 'returns the first target of the project if the target definition is named default' do
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true
user_project = Xcodeproj::Project.new('path')
user_project.new_target(:application, 'FirstTarget', :ios)
user_project.new_target(:application, 'UserTarget', :ios)
target_inspector = TargetInspector.new(target_definition, config.installation_root)
targets = target_inspector.send(:compute_targets, user_project)
targets.map(&:name).should == ['FirstTarget']
end
it 'raises if the default target definition cannot be linked because there are no user targets' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
user_project = Xcodeproj::Project.new('path')
target_inspector = TargetInspector.new(target_definition, config.installation_root)
e = lambda { target_inspector.send(:compute_targets, user_project) }.should.raise Informative
e.message.should.match /Unable to find a target/
end
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -7,14 +7,19 @@ module Pod ...@@ -7,14 +7,19 @@ module Pod
@podfile = Pod::Podfile.new do @podfile = Pod::Podfile.new do
platform :ios, '6.0' platform :ios, '6.0'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
pod 'JSONKit', '1.5pre'
pod 'AFNetworking', '1.0.1'
pod 'SVPullToRefresh', '0.4'
pod 'libextobjc/EXTKeyPathCoding', '0.2.3'
target 'TestRunner' do target 'SampleProject' do
pod 'JSONKit', '1.5pre'
pod 'AFNetworking', '1.0.1'
pod 'SVPullToRefresh', '0.4'
pod 'libextobjc/EXTKeyPathCoding', '0.2.3' pod 'libextobjc/EXTKeyPathCoding', '0.2.3'
pod 'libextobjc/EXTSynthesize', '0.2.3'
target 'TestRunner' do
inherit! :search_paths
pod 'libextobjc/EXTKeyPathCoding', '0.2.3'
pod 'libextobjc/EXTSynthesize', '0.2.3'
end
end end
end end
...@@ -131,9 +136,9 @@ module Pod ...@@ -131,9 +136,9 @@ module Pod
'JSONKit', 'JSONKit',
'AFNetworking', 'AFNetworking',
'SVPullToRefresh', 'SVPullToRefresh',
'Pods-libextobjc', 'Pods-SampleProject-libextobjc',
].sort ].sort
target.support_files_dir.should == config.sandbox.target_support_files_dir('Pods') target.support_files_dir.should == config.sandbox.target_support_files_dir('Pods-SampleProject')
target.pod_targets.map(&:archs).uniq.should == [[]] target.pod_targets.map(&:archs).uniq.should == [[]]
...@@ -187,22 +192,24 @@ module Pod ...@@ -187,22 +192,24 @@ module Pod
source SpecHelper.test_repo_url source SpecHelper.test_repo_url
platform :ios, '6.0' platform :ios, '6.0'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
pod 'BananaLib' target 'SampleProject' do
pod 'monkey'
target 'TestRunner' do
pod 'BananaLib' pod 'BananaLib'
pod 'monkey' pod 'monkey'
target 'TestRunner' do
pod 'BananaLib'
pod 'monkey'
end
end end
end end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
analyzer.analyze analyzer.analyze
analyzer.analyze.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == %w( analyzer.analyze.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == %w(
Pods/BananaLib Pods-SampleProject-TestRunner/BananaLib
Pods/monkey Pods-SampleProject-TestRunner/monkey
Pods-TestRunner/BananaLib Pods-SampleProject/BananaLib
Pods-TestRunner/monkey Pods-SampleProject/monkey
).sort ).sort
end end
...@@ -214,9 +221,11 @@ module Pod ...@@ -214,9 +221,11 @@ module Pod
pod 'BananaLib' pod 'BananaLib'
pod 'monkey' pod 'monkey'
target 'TestRunner' do target 'SampleProject' do
pod 'BananaLib' target 'TestRunner' do
pod 'monkey' pod 'BananaLib'
pod 'monkey'
end
end end
target 'CLITool' do target 'CLITool' do
...@@ -228,11 +237,11 @@ module Pod ...@@ -228,11 +237,11 @@ module Pod
analyzer.analyze analyzer.analyze
analyzer.analyze.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == %w( analyzer.analyze.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == %w(
Pods/Pods-BananaLib
Pods/Pods-monkey
Pods-TestRunner/Pods-TestRunner-BananaLib
Pods-TestRunner/Pods-TestRunner-monkey
Pods-CLITool/Pods-CLITool-monkey Pods-CLITool/Pods-CLITool-monkey
Pods-SampleProject-TestRunner/Pods-SampleProject-TestRunner-BananaLib
Pods-SampleProject-TestRunner/Pods-SampleProject-TestRunner-monkey
Pods-SampleProject/Pods-SampleProject-BananaLib
Pods-SampleProject/Pods-SampleProject-monkey
).sort ).sort
end end
end end
...@@ -335,8 +344,10 @@ module Pod ...@@ -335,8 +344,10 @@ module Pod
podfile = Podfile.new do podfile = Podfile.new do
platform :ios, '8.0' platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
pod 'AFNetworking' target 'SampleProject' do
pod 'AFNetworkActivityLogger' pod 'AFNetworking'
pod 'AFNetworkActivityLogger'
end
end end
hash = {} hash = {}
hash['PODS'] = [ hash['PODS'] = [
...@@ -367,7 +378,9 @@ module Pod ...@@ -367,7 +378,9 @@ module Pod
podfile = Podfile.new do podfile = Podfile.new do
platform :ios, '8.0' platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
pod 'ARAnalytics/Mixpanel' target 'SampleProject' do
pod 'ARAnalytics/Mixpanel'
end
end end
hash = {} hash = {}
hash['PODS'] = ['ARAnalytics/CoreIOS (2.8.0)', { 'ARAnalytics/Mixpanel (2.8.0)' => ['ARAnlytics/CoreIOS', 'Mixpanel'] }, 'Mixpanel (2.5.1)'] hash['PODS'] = ['ARAnalytics/CoreIOS (2.8.0)', { 'ARAnalytics/Mixpanel (2.8.0)' => ['ARAnlytics/CoreIOS', 'Mixpanel'] }, 'Mixpanel (2.5.1)']
...@@ -454,9 +467,6 @@ module Pod ...@@ -454,9 +467,6 @@ module Pod
'libextobjc/EXTKeyPathCoding (0.2.3)', 'libextobjc/EXTKeyPathCoding (0.2.3)',
] ]
@analyzer.analyze.targets[1].pod_targets.map(&:specs).flatten.map(&:to_s).should == [ @analyzer.analyze.targets[1].pod_targets.map(&:specs).flatten.map(&:to_s).should == [
'AFNetworking (1.0.1)',
'JSONKit (1.5pre)',
'SVPullToRefresh (0.4)',
'libextobjc/EXTKeyPathCoding (0.2.3)', 'libextobjc/EXTKeyPathCoding (0.2.3)',
'libextobjc/EXTSynthesize (0.2.3)', 'libextobjc/EXTSynthesize (0.2.3)',
] ]
...@@ -469,8 +479,10 @@ module Pod ...@@ -469,8 +479,10 @@ module Pod
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
platform :ios, '8.0' platform :ios, '8.0'
pod 'RestKit', '~> 0.23.0' target 'SampleProject' do
pod 'RestKit', '<= 0.23.2' pod 'RestKit', '~> 0.23.0'
pod 'RestKit', '<= 0.23.2'
end
end end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
analyzer.analyze analyzer.analyze
...@@ -542,8 +554,10 @@ module Pod ...@@ -542,8 +554,10 @@ module Pod
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
platform :ios platform :ios
pod 'SEGModules', :git => 'https://github.com/segiddins/SEGModules.git' target 'SampleProject' do
pod 'SEGModules', :git => 'https://github.com/segiddins/Modules.git' pod 'SEGModules', :git => 'https://github.com/segiddins/SEGModules.git'
pod 'SEGModules', :git => 'https://github.com/segiddins/Modules.git'
end
end end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
e = should.raise(Informative) { analyzer.analyze } e = should.raise(Informative) { analyzer.analyze }
...@@ -559,8 +573,10 @@ module Pod ...@@ -559,8 +573,10 @@ module Pod
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
platform :ios platform :ios
pod 'RestKit/Core', :git => 'https://github.com/RestKit/RestKit.git' target 'SampleProject' do
pod 'RestKit', :git => 'https://github.com/segiddins/RestKit.git' pod 'RestKit/Core', :git => 'https://github.com/RestKit/RestKit.git'
pod 'RestKit', :git => 'https://github.com/segiddins/RestKit.git'
end
end end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
e = should.raise(Informative) { analyzer.analyze } e = should.raise(Informative) { analyzer.analyze }
...@@ -576,8 +592,10 @@ module Pod ...@@ -576,8 +592,10 @@ module Pod
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
platform :ios platform :ios
pod 'RestKit', :git => 'https://github.com/RestKit/RestKit.git' target 'SampleProject' do
pod 'RestKit', '~> 0.23.0' pod 'RestKit', :git => 'https://github.com/RestKit/RestKit.git'
pod 'RestKit', '~> 0.23.0'
end
end end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
e = should.raise(Informative) { analyzer.analyze } e = should.raise(Informative) { analyzer.analyze }
...@@ -591,7 +609,9 @@ module Pod ...@@ -591,7 +609,9 @@ module Pod
describe 'using lockfile checkout options' do describe 'using lockfile checkout options' do
before do before do
@podfile = Pod::Podfile.new do @podfile = Pod::Podfile.new do
pod 'BananaLib', :git => 'example.com' target 'SampleProject' do
pod 'BananaLib', :git => 'example.com'
end
end end
@dependency = @podfile.dependencies.first @dependency = @podfile.dependencies.first
......
...@@ -5,6 +5,7 @@ module Pod ...@@ -5,6 +5,7 @@ module Pod
describe 'podspec/path in combination with other download strategies' do describe 'podspec/path in combination with other download strategies' do
it 'validates that podspec is not used in combination with other download strategies' do it 'validates that podspec is not used in combination with other download strategies' do
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
abstract!(false)
pod 'JSONKit', :podspec => 'https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/JSONKit/1.5pre/JSONKit.podspec.json', pod 'JSONKit', :podspec => 'https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/JSONKit/1.5pre/JSONKit.podspec.json',
:git => 'git@github.com:johnezang/JSONKit.git' :git => 'git@github.com:johnezang/JSONKit.git'
end end
...@@ -19,6 +20,7 @@ module Pod ...@@ -19,6 +20,7 @@ module Pod
it 'validates that path is not used in combination with other download strategies' do it 'validates that path is not used in combination with other download strategies' do
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
abstract!(false)
pod 'JSONKit', :path => './JSONKit/1.5pre/JSONKit.podspec.json', pod 'JSONKit', :path => './JSONKit/1.5pre/JSONKit.podspec.json',
:git => 'git@github.com:johnezang/JSONKit.git' :git => 'git@github.com:johnezang/JSONKit.git'
end end
...@@ -33,6 +35,7 @@ module Pod ...@@ -33,6 +35,7 @@ module Pod
it 'validates when calling `valid?` before calling `validate`' do it 'validates when calling `valid?` before calling `validate`' do
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
abstract!(false)
pod 'JSONKit', :path => './JSONKit/1.5pre/JSONKit.podspec.json', pod 'JSONKit', :path => './JSONKit/1.5pre/JSONKit.podspec.json',
:git => 'git@github.com:johnezang/JSONKit.git' :git => 'git@github.com:johnezang/JSONKit.git'
end end
...@@ -47,6 +50,7 @@ module Pod ...@@ -47,6 +50,7 @@ module Pod
describe 'multiple download strategies' do describe 'multiple download strategies' do
it 'validates that only one download strategy is specified' do it 'validates that only one download strategy is specified' do
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
abstract!(false)
pod 'JSONKit', :svn => 'svn.example.com/JSONKit', pod 'JSONKit', :svn => 'svn.example.com/JSONKit',
:git => 'git@github.com:johnezang/JSONKit.git' :git => 'git@github.com:johnezang/JSONKit.git'
end end
......
...@@ -19,7 +19,12 @@ def generate_podfile(pods = ['JSONKit']) ...@@ -19,7 +19,12 @@ def generate_podfile(pods = ['JSONKit'])
Pod::Podfile.new do Pod::Podfile.new do
platform :ios platform :ios
xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pods.each { |name| pod name } target 'SampleProject' do
pods.each { |name| pod name }
target 'SampleProjectTests' do
inherit! :search_paths
end
end
end end
end end
...@@ -29,7 +34,12 @@ def generate_local_podfile ...@@ -29,7 +34,12 @@ def generate_local_podfile
Pod::Podfile.new do Pod::Podfile.new do
platform :ios platform :ios
xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pod 'Reachability', :path => SpecHelper.fixture('integration/Reachability') target 'SampleProject' do
pod 'Reachability', :path => SpecHelper.fixture('integration/Reachability')
target 'SampleProjectTests' do
inherit! :search_paths
end
end
end end
end end
...@@ -226,7 +236,9 @@ module Pod ...@@ -226,7 +236,9 @@ module Pod
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s pod 'monkey', :path => (fixture_path + 'monkey').to_s
target 'TestRunner', :exclusive => true do target 'SampleProject'
target 'TestRunner' do
inherit! :search_paths
pod 'monkey', :path => (fixture_path + 'monkey').to_s pod 'monkey', :path => (fixture_path + 'monkey').to_s
end end
end end
...@@ -262,6 +274,7 @@ module Pod ...@@ -262,6 +274,7 @@ module Pod
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s pod 'monkey', :path => (fixture_path + 'monkey').to_s
target 'SampleProject'
end end
lockfile = generate_lockfile lockfile = generate_lockfile
config.integrate_targets = false config.integrate_targets = false
...@@ -304,6 +317,7 @@ module Pod ...@@ -304,6 +317,7 @@ module Pod
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s pod 'monkey', :path => (fixture_path + 'monkey').to_s
target 'SampleProject'
end end
@lockfile = generate_lockfile @lockfile = generate_lockfile
...@@ -345,6 +359,7 @@ module Pod ...@@ -345,6 +359,7 @@ module Pod
platform :ios, '8.0' platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject' xcodeproj 'SampleProject/SampleProject'
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
target 'SampleProject'
end end
lockfile = generate_lockfile lockfile = generate_lockfile
config.integrate_targets = false config.integrate_targets = false
...@@ -387,7 +402,7 @@ module Pod ...@@ -387,7 +402,7 @@ module Pod
it 'stores the targets created by the analyzer' do it 'stores the targets created by the analyzer' do
@installer.send(:analyze) @installer.send(:analyze)
@installer.aggregate_targets.map(&:name).sort.should == ['Pods'] @installer.aggregate_targets.map(&:name).sort.should == ["Pods-SampleProject", "Pods-SampleProjectTests"]
@installer.pod_targets.map(&:name).sort.should == ['JSONKit'] @installer.pod_targets.map(&:name).sort.should == ['JSONKit']
end end
...@@ -395,7 +410,7 @@ module Pod ...@@ -395,7 +410,7 @@ module Pod
@installer.update = true @installer.update = true
Installer::Analyzer.any_instance.expects(:update=).with(true) Installer::Analyzer.any_instance.expects(:update=).with(true)
@installer.send(:analyze) @installer.send(:analyze)
@installer.aggregate_targets.map(&:name).sort.should == ['Pods'] @installer.aggregate_targets.map(&:name).sort.should == ["Pods-SampleProject", "Pods-SampleProjectTests"]
@installer.pod_targets.map(&:name).sort.should == ['JSONKit'] @installer.pod_targets.map(&:name).sort.should == ['JSONKit']
end end
end end
...@@ -458,6 +473,7 @@ module Pod ...@@ -458,6 +473,7 @@ module Pod
platform :osx, '10.10' platform :osx, '10.10'
pod 'CargoBay', '2.1.0' pod 'CargoBay', '2.1.0'
pod 'AFNetworking/NSURLSession', :head pod 'AFNetworking/NSURLSession', :head
abstract!(false)
end end
@installer.stubs(:podfile).returns(podfile) @installer.stubs(:podfile).returns(podfile)
@installer.stubs(:lockfile).returns(nil) @installer.stubs(:lockfile).returns(nil)
......
...@@ -321,7 +321,7 @@ module Pod ...@@ -321,7 +321,7 @@ module Pod
validator.stubs(:validate_url) validator.stubs(:validate_url)
validator.stubs(:validate_screenshots) validator.stubs(:validate_screenshots)
podfile = validator.send(:podfile_from_spec, :ios, '5.0') podfile = validator.send(:podfile_from_spec, :ios, '5.0')
dependency = podfile.target_definitions['Pods'].dependencies.first dependency = podfile.target_definitions['App'].dependencies.first
dependency.external_source.key?(:podspec).should.be.true dependency.external_source.key?(:podspec).should.be.true
end end
...@@ -358,7 +358,7 @@ module Pod ...@@ -358,7 +358,7 @@ module Pod
it 'configures the deployment target' do it 'configures the deployment target' do
podfile = @validator.send(:podfile_from_spec, :ios, '5.0') podfile = @validator.send(:podfile_from_spec, :ios, '5.0')
target_definition = podfile.target_definitions['Pods'] target_definition = podfile.target_definitions['App']
platform = target_definition.platform platform = target_definition.platform
platform.symbolic_name.should == :ios platform.symbolic_name.should == :ios
platform.deployment_target.to_s.should == '5.0' platform.deployment_target.to_s.should == '5.0'
...@@ -366,13 +366,13 @@ module Pod ...@@ -366,13 +366,13 @@ module Pod
it 'includes the use_frameworks! directive' do it 'includes the use_frameworks! directive' do
podfile = @validator.send(:podfile_from_spec, :ios, '5.0', true) podfile = @validator.send(:podfile_from_spec, :ios, '5.0', true)
target_definition = podfile.target_definitions['Pods'] target_definition = podfile.target_definitions['App']
target_definition.uses_frameworks?.should == true target_definition.uses_frameworks?.should == true
end end
it 'includes the use_frameworks!(false) directive' do it 'includes the use_frameworks!(false) directive' do
podfile = @validator.send(:podfile_from_spec, :ios, '5.0', false) podfile = @validator.send(:podfile_from_spec, :ios, '5.0', false)
target_definition = podfile.target_definitions['Pods'] target_definition = podfile.target_definitions['App']
# rubocop:disable Style/DoubleNegation # rubocop:disable Style/DoubleNegation
(!!target_definition.uses_frameworks?).should == false (!!target_definition.uses_frameworks?).should == false
# rubocop:enable Style/DoubleNegation # rubocop:enable Style/DoubleNegation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment