本文整理汇总了Python中Helper.Helper.checkFile方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.checkFile方法的具体用法?Python Helper.checkFile怎么用?Python Helper.checkFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper.Helper
的用法示例。
在下文中一共展示了Helper.checkFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure
# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import checkFile [as 别名]
def configure(self):
helper = Helper()
if not helper.checkFile('/etc/bash_completion.d/git-completion.bash'):
print "-- add bash completion"
helper.wget('https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash', '/etc/bash_completion.d/')
if 'name' in self.attrs:
print "-- set your name in git config"
helper.execute('git config --global user.name "' + self.attrs['name'] + '"')
if 'email' in self.attrs:
fileName = helper.homeFolder() + '.ssh/id_rsa'
print "-- set your email in git config"
helper.execute('git config --global user.email "' + self.attrs['email'] + '"')
if 'passphrase' in self.attrs and len(self.attrs['passphrase']) > 4:
print "-- create ssh key for auto-authorization (add string below to https://github.com/settings/ssh)"
if not helper.checkFile(fileName):
helper.execute('mkdir ' + helper.homeFolder() + '.ssh')
helper.execute('ssh-keygen -f "' + fileName + '" -N "' + self.attrs['passphrase'] + '" -t rsa -C "' + self.attrs['email'] + '"')
print helper.execute('cat ' + fileName + '.pub')