定时自动更新cocoapods本地私有仓库的脚本

作者: shaneZhang 分类: ios技术 发布时间: 2019-01-03 11:27

在iOS日常开发中,我们可能经常会用到cocoapods私有库,特别是项目比较大的团队中,如果私有仓库很多的时候就需要一个自动更新的管理办理。这里为了方便,用python写了个自动更新私有仓库的脚本。以便于更方便的使用。代码如下:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import commands
import sys


def traverse(f):
    fs = os.listdir(f)
    for f1 in fs:
        tmp_path = os.path.join(f,f1)
        shellString = str("cd " + tmp_path + " && git pull")
        print shellString
        results = commands.getoutput(shellString)
        print results

#设置全局的git记住用户名和密码
os.system('git config --global credential.helper store')
homePath = commands.getoutput("echo ~")
podSpecPath = str(homePath + '/.cocoapods/repos')
print podSpecPath
if os.path.exists(podSpecPath):
    print 'find the cocoapod spec path'
    traverse(podSpecPath)
else:
    print 'you does not install the cocoapods, please install it'

在配合crontab的定时任务,可以实现自动化的更新本地私有仓库的功能,或者更新pod 仓库的master

本页面支持繁体中文友好显示:定时自动更新cocoapods本地私有仓库的脚本

如果觉得我的文章对您有用,请随意打赏。如果有其他问题请联系博主QQ(909491009)或者下方留言!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注