本文整理匯總了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')