Class: ZergXcode::Objects::PBXBuildFile

Inherits:
XcodeObject show all
Defined in:
lib/zerg_xcode/objects/pbx_build_file.rb

Overview

A build input. Points to a PBXFileRef.

Instance Attribute Summary

Attributes inherited from XcodeObject

#archive_id, #version

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XcodeObject

#[], #[]=, #_attr_hash, #attrs, #copy_metadata, from, #initialize, #isa, new, #shallow_copy, #visit, #visit_array, #visit_hash, #visit_once, #visit_value, #xref_key

Constructor Details

This class inherits a constructor from ZergXcode::XcodeObject

Class Method Details

.for(file_ref) ⇒ Object

Creates a build file for the given file reference.



39
40
41
# File 'lib/zerg_xcode/objects/pbx_build_file.rb', line 39

def self.for(file_ref)
  self.new 'fileRef' => file_ref
end

Instance Method Details

#file_typeObject

The type of the referenced file.



19
20
21
# File 'lib/zerg_xcode/objects/pbx_build_file.rb', line 19

def file_type
  self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']
end

#filenameObject

The name of the referenced file.



14
15
16
# File 'lib/zerg_xcode/objects/pbx_build_file.rb', line 14

def filename
  self['fileRef']['path']
end

#guessed_build_phase_typeObject

Guesses the type of the build phase that this file should belong to. This can be useful when figuring out which build phase to add a file to.



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/zerg_xcode/objects/pbx_build_file.rb', line 25

def guessed_build_phase_type
  case file_type
  when /\.h$/
    return 'PBXHeadersBuildPhase'
  when /^sourcecode/
    return 'PBXSourcesBuildPhase'
  when /\.framework$/, /\.ar$/
    return 'PBXFrameworksBuildPhase'
  else
    return 'PBXResourcesBuildPhase'
  end
end

#xref_nameObject

:nodoc: override xref_name to borrow the referenced object’s name



44
45
46
# File 'lib/zerg_xcode/objects/pbx_build_file.rb', line 44

def xref_name
  self['fileRef'].xref_name
end