Module: Pod::Podfile::DSL

Defined in:
lib/cocoapods_plugin.rb

Instance Method Summary collapse

Instance Method Details

#use_patch_file!(patchfile_path = 'Podfile.patch') ⇒ Object

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.



40
41
42
43
44
45
46
47
48
# File 'lib/cocoapods_plugin.rb', line 40

def use_patch_file!(patchfile_path = 'Podfile.patch')
    @enable_patch = true
    @patchfile_path = patchfile_path

    # check not in patchfile
    if self.defined_in_file.basename.to_s.downcase == Pathname.new(patchfile_path).basename.to_s.downcase
        raise "Cannot call `#{__method__}` in Podfile patchfile" 
    end
end