Commit cf662d16 authored by Eloy Duran's avatar Eloy Duran

Disambiguate the use of the word ‘target’.

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