Cocoapod hook pre_install post_install,Cocoapod install之前和之后如何做一些其他操作

点击进入iOS系列工作经验分享教程官网

在pod install 之前可以做一些其他处理的时候在pre_install里写脚本即可
pre_install do |installer|
    puts "pre install hook"
    Pod::UI.puts "pre install hook puts UI"
end

在pod install 之后可以做一些其他处理的时候在post_install里写脚本即可
post_install do |installer|
  puts "post install hook"
  exec 'pwd'
end

这俩hook方法还可以做一些其他语言脚本的执行,比如执行shell脚本,使用exec 后面跟上具体命令即可
sh命令文件是一样的
发布了7 篇原创文章 · 获赞 0 · 访问量 1125

猜你喜欢

转载自blog.csdn.net/huntaiji/article/details/104877596