class Xcodeproj::Project::Object::FileReferencesFactory
def configure_defaults_for_file_reference(ref)
-
(void)-
Other tags:
- Note: - To closely match the Xcode behaviour the name attribute of
Parameters:
-
ref(PBXFileReference) --
def configure_defaults_for_file_reference(ref) if ref.path.include?('/') ref.name = ref.path.split('/').last end if File.extname(ref.path).downcase == '.framework' ref.include_in_index = nil end end
def new_bundle(group, product_name)
-
(PBXFileReference)- The new file reference.
Parameters:
-
product_name(#to_s) -- -
group(PBXGroup) --
def new_bundle(group, product_name) ref = new_reference(group, "#{product_name}.bundle", :built_products) ref.include_in_index = '0' ref.set_explicit_file_type("wrapper.cfbundle") ref end
def new_file_reference(group, path, source_tree)
-
(PBXFileReference)- The new file reference.
Parameters:
-
source_tree(Symbol) -- -
path(#to_s) -- -
group(PBXGroup) --
def new_file_reference(group, path, source_tree) path = Pathname.new(path) ref = group.project.new(PBXFileReference) group.children << ref GroupableHelper.set_path_with_source_tree(ref, path, source_tree) ref.set_last_known_file_type ref end
def new_product_ref_for_target(group, target_name, product_type)
-
(PBXFileReference)- The new file reference.
Parameters:
-
product_name(#to_s) -- -
group(PBXGroup) --
def new_product_ref_for_target(group, target_name, product_type) if product_type == :static_library prefix = 'lib' end extension = Constants::PRODUCT_UTI_EXTENSIONS[product_type] ref = new_reference(group, "#{prefix}#{target_name}.#{extension}", :built_products) ref.include_in_index = '0' ref.set_explicit_file_type ref end
def new_reference(group, path, source_tree)
-
(PBXFileReference, XCVersionGroup)- The new reference.
Parameters:
-
source_tree(Symbol) -- -
path(#to_s) -- -
group(PBXGroup) --
def new_reference(group, path, source_tree) if File.extname(path).downcase == '.xcdatamodeld' ref = new_xcdatamodeld(group, path, source_tree) else ref = new_file_reference(group, path, source_tree) end configure_defaults_for_file_reference(ref) ref end
def new_xcdatamodeld(group, path, source_tree)
-
(XCVersionGroup)- The new reference.
Other tags:
- Note: - To match Xcode behaviour the current version is read from
Parameters:
-
source_tree(Symbol) -- -
path(#to_s) -- -
group(PBXGroup) --
def new_xcdatamodeld(group, path, source_tree) path = Pathname.new(path) ref = group.project.new(XCVersionGroup) group.children << ref GroupableHelper.set_path_with_source_tree(ref, path, source_tree) ref.version_group_type = 'wrapper.xcdatamodel' current_version_name = nil if path.exist? path.children.each do |child_path| if File.extname(child_path) == '.xcdatamodel' child_ref = new_file_reference(ref, child_path, :group) last_child_ref = child_ref elsif File.basename(child_path) == '.xccurrentversion' full_path = path + File.basename(child_path) xccurrentversion = Xcodeproj.read_plist(full_path) current_version_name = xccurrentversion['_XCCurrentVersionName'] end end if current_version_name ref.current_version = ref.children.find do |obj| obj.path.split('/').last == current_version_name end end end ref end