예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
    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()
예제 #4
0
 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.")
예제 #5
0
    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()
예제 #6
0
 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)
예제 #7
0
 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)
예제 #8
0
 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")
예제 #9
0
 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")
예제 #10
0
 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.")
예제 #11
0
 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.")
예제 #12
0
 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)
예제 #13
0
 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)
예제 #14
0
 def decorated(self, **kwargs):
     if os.getcwd() != self.local:
         DirCommands.enterDirAbs(self.local)
     return f(self, **kwargs)
예제 #15
0
 def decorated(self, **kwargs):
     if not DirCommands.isRemoteDirectExist(self.remote):
         raise GitError(self.remote, "Remote path not exist")
     return f(self, **kwargs)
예제 #16
0
 def decorated(self, **kwargs):
     if not DirCommands.isRemoteDirectExist(self.remote):
         raise GitError(self.remote, "Remote path not exist")
     return f(self, **kwargs)
예제 #17
0
 def decorated(self, **kwargs):
     if os.getcwd() != self.local:
         DirCommands.enterDirAbs(self.local)
     return f(self, **kwargs)