def decorated(self, **kwargs): if os.getcwd() != self.local: if DirCommands.isLocalDirectExist(self.local): DirCommands.enterDirAbs(self.local) else: raise GitError(self.local, "Local path not exist") return f(self, **kwargs)
def createFolders(self): direct = InitCommands.remote # if direct.endswith('/'): direct = direct[:len(direct) - 1] createProcess = [] while len(direct) > 0: if DirCommands.isRemoteDirectExist(direct): break else: splitName = direct.rsplit('/', 1) direct = splitName[0] if len(splitName[1]) != 0: createProcess.append(splitName[1]) if len(direct) == 0: raise DirError('Cannot create directory') while len(createProcess) > 0: with cd(direct): ret = run("mkdir %s" % createProcess[-1]) if not ret.succeeded: raise DirError(ret) if direct.endswith('/'): direct += createProcess.pop() else: direct += '/' + createProcess.pop()
def compile(self, host, user, passwords, isGit, isVerbose): if isVerbose: _setting = settings(host_string = host) else: _setting = settings(hide('everything'), host_string = host) with _setting: if isGit: if not DirCommands.isGitInit(self.remote) and len(self.gitAddr) > 0: self.processGit() else: raise DirError("Already init git mode in the remote path.") else: if not DirCommands.isUploadInit(self.remote): self.processUpload() else: raise DirError("Already init upload mode in the remote path.")
def createFolders(self): direct = InitCommands.remote # if direct.endswith('/'): direct = direct[: len(direct) - 1] createProcess = [] while len(direct) > 0: if DirCommands.isRemoteDirectExist(direct): break else: splitName = direct.rsplit("/", 1) direct = splitName[0] if len(splitName[1]) != 0: createProcess.append(splitName[1]) if len(direct) == 0: raise DirError("Cannot create directory") while len(createProcess) > 0: with cd(direct): ret = run("mkdir %s" % createProcess[-1]) if not ret.succeeded: raise DirError(ret) if direct.endswith("/"): direct += createProcess.pop() else: direct += "/" + createProcess.pop()
def transferFiles(self): if not DirCommands.isRemoteDirectExist(self.remote): raise DirError("Remote folder doesn't exist") for f in self.filelist: ret = put(self.local+f,self.remote+f) if not ret.succeeded: raise DirError("An error happened in the upload process") sys.exit(1)
def transferFiles(self): if not DirCommands.isRemoteDirectExist(self.remote): raise DirError("Remote folder doesn't exist") for f in self.filelist: ret = put(self.local + f, self.remote + f) if not ret.succeeded: raise DirError("An error happened in the upload process") sys.exit(1)
def cpUpload(self, localAddr): if DirCommands.isRemoteDirectExist(InitCommands.remote): with cd(InitCommands.remote): ret = run("mkdir uploads") if not ret.succeeded: raise DirError("Failed to create uploads folder") ret = put(localAddr + '*', InitCommands.remote + 'uploads/') if not ret.succeeded: raise DirError("Failed to upload files")
def cpUpload(self, localAddr): if DirCommands.isRemoteDirectExist(InitCommands.remote): with cd(InitCommands.remote): ret = run("mkdir uploads") if not ret.succeeded: raise DirError("Failed to create uploads folder") ret = put(localAddr + "*", InitCommands.remote + "uploads/") if not ret.succeeded: raise DirError("Failed to upload files")
def compile(self, host, user, passwords, isVerbose): if isVerbose: _setting = settings(host_string = host) else: _setting = settings(hide('everything'), host_string = host) with _setting: if DirCommands.isRemoteDirectExist(self.remote): self.process() else: raise DirError("Upload mode is not init in the remote path.")
def compile(self, host, user, passwords, isVerbose): if isVerbose: _setting = settings(host_string=host) else: _setting = settings(hide('everything'), host_string=host) with _setting: if DirCommands.isRemoteDirectExist(self.remote): self.process() else: raise DirError("Upload mode is not init in the remote path.")
def cloneGit(self, gitAddr): if DirCommands.isRemoteDirectExist(InitCommands.remote): with cd(InitCommands.remote): ret = run("git clone %s git" % gitAddr) if not ret.succeeded: raise GitError(InitCommands.remote, ret)
def decorated(self, **kwargs): if os.getcwd() != self.local: DirCommands.enterDirAbs(self.local) return f(self, **kwargs)
def decorated(self, **kwargs): if not DirCommands.isRemoteDirectExist(self.remote): raise GitError(self.remote, "Remote path not exist") return f(self, **kwargs)