Пример #1
0
    def move(self):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            #Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                log.info("Copying docs to remote server.")
                copy_to_app_servers(project.full_build_path(self.version.slug),
                                    target)
            else:
                if os.path.exists(target):
                    shutil.rmtree(target)
                log.info("Copying docs on the local filesystem")
                shutil.copytree(project.full_build_path(self.version.slug),
                                target)

            #Copy the zip file.
            to_path = os.path.join(settings.MEDIA_ROOT, 'htmlzip',
                                   project.slug, self.version.slug)
            to_file = os.path.join(to_path, '%s.zip' % project.slug)
            from_path = project.checkout_path(self.version.slug)
            from_file = os.path.join(from_path, '%s.zip' % project.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")
Пример #2
0
    def move(self, **kwargs):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            # Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if "_" in project.slug:
                new_slug = project.slug.replace("_", "-")
                new_target = target.replace(project.slug, new_slug)
                # Only replace 1, so user_builds doesn't get replaced >:x
                targets = [target, new_target]
            else:
                targets = [target]
            for target in targets:
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    log.info("Copying docs to remote server.")
                    copy_to_app_servers(project.full_build_path(self.version.slug), target)
                else:
                    if os.path.exists(target):
                        shutil.rmtree(target)
                    log.info("Copying docs on the local filesystem")
                    shutil.copytree(project.full_build_path(self.version.slug), target)

                # Copy the zip file.
                to_path = os.path.join(settings.MEDIA_ROOT, "htmlzip", project.slug, self.version.slug)
                to_file = os.path.join(to_path, "%s.zip" % project.slug)
                from_path = project.checkout_path(self.version.slug)
                from_file = os.path.join(from_path, "%s.zip" % project.slug)
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    copy_file_to_app_servers(from_file, to_file)
                else:
                    if not os.path.exists(to_path):
                        os.makedirs(to_path)
                    run("mv -f %s %s" % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")
Пример #3
0
    def move(self, **kwargs):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            #Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                log.info("Copying docs to remote server.")
                copy_to_app_servers(project.full_build_path(self.version.slug), target)
            else:
                if os.path.exists(target):
                    shutil.rmtree(target)
                log.info("Copying docs on the local filesystem")
                shutil.copytree(project.full_build_path(self.version.slug), target)

            #Copy the zip file.
            to_path = os.path.join(settings.MEDIA_ROOT,
                   'htmlzip',
                   project.slug,
                   self.version.slug)
            to_file = os.path.join(to_path, '%s.zip' % project.slug)
            from_path = project.checkout_path(self.version.slug)
            from_file = os.path.join(from_path, '%s.zip' % project.slug)
            if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                copy_file_to_app_servers(from_file, to_file)
            else:
                if not os.path.exists(to_path):
                    os.makedirs(to_path)
                run('mv -f %s %s' % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")
Пример #4
0
 def move(self, **kwargs):
     project = self.version.project
     build_path = os.path.join(project.checkout_path(self.version.slug),
                               'site')
     if os.path.exists(build_path):
         #Copy the html files.
         target = project.rtd_build_path(self.version.slug)
         if "_" in project.slug:
             new_slug = project.slug.replace('_', '-')
             new_target = target.replace(project.slug, new_slug)
             #Only replace 1, so user_builds doesn't get replaced >:x
             targets = [target, new_target]
         else:
             targets = [target]
         for target in targets:
             if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                 log.info("Copying docs to remote server.")
                 copy_to_app_servers(build_path, target)
             else:
                 if os.path.exists(target):
                     shutil.rmtree(target)
                 log.info("Copying docs on the local filesystem")
                 shutil.copytree(build_path, target)
     else:
         log.warning("Not moving docs, because the build dir is unknown.")
Пример #5
0
def unzip_files(dest_file, html_path):
    if not os.path.exists(html_path):
        os.makedirs(html_path)
    else:
        shutil.rmtree(html_path)
        os.makedirs(html_path)
    run("unzip -o %s -d %s" % (dest_file, html_path))
    copy_to_app_servers(html_path, html_path)
Пример #6
0
def unzip_files(dest_file, html_path):
    if not os.path.exists(html_path):
        os.makedirs(html_path)
    else:
        shutil.rmtree(html_path)
        os.makedirs(html_path)
    run('unzip -o %s -d %s' % (dest_file, html_path))
    copy_to_app_servers(html_path, html_path)
Пример #7
0
 def move(self):
     project = self.version.project
     if project.full_build_path(self.version.slug):
         target = project.rtd_build_path(self.version.slug)
         if getattr(settings, "MULTIPLE_APP_SERVERS", None):
             print "Copying docs to remote server."
             copy_to_app_servers(project.full_build_path(self.version.slug), target)
         else:
             if os.path.exists(target):
                 shutil.rmtree(target)
             print "Copying docs on the local filesystem"
             shutil.copytree(project.full_build_path(self.version.slug), target)
     else:
         print "Not moving docs, because the build dir is unknown."
Пример #8
0
 def move(self, **kwargs):
     project = self.version.project
     if project.full_build_path(self.version.slug):
         #Copy the html files.
         to_path = os.path.join(settings.MEDIA_ROOT, 'json', project.slug,
                                self.version.slug)
         if getattr(settings, "MULTIPLE_APP_SERVERS", None):
             log.info("Copying json to remote server.")
             copy_to_app_servers(project.full_json_path(self.version.slug),
                                 to_path)
         else:
             if os.path.exists(to_path):
                 shutil.rmtree(to_path)
             log.info("Copying json on the local filesystem")
             shutil.copytree(project.full_json_path(self.version.slug),
                             to_path)
     else:
         log.warning("Not moving json, because the build dir is unknown.")
Пример #9
0
 def move(self, **kwargs):
     project = self.version.project
     if project.full_build_path(self.version.slug):
         #Copy the html files.
         to_path = os.path.join(settings.MEDIA_ROOT, 'json', project.slug,
                    self.version.slug)
         if getattr(settings, "MULTIPLE_APP_SERVERS", None):
             log.info("Copying json to remote server.")
             copy_to_app_servers(
                 project.full_json_path(self.version.slug), to_path)
         else:
             if os.path.exists(to_path):
                 shutil.rmtree(to_path)
             log.info("Copying json on the local filesystem")
             shutil.copytree(
                 project.full_json_path(self.version.slug), to_path)
     else:
         log.warning("Not moving json, because the build dir is unknown.")
 def handle(self, *args, **options):
     version = options["version"]
     if len(args):
         for slug in args:
             log.info("Updating all versions for %s" % slug)
             for version in Version.objects.filter(project__slug=slug, active=True):
                 path = version.project.rtd_build_path(version.slug)
                 copy_to_app_servers(path, path)
     else:
         log.info("Updating all versions")
         for version in Version.objects.filter(active=True):
             try:
                 log.info("Syncing %s" % version)
                 if options["checkout"]:
                     path = version.project.checkout_path(version.slug)
                 else:
                     path = version.project.rtd_build_path(version.slug)
                 copy_to_app_servers(path, path)
             except Exception, e:
                 log.error("Failed to update %s" % version, exc_info=True)
Пример #11
0
 def handle(self, *args, **options):
     version = options['version']
     if len(args):
         for slug in args:
             log.info("Updating all versions for %s" % slug)
             for version in Version.objects.filter(project__slug=slug,
                                                   active=True):
                 path = version.project.rtd_build_path(version.slug)
                 copy_to_app_servers(path, path)
     else:
         log.info("Updating all versions")
         for version in Version.objects.filter(active=True):
             try:
                 log.info("Syncing %s" % version)
                 if options['checkout']:
                     path = version.project.checkout_path(version.slug)
                 else:
                     path = version.project.rtd_build_path(version.slug)
                 copy_to_app_servers(path, path)
             except Exception, e:
                 log.error("Failed to update %s" % version, exc_info=True)
Пример #12
0
 def handle(self, *args, **options):
     version = options['version']
     if len(args):
         for slug in args:
             print _("Updating all versions for %s") % slug
             for version in Version.objects.filter(project__slug=slug,
                                                   active=True):
                 path = version.project.rtd_build_path(version.slug)
                 copy_to_app_servers(path, path)
     else:
         print _("Updating all versions")
         for version in Version.objects.filter(active=True):
             try:
                 print _("Syncing %s") % version
                 if options['checkout']:
                     path = version.project.checkout_path(version.slug)
                 else:
                     path = version.project.rtd_build_path(version.slug)
                 copy_to_app_servers(path, path)
             except Exception, e:
                 print _("Error: %s") % e
Пример #13
0
 def move(self, **kwargs):
     project = self.version.project
     if project.full_build_path(self.version.slug):
         target = project.rtd_build_path(self.version.slug)
         if "_" in project.slug:
             new_slug = project.slug.replace('_','-')
             new_target = target.replace(project.slug, new_slug)
             #Only replace 1, so user_builds doesn't get replaced >:x
             targets = [target, new_target]
         else:
             targets = [target]
         for target in targets:
             if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                 log.info("Copying docs to remote server.")
                 copy_to_app_servers(project.full_build_path(self.version.slug), target)
             else:
                 if os.path.exists(target):
                     shutil.rmtree(target)
                 log.info("Copying docs on the local filesystem")
                 shutil.copytree(project.full_build_path(self.version.slug), target)
     else:
         log.warning("Not moving docs, because the build dir is unknown.")
Пример #14
0
    def move(self, **kwargs):
        project = self.version.project
        if project.full_build_path(self.version.slug):
            #Copy the html files.
            target = project.rtd_build_path(self.version.slug)
            if "_" in project.slug:
                new_slug = project.slug.replace('_', '-')
                new_target = target.replace(project.slug, new_slug)
                #Only replace 1, so user_builds doesn't get replaced >:x
                targets = [target, new_target]
            else:
                targets = [target]
            for target in targets:
                if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                    log.info("Copying docs to remote server.")
                    copy_to_app_servers(
                        project.full_build_path(self.version.slug), target)
                else:
                    if os.path.exists(target):
                        shutil.rmtree(target)
                    log.info("Copying docs on the local filesystem")
                    shutil.copytree(project.full_build_path(self.version.slug),
                                    target)

                #Copy the zip file.
                to_path = os.path.join(settings.MEDIA_ROOT, 'htmlzip',
                                       project.slug, self.version.slug)
                to_file = os.path.join(to_path, '%s.zip' % project.slug)
                from_path = project.checkout_path(self.version.slug)
                from_file = os.path.join(from_path, '%s.zip' % project.slug)
                if os.path.exists(from_file):
                    if getattr(settings, "MULTIPLE_APP_SERVERS", None):
                        copy_file_to_app_servers(from_file, to_file)
                    else:
                        if not os.path.exists(to_path):
                            os.makedirs(to_path)
                        run('mv -f %s %s' % (from_file, to_file))
        else:
            log.warning("Not moving docs, because the build dir is unknown.")