def handle(self, *args, **options): if len(args): for slug in args: project_data = api.project(slug).get() p = tasks.make_api_project(project_data) log.info("Building %s" % p) tasks.update_docs(pk=p.pk, docker=True)
def handle(self, *args, **options): record = options['record'] force = options['force'] version = options['version'] if len(args): for slug in args: if version and version != "all": log.info("Updating version %s for %s" % (version, slug)) for version in Version.objects.filter(project__slug=slug, slug=version): trigger_build(project=version.project, version=version) elif version == "all": log.info("Updating all versions for %s" % slug) for version in Version.objects.filter(project__slug=slug, active=True, uploaded=False): tasks.update_docs(pk=version.project_id, record=False, version_pk=version.pk) else: p = Project.all_objects.get(slug=slug) log.info("Building %s" % p) trigger_build(project=p, force=force) else: if version == "all": log.info("Updating all versions") for version in Version.objects.filter(active=True, uploaded=False): tasks.update_docs(pk=version.project_id, record=record, force=force, version_pk=version.pk) else: log.info("Updating all docs") tasks.update_docs_pull(record=record, force=force)
def handle(self, *args, **options): make_pdf = options['pdf'] for version in Version.objects.filter(active=True, built=False): update_docs(version.project_id, pdf=make_pdf, record=False, version_pk=version.pk)
def test_default_project_build(self): """ Test that a superuser can use the API """ tasks.update_docs(pk=self.project.pk) self.assertTrue(os.path.exists( os.path.join(self.project.rtd_build_path(), 'index.html') ))
def test_default_project_build(self): """ Test that a superuser can use the API """ tasks.update_docs(pk=self.project.pk) self.assertTrue( os.path.exists( os.path.join(self.project.rtd_build_path(), 'index.html')))
def handle(self, *args, **options): make_pdf = options['pdf'] if not len(args): tasks.update_docs_pull(pdf=make_pdf) else: for slug in args: p = Project.objects.get(slug=slug) print "Building %s" % p tasks.update_docs(p.pk, pdf=make_pdf)
def github_build(request): """ A post-commit hook for github. """ if request.method == 'POST': obj = json.loads(request.POST['payload']) name = obj['repository']['name'] url = obj['repository']['url'] ghetto_url = url.replace('http://', '').replace('https://', '') branch = obj['ref'].replace('refs/heads/', '') log.info("(Github Build) %s:%s" % (ghetto_url, branch)) version_pk = None version_slug = branch try: project = Project.objects.filter(repo__contains=ghetto_url)[0] version = project.version_from_branch_name(branch) if version: default = project.default_branch or project.vcs_repo().fallback_branch if branch == default: #Shortcircuit versions that are default #These will build at "latest", and thus won't be active version = project.versions.get(slug='latest') version_pk = version.pk version_slug = version.slug log.info("(Github Build) Building %s:%s" % (project.slug, version.slug)) elif version in project.versions.exclude(active=True): log.info("(Github Build) Not building %s" % version.slug) return HttpResponseNotFound('Not Building: %s' % branch) else: version_pk = version.pk version_slug = version.slug log.info("(Github Build) Building %s:%s" % (project.slug, version.slug)) else: version_slug = 'latest' branch = 'latest' log.info("(Github Build) Building %s:latest" % project.slug) #version_pk being None means it will use "latest" update_docs(pk=project.pk, version_pk=version_pk, force=True) return HttpResponse('Build Started: %s' % version_slug) except Exception, e: mail_admins('Build Failure', '%s failed to build via github.\n\n%s' % (name, e)) return HttpResponseNotFound('Build Failed')
def handle(self, *args, **options): make_pdf = options['pdf'] record = options['record'] force = options['force'] version = options['version'] if len(args): for slug in args: if version and version != "all": log.info("Updating version %s for %s" % (version, slug)) for version in Version.objects.filter(project__slug=slug, slug=version): trigger_build(project=version.project, version=version) elif version == "all": log.info("Updating all versions for %s" % slug) for version in Version.objects.filter(project__slug=slug, active=True, uploaded=False): tasks.update_docs(pk=version.project_id, pdf=make_pdf, record=False, version_pk=version.pk) else: p = Project.objects.get(slug=slug) log.info("Building %s" % p) trigger_build(project=p, force=force) else: if version == "all": log.info("Updating all versions") for version in Version.objects.filter(active=True, uploaded=False): tasks.update_docs(pk=version.project_id, pdf=make_pdf, record=record, force=force, version_pk=version.pk) else: log.info("Updating all docs") tasks.update_docs_pull(pdf=make_pdf, record=record, force=force)
def handle(self, *args, **options): make_pdf = options['pdf'] record = options['record'] touch = options['touch'] version = options['version'] if len(args): for slug in args: if version and version != "all": print "Updating version %s for %s" % (version, slug) for version in Version.objects.filter(project__slug=slug, active=True, uploaded=False, slug=version): tasks.update_docs(version.project_id, pdf=make_pdf, record=False, version_pk=version.pk) elif version == "all": print "Updating all versions for %s" % slug for version in Version.objects.filter(project__slug=slug, active=True, uploaded=False): tasks.update_docs(pk=version.project_id, pdf=make_pdf, record=False, version_pk=version.pk) else: p = Project.objects.get(slug=slug) print "Building %s" % p tasks.update_docs(pk=p.pk, pdf=make_pdf, touch=touch) else: if version == "all": print "Updating all versions" for version in Version.objects.filter(active=True, uploaded=False): tasks.update_docs(pk=version.project_id, pdf=make_pdf, record=record, touch=touch, version_pk=version.pk) else: print "Updating all docs" tasks.update_docs_pull(pdf=make_pdf, record=record, touch=touch)
def handle(self, *args, **options): make_pdf = options["pdf"] record = options["record"] touch = options["touch"] versions = options["versions"] if not len(args): if versions: print "Updating all versions" for version in Version.objects.filter(active=True, uploaded=False): tasks.update_docs(version.project_id, pdf=make_pdf, record=False, version_pk=version.pk) else: print "Updating all docs" tasks.update_docs_pull(pdf=make_pdf, record=record, touch=touch) else: for slug in args: if versions: print "Updating all versions for %s" % slug for version in Version.objects.filter(project__slug=slug, active=True, uploaded=False): tasks.update_docs(version.project_id, pdf=make_pdf, record=False, version_pk=version.pk) else: p = Project.objects.get(slug=slug) print "Building %s" % p tasks.update_docs(p.pk, pdf=make_pdf, touch=touch)
def handle(self, *args, **options): for version in Version.objects.filter(active=True, built=False): update_docs(version.project_id, record=False, version_pk=version.pk)