Top Level Namespace
Defined Under Namespace
Modules: EnrichPodPatcher, Pod
Instance Method Summary collapse
-
#apply_patch(patch_file) ⇒ Object
also used from the post-install hook.
Instance Method Details
#apply_patch(patch_file) ⇒ Object
also used from the post-install hook
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pod/command/patch/apply.rb', line 32 def apply_patch(patch_file) working_dir = Dir.pwd repo_root = `git rev-parse --show-toplevel`.strip ios_project_path = Pathname.new(working_dir).relative_path_from(Pathname.new(repo_root)) directory_arg = (ios_project_path.to_s.eql? ".") ? "Pods" : File.join(ios_project_path, 'Pods') Dir.chdir(repo_root) { check_cmd = "git apply --check '#{patch_file}' --directory='#{directory_arg}' -p2 2> /dev/null" can_apply = system(check_cmd) if can_apply apply_cmd = check_cmd.gsub('--check ', '') did_apply = system(apply_cmd) if did_apply Pod::UI.puts "Successfully applied #{patch_file} 🎉" else Pod::UI.warn "Error: failed to apply #{patch_file}" end end } end |