Class: Filemerger::XcodeHelper
- Inherits:
-
Object
- Object
- Filemerger::XcodeHelper
- Defined in:
- lib/filemerger/xcode_helper.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #add_file_to_project(file_path, file_name) ⇒ Object
- #delete_file_from_build_phases(file) ⇒ Object
-
#initialize(config) ⇒ XcodeHelper
constructor
A new instance of XcodeHelper.
Constructor Details
#initialize(config) ⇒ XcodeHelper
Returns a new instance of XcodeHelper.
8 9 10 11 |
# File 'lib/filemerger/xcode_helper.rb', line 8 def initialize(config) @project = Xcodeproj::Project.open(config.xcode_project) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/filemerger/xcode_helper.rb', line 6 def config @config end |
#project ⇒ Object
Returns the value of attribute project.
5 6 7 |
# File 'lib/filemerger/xcode_helper.rb', line 5 def project @project end |
Instance Method Details
#add_file_to_project(file_path, file_name) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/filemerger/xcode_helper.rb', line 13 def add_file_to_project(file_path, file_name) group = project[File.dirname(file_path)] unless group.nil? xcode_file = group.new_file(file_name) targets = get_targets_from_config targets.each do |t| t.add_file_references([xcode_file]) end return true else Poster.post_no_group_found(File.dirname(file_path)) return false end end |
#delete_file_from_build_phases(file) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/filemerger/xcode_helper.rb', line 28 def delete_file_from_build_phases(file) build_phases = build_phases_from_targets return if build_phases.nil? build_phases.each do |build_phase| build_phase.files.each do |build_file| next if build_file.nil? || build_file.file_ref.nil? build_file_path = configure_file_ref_path(build_file.file_ref) if build_file_path == file build_file.file_ref.remove_from_project end end end end |