0002_forges_groups.py 1.57 KB
Newer Older
Guilhem Saurel's avatar
initial  
Guilhem Saurel committed
1
2
3
4
5
6
# Generated by Django 2.0.1 on 2018-01-05 10:20

import os

import requests

Guilhem Saurel's avatar
Guilhem Saurel committed
7
from django.db import migrations
Guilhem Saurel's avatar
initial  
Guilhem Saurel committed
8
9
10
11
12
from rainboard.utils import SOURCES


def forges(apps, schema_editor):
    Forge = apps.get_model('rainboard', 'Forge')
Guilhem Saurel's avatar
Guilhem Saurel committed
13
    Forge.objects.create(name='Gitlab', source=SOURCES.gitlab, url='https://gepgitlab.laas.fr',
Guilhem Saurel's avatar
initial  
Guilhem Saurel committed
14
15
16
17
18
                         token=os.getenv('GITLAB_TOKEN'))
    Forge.objects.create(name='Github', source=SOURCES.github, url='https://github.com',
                         token=os.getenv('GITHUB_TOKEN'))
    Forge.objects.create(name='Redmine', source=SOURCES.redmine, url='https://redmine.laas.fr',
                         token=os.getenv('REDMINE_TOKEN'))
Guilhem Saurel's avatar
Guilhem Saurel committed
19
20
    Forge.objects.create(name='Openrobots', source=SOURCES.redmine, url='https://git.openrobots.org',
                         token=os.getenv('OPENROB_TOKEN'))
Guilhem Saurel's avatar
clean    
Guilhem Saurel committed
21
22
    Forge.objects.create(name='Travis', source=SOURCES.travis, url='https://travis-ci.org',
                         token=os.getenv('TRAVIS_TOKEN'))
Guilhem Saurel's avatar
initial  
Guilhem Saurel committed
23

Guilhem Saurel's avatar
Guilhem Saurel committed
24
25
26
def groups(apps, schema_editor):
    Namespace = apps.get_model('rainboard', 'Namespace')
    Namespace.objects.create(name='Stack Of Tasks', group=True)
Guilhem Saurel's avatar
clean    
Guilhem Saurel committed
27
    Namespace.objects.create(name='Humanoid Path Planner', group=True)
Guilhem Saurel's avatar
Guilhem Saurel committed
28
29
    Namespace.objects.create(name='Gepetto', group=True)
    Namespace.objects.create(name='Pyrène Dev', group=True)
Guilhem Saurel's avatar
Guilhem Saurel committed
30
    Namespace.objects.create(name='HRP2 Dev', group=True)
Guilhem Saurel's avatar
Guilhem Saurel committed
31

Guilhem Saurel's avatar
initial  
Guilhem Saurel committed
32
33
34
35
36
37
38
39
40

class Migration(migrations.Migration):

    dependencies = [
        ('rainboard', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(forges),
Guilhem Saurel's avatar
Guilhem Saurel committed
41
        migrations.RunPython(groups),
Guilhem Saurel's avatar
initial  
Guilhem Saurel committed
42
    ]