Example #1
0
    def install(directory, user=None):
        with cd(directory):
            sudo("curl -sS https://getcomposer.org/installer | php")
            sudo("php composer.phar  install --no-dev --no-interaction")
            sudo("rm -Rf composer.phar")

            if user:
                Permission.owner(directory + "/vendor", user, user)
Example #2
0
    def upload_file(remote_directory, file_name, file_content, user):
        file_path = remote_directory + "/" + file_name
        command = ""
        if exists(file_path):
            command = "rm " + file_path + " && "

        sudo(command + "touch " + file_path)
        with hide("everything"):
            append(file_path, file_content, use_sudo=True)

        Permission.owner(file_path, user, user)
Example #3
0
    def pull(repository, remote, branch, user):
        with cd(repository):
            current_branch = sudo("git rev-parse --abbrev-ref HEAD")
            sudo("git remote set-url origin " + remote)
            sudo("git checkout -- .")
            if current_branch != branch:
                sudo("git checkout -b " + branch + " origin/" + branch)
            sudo("git branch --set-upstream-to=origin/" + branch)
            sudo("git pull origin " + branch)

        Permission.owner(repository, user, user)
Example #4
0
    def upload_file(remote_directory, file_name, file_content, user):
        file_path = remote_directory + "/" + file_name
        command = ""
        if exists(file_path):
            command = "rm " + file_path + " && "

        sudo(command + "touch " + file_path)
        with hide("everything"):
            append(file_path, file_content, use_sudo=True)

        Permission.owner(file_path, user, user)
Example #5
0
    def swap(source, destination, user):
        if exists(destination, use_sudo=True):
            tmp_destination = destination.rstrip('/') + '_tmp'
            pre_command = "mv " + destination + " " + tmp_destination + " && "
            sudo(pre_command + "mv " + source + " " + destination)
            sudo("mv " + tmp_destination + " " + source)

        else:
            sudo("mv " + source + " " + destination)

        Permission.owner(destination, user, user)
Example #6
0
    def swap(source, destination, user):
        if exists(destination, use_sudo=True):
            tmp_destination = destination.rstrip('/') + '_tmp'
            pre_command = "mv " + destination + " " + tmp_destination + " && "
            sudo(pre_command + "mv " + source + " " + destination)
            sudo("mv " + tmp_destination + " " + source)

        else:
            sudo("mv " + source + " " + destination)

        Permission.owner(destination, user, user)
Example #7
0
    def submodule_update(repository, user):
        with cd(repository):
            sudo("git submodule init")
            sudo("git submodule update")

            Permission.owner(repository, user, user)
Example #8
0
 def clone(destination, remote, branch, user):
     temp = Git.get_temp_dir()
     run("git clone -b " + branch + " " + remote + " " + temp)
     sudo("mv " + temp + " " + destination)
     Permission.owner(destination, user, user)
Example #9
0
 def copy(source, destination, user):
     if exists(destination, use_sudo=True):
         sudo("rm -Rf " + destination)
     sudo("cp -R " + source + " " + destination)
     Permission.owner(destination, user, user)
Example #10
0
 def copy(source, destination, user):
     if exists(destination, use_sudo=True):
         sudo("rm -Rf " + destination)
     sudo("cp -R " + source + " " + destination)
     Permission.owner(destination, user, user)