module Pod::Podfile::DSL

Public Instance Methods

use_patch_file!(patchfile_path = 'Podfile.patch') click to toggle source

Enable Podfile Patch feature.

Thid feature provide the ability to override podfile in another file.

Place a `Podfile.patch` at the same directory with Podfile. Configurate the pods in patchfile just like in Podfile. It will append to original podfile, and override the settings in podfile if duplicated.

For example:

Podfile: “`

target EVA do
    pod "A", "1.5.3", :inhibit_warning => true
    pod "B", :path => "some/path"
end

“`

Podfile.patch “`

target EVA do
    pod "A", :path => "path/to/local/A"
end

“`

The final result equal to “`

target EVA do
    pod "A", :path => "path/to/local/A"
    pod "B", :path => "some/path"
end

“`

This function is base on the parsed result of podfile. It means you could do ANYTHING you do in podfile, i.e. your custom pod function or other plugins.

# File lib/cocoapods-podfile_patch/main.rb, line 40
def use_patch_file!(patchfile_path = 'Podfile.patch')
    
    @CococapodsPodfilePatch_current_patch_files ||= []
    if @CococapodsPodfilePatch_current_patch_files.include? patchfile_path
        # Yes, you could even use it recureively, but don't use the same patch file.
        raise "`use_patch_file!` called recursively. Most case is it's used in Patch file."
        return 
    end
    
    @CococapodsPodfilePatch_current_patch_files << patchfile_path
    require 'cocoapods-podfile_patch/podfile_patch'
    @CococapodsPodfilePatch_patch_target = CococapodsPodfilePatch::PodfilePatch.new.load_patch_target self, patchfile_path
    @CococapodsPodfilePatch_current_patch_files.delete(patchfile_path)
end