Module: Xcode::FileReference
- Defined in:
- lib/xcode/file_reference.rb
Overview
Within the project file the FileReference represents a large number of objects related to files like source files, resources, frameworks, and system libraries.
A FileReference is used as input to add to the various Build Phases.
Instance Attribute Summary collapse
-
#supergroup ⇒ Group
This is the group for which this file is contained within.
Class Method Summary collapse
-
.app_product(name) ⇒ Hash
App product properties.
-
.file(properties) ⇒ Hash
Generate the properties for a file.
-
.framework(properties) ⇒ Hash
Generate the properties for a framework.
-
.system_framework(name, properties = {}) ⇒ Hash
Generate the properties for a system framework.
-
.system_library(name, properties = {}) ⇒ Hash
Generate the properties for a system library.
Instance Method Summary collapse
-
#remove! {|_self| ... } ⇒ Object
Remove the given file from the project and the supergroup of the file.
Instance Attribute Details
#supergroup ⇒ Group
This is the group for which this file is contained within.
16 17 18 |
# File 'lib/xcode/file_reference.rb', line 16 def supergroup @supergroup end |
Class Method Details
.app_product(name) ⇒ Hash
Returns app product properties.
116 117 118 119 120 121 122 |
# File 'lib/xcode/file_reference.rb', line 116 def self.app_product(name) { 'isa' => 'PBXFileReference', 'explicitFileType' => 'wrapper.application', 'includeInIndex' => 0, 'path' => "#{name}.app", 'sourceTree' => "BUILT_PRODUCTS_DIR" } end |
.file(properties) ⇒ Hash
a ‘name’ and ‘path’ key need to be specified in the framework for the framework to be added correctly.
Generate the properties for a file. A name and a path option need to be specified in the properties.
28 29 30 31 32 33 34 |
# File 'lib/xcode/file_reference.rb', line 28 def self.file(properties) default_properties = { 'isa' => 'PBXFileReference', 'path' => nil, 'sourceTree' => '<group>' } default_properties.merge(properties) end |
.framework(properties) ⇒ Hash
a ‘name’ and ‘path’ key need to be specified in the framework for the framework to be added correctly.
Generate the properties for a framework. A name and a path option need to be specified in the properties
46 47 48 49 50 51 52 53 54 |
# File 'lib/xcode/file_reference.rb', line 46 def self.framework(properties) default_properties = { 'isa' => "PBXFileReference", 'lastKnownFileType' => "wrapper.framework", 'name' => "FRAMEWORK.framework", 'path' => "FRAMEWORK.framework", 'sourceTree' => "<group>" } default_properties.merge(properties) end |
.system_framework(name, properties = {}) ⇒ Hash
Generate the properties for a system framework.
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/xcode/file_reference.rb', line 69 def self.system_framework(name,properties = {}) name = name.gsub(File.extname(name),"") default_properties = { 'isa' => 'PBXFileReference', 'lastKnownFileType' => 'wrapper.framework', 'name' => "#{name}.framework", 'path' => "System/Library/Frameworks/#{name}.framework", "sourceTree" => "SDKROOT" } default_properties.merge(properties) end |
.system_library(name, properties = {}) ⇒ Hash
Generate the properties for a system library
93 94 95 96 97 98 99 100 101 |
# File 'lib/xcode/file_reference.rb', line 93 def self.system_library(name,properties = {}) default_properties = { 'isa' => 'PBXFileReference', 'lastKnownFileType' => 'compiled.mach-o.dylib', 'name' => name, 'path' => "usr/lib/#{name}", "sourceTree" => "SDKROOT" } default_properties.merge(properties) end |
Instance Method Details
#remove! {|_self| ... } ⇒ Object
Remove the given file from the project and the supergroup of the file.
127 128 129 130 131 132 133 |
# File 'lib/xcode/file_reference.rb', line 127 def remove! # @todo the removal here does not consider if the files have # been specified within a build phase. yield self if block_given? supergroup.children.delete identifier if supergroup @registry.remove_object identifier end |