Commit cf662d16 authored by Eloy Duran's avatar Eloy Duran

Disambiguate the use of the word ‘target’.

parent 30c8a1e5
......@@ -46,7 +46,7 @@ EOS
end
end
class Target
class TargetInstaller
include Config::Mixin
include Shared
......@@ -187,9 +187,9 @@ EOS
@project
end
def targets
@targets ||= @podfile.targets.values.map do |target_definition|
Target.new(@podfile, project, target_definition)
def target_installers
@target_installers ||= @podfile.target_definitions.values.map do |definition|
TargetInstaller.new(@podfile, project, definition)
end
end
......@@ -199,9 +199,9 @@ EOS
root = config.project_pods_root
puts "==> Generating Xcode project and xcconfig" unless config.silent?
targets.each do |target|
target.install!
target.create_files_in(root)
target_installers.each do |target_installer|
target_installer.install!
target_installer.create_files_in(root)
end
projpath = File.join(root, 'Pods.xcodeproj')
puts " * Writing Xcode project file to `#{projpath}'" if config.verbose?
......@@ -210,8 +210,8 @@ EOS
generate_lock_file!
# Post install hooks run last!
targets.each do |target|
target.build_specifications.each { |spec| spec.post_install(target) }
target_installers.each do |target_installer|
target_installer.build_specifications.each { |spec| spec.post_install(target_installer) }
end
end
......
module Pod
class Podfile
class Target
class TargetDefinition
attr_reader :name, :parent, :target_dependencies
def initialize(name, parent = nil)
......@@ -30,7 +30,7 @@ module Pod
include Config::Mixin
def initialize(&block)
@targets = { :default => (@target = Target.new(:default)) }
@target_definitions = { :default => (@target_definition = TargetDefinition.new(:default)) }
instance_eval(&block)
end
......@@ -138,11 +138,11 @@ module Pod
#
#
def dependency(*name_and_version_requirements, &block)
@target.target_dependencies << Dependency.new(*name_and_version_requirements, &block)
@target_definition.target_dependencies << Dependency.new(*name_and_version_requirements, &block)
end
def dependencies
@targets.values.map(&:target_dependencies).flatten
@target_definitions.values.map(&:target_dependencies).flatten
end
# Specifies that a BridgeSupport metadata should be generated from the
......@@ -154,7 +154,7 @@ module Pod
@generate_bridge_support = true
end
attr_reader :targets
attr_reader :target_definitions
# Defines a new static library target and scopes dependencies defined from
# the given block. The target will by default include the dependencies
......@@ -183,11 +183,11 @@ module Pod
# however, is an exclusive target which means it will only have one
# dependency (JSONKit).
def target(name, options = {})
parent = @target
@targets[name] = @target = Target.new(name, options[:exclusive] ? nil : parent)
parent = @target_definition
@target_definitions[name] = @target_definition = TargetDefinition.new(name, options[:exclusive] ? nil : parent)
yield
ensure
@target = parent
@target_definition = parent
end
# This is to be compatible with a Specification for use in the Installer and
......
......@@ -158,7 +158,7 @@ else
YAML.load(installer.lock_file.read).should == lock_file_contents
root = config.project_pods_root
(root + 'Pods.xcconfig').read.should == installer.targets.first.xcconfig.to_s
(root + 'Pods.xcconfig').read.should == installer.target_installers.first.xcconfig.to_s
project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s
NSDictionary.dictionaryWithContentsOfFile(project_file).should == installer.project.to_hash
......@@ -197,7 +197,7 @@ else
end
installer = SpecHelper::Installer.new(spec)
installer.targets.first.build_specifications.first.resources = 'LICEN*', 'Readme.*'
installer.target_installers.first.build_specifications.first.resources = 'LICEN*', 'Readme.*'
installer.install!
contents = (config.project_pods_root + 'Pods-resources.sh').read
......
......@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Installer" do
describe ", by default," do
before do
@xcconfig = Pod::Installer.new(Pod::Podfile.new { platform :ios }).targets.first.xcconfig.to_hash
@xcconfig = Pod::Installer.new(Pod::Podfile.new { platform :ios }).target_installers.first.xcconfig.to_hash
end
it "sets the header search paths where installed Pod headers can be found" do
......@@ -44,6 +44,6 @@ describe "Pod::Installer" do
expected << config.project_pods_root + header
end
end
installer.targets.first.bridge_support_generator.headers.should == expected
installer.target_installers.first.bridge_support_generator.headers.should == expected
end
end
......@@ -69,13 +69,13 @@ describe "Pod::Podfile" do
end
it "adds dependencies outside of any explicit target block to the default target" do
target = @podfile.targets[:default]
target = @podfile.target_definitions[:default]
target.lib_name.should == 'Pods'
target.dependencies.should == [Pod::Dependency.new('ASIHTTPRequest')]
end
it "adds dependencies of the outer target to non-exclusive targets" do
target = @podfile.targets[:debug]
target = @podfile.target_definitions[:debug]
target.lib_name.should == 'Pods-debug'
target.dependencies.sort_by(&:name).should == [
Pod::Dependency.new('ASIHTTPRequest'),
......@@ -84,7 +84,7 @@ describe "Pod::Podfile" do
end
it "does not add dependencies of the outer target to exclusive targets" do
target = @podfile.targets[:test]
target = @podfile.target_definitions[:test]
target.lib_name.should == 'Pods-test'
target.dependencies.should == [Pod::Dependency.new('JSONKit')]
end
......
......@@ -27,7 +27,7 @@ describe 'Xcodeproj::Project' do
phase = @project.targets.first.copy_files_build_phases.new_pod_dir("SomePod", "Path/To/Source")
find_object({
'isa' => 'PBXCopyFilesBuildPhase',
'dstPath' => '$(PUBLIC_HEADERS_FOLDER_PATH)/Path/To/Source',
'dstPath' => '$(PRODUCT_NAME)/Path/To/Source',
'name' => 'Copy SomePod Public Headers'
}).should.not == nil
@project.targets.first.buildPhases.should.include phase
......
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