Sha256: 4d6aadc8146f7ef4eeadb2df256b6dbf16abbab0051b9d7fbddb216e135a6286

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'xcodeproj'

class IOSPlistManager
    def initialize(project, info_plist_path)
        @project = project
        @info_plist_path = info_plist_path
    end

    def create_and_add_info_plist
#         add_info_plist_to_project
        set_info_plist_in_build_settings
        save_project
    end

    private

    def add_info_plist_to_project
        file_ref = @project.files.select { |f| f.path == @info_plist_path }.first
        if file_ref
            Solara.logger.debug("Info.plist file reference already exists in the project. Skipping this step.")
        else
            file_ref = XcodeProjectManager.new.add_single_file_to_group(@project, @project.main_group, @info_plist_path)
            Solara.logger.debug("Info.plist file created. file_ref = #{file_ref}")
        end
    end

    def set_info_plist_in_build_settings
        path = FileManager.get_relative_path(IOSFilePathManager.instance.xcode_project_directory, @info_plist_path)
        main_target.build_configurations.each do |config|
            config.build_settings['INFOPLIST_FILE'] = path
        end
    end

    def save_project
        @project.save
    end

    def main_target
        @project.targets.first
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solara-0.2.0 solara/lib/core/scripts/platform/ios/ios_plist_manager.rb
solara-0.1.0 solara/lib/core/scripts/platform/ios/ios_plist_manager.rb