Class: Xcodeproj::Helper::TargetDiff
- Inherits:
-
Object
- Object
- Xcodeproj::Helper::TargetDiff
- Defined in:
- lib/xcodeproj/helper.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#target1 ⇒ Object
readonly
Returns the value of attribute target1.
-
#target2 ⇒ Object
readonly
Returns the value of attribute target2.
Instance Method Summary collapse
-
#initialize(project, target1_name, target2_name) ⇒ TargetDiff
constructor
A new instance of TargetDiff.
-
#new_source_build_files ⇒ Array<PBXBuildFile>
A list of source files (that will be compiled) which are in ‘target 2’ but not in ‘target 1’.
Constructor Details
#initialize(project, target1_name, target2_name) ⇒ TargetDiff
Returns a new instance of TargetDiff.
6 7 8 9 10 11 12 13 14 |
# File 'lib/xcodeproj/helper.rb', line 6 def initialize(project, target1_name, target2_name) @project = project unless @target1 = @project.targets.find { |target| target.name == target1_name } raise ArgumentError, "Target 1 by name `#{target1_name}' not found in the project." end unless @target2 = @project.targets.find { |target| target.name == target2_name } raise ArgumentError, "Target 1 by name `#{target2_name}' not found in the project." end end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
4 5 6 |
# File 'lib/xcodeproj/helper.rb', line 4 def project @project end |
#target1 ⇒ Object (readonly)
Returns the value of attribute target1.
4 5 6 |
# File 'lib/xcodeproj/helper.rb', line 4 def target1 @target1 end |
#target2 ⇒ Object (readonly)
Returns the value of attribute target2.
4 5 6 |
# File 'lib/xcodeproj/helper.rb', line 4 def target2 @target2 end |
Instance Method Details
#new_source_build_files ⇒ Array<PBXBuildFile>
Returns A list of source files (that will be compiled) which are in ‘target 2’ but not in ‘target 1’. The list is sorted by file path.
20 21 22 23 24 25 26 27 |
# File 'lib/xcodeproj/helper.rb', line 20 def new_source_build_files new = @target2.source_build_phase.files.reject do |target2_build_file| @target1.source_build_phase.files.any? do |target1_build_file| target1_build_file.file_ref.path == target2_build_file.file_ref.path end end new.sort_by { |build_file| build_file.file_ref.path } end |