Пример #1
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)
Пример #2
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)
Пример #3
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:
                 log.error("Failed to update %s" % version, exc_info=True)
Пример #4
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:
                 log.error("Failed to update %s" % version, exc_info=True)
Пример #5
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.")
Пример #6
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.")