Commit 7e2c5eaa authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

clean

parent f141cd9e
......@@ -13,23 +13,16 @@ export GITHUB_TOKEN=xxx
export GITLAB_TOKEN=xxx
export REDMINE_TOKEN=xxx
export OPENROB_TOKEN=xxx
export TRAVIS_TOKEN=xxx
./manage.py migrate
./manage.py populate
./manage.py fetch
./manage.py robotpkg
./manage.py cmake
./manage.py travis
./manage.py update
./manage.py runserver
```
or, as a shortcut, `./launch.sh`
You can go to http://localhost:8000
You can then go to http://localhost:8000
## TODO
- supprimer le besoin de delete_perso
- populate public/private field
- fix interaction between pagination & filtering
- retrieve dependencies
......
#!/bin/bash
set -ex
source .env
./manage.py migrate
./manage.py populate
./manage.py delete_perso
./manage.py fetch
./manage.py delete_perso
./manage.py robotpkg
./manage.py delete_perso
./manage.py cmake
./manage.py delete_perso
./manage.py travis
./manage.py delete_perso
./manage.py update
./manage.py delete_perso
import logging
from django.core.management import call_command
from django.core.management.base import BaseCommand
import requests
......@@ -14,18 +15,10 @@ class Command(BaseCommand):
help = 'populates licenses, projets, namespaces and repos from forges'
def handle(self, *args, **options):
# github = Forge.objects.get(name='Github')
logger.info(f'updating licenses')
for data in requests.get(LICENSES).json()['licenses']:
_, created = License.objects.get_or_create(spdx_id=data['licenseId'],
defaults={'name': data['name'], 'url': data['detailsUrl']})
if created:
logger.info(f' created license {data["name"]}')
# for data in requests.get(f'{github.api_url()}/licenses', headers=github.headers()).json():
# logger.info(f' updating license {data["name"]}')
# License.objects.get_or_create(spdx_id=data['spdx_id'],
# defaults={key: data[key] for key in ['name', 'url']})
License.objects.get_or_create(spdx_id=data['licenseId'],
defaults={'name': data['name'], 'url': data['detailsUrl']})
logger.info(f'updating forges')
for forge in Forge.objects.order_by('source'):
......@@ -36,3 +29,10 @@ class Command(BaseCommand):
for repo in Repo.objects.all():
logger.info(f' updating {repo}')
repo.api_update()
call_command('delete_perso')
call_command('fetch')
call_command('robotpkg')
call_command('cmake')
call_command('travis')
call_command('delete_perso')
......@@ -15,12 +15,12 @@ def update_travis_id(data):
namespace = Namespace.objects.get(slug=namespace)
project, _ = Project.objects.get_or_create(name=data['name'], defaults={'main_namespace': namespace})
repo, created = Repo.objects.get_or_create(forge=GITHUB, namespace=namespace, project=project,
defaults={'name': data['name'], 'repo_id': 0})
defaults={'name': data['name'], 'repo_id': 0, 'travis_id': data['id']})
if created:
repo.api_update()
repo.travis_id = data['id']
repo.save()
else:
repo.travis_id = data['id']
repo.save()
class Command(BaseCommand):
......@@ -28,9 +28,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
logger.info('Adding Travis Forge if needed')
travis, created = Forge.objects.get_or_create(source=SOURCES.travis, defaults={
'name': 'Travis', 'url': 'https://travis-ci.org/', 'token': os.getenv('TRAVIS_TOKEN')
})
travis = Forge.objects.get(source=SOURCES.travis)
logger.info('Gettings travis_id')
for namespace in Namespace.objects.all():
......
import logging
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
from rainboard.models import Branch, Project, Repo, Robotpkg
......@@ -35,3 +36,5 @@ class Command(BaseCommand):
for project in Project.objects.all():
logger.info(f' {project}')
project.update()
call_command('delete_perso')
......@@ -19,6 +19,8 @@ def forges(apps, schema_editor):
token=os.getenv('REDMINE_TOKEN'))
Forge.objects.create(name='Openrobots', source=SOURCES.redmine, url='https://git.openrobots.org',
token=os.getenv('OPENROB_TOKEN'))
Forge.objects.create(name='Travis', source=SOURCES.travis, url='https://travis-ci.org',
token=os.getenv('TRAVIS_TOKEN'))
def groups(apps, schema_editor):
Namespace = apps.get_model('rainboard', 'Namespace')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment