# Path: journeyman/projects/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=255)
#     active = models.BooleanField(default=True)
# 
#     repository = models.CharField(max_length=255)
#     ssh_key = models.TextField(blank=True)
# 
#     config_file = models.CharField(max_length=255,
#         default='journey.conf/config', blank=True)
#     config_data = models.TextField(blank=True)
# 
#     def get_state(self):
#         try:
#             return self.build_set.all().order_by('-pk')[0].state
#         except IndexError:
#             return 'unknown'
# 
#     def __unicode__(self):
#         return self.name
# 
#     @property
#     def last_build(self):
#         try:
#             return self.build_set.all().order_by('-started')[0]
#         except (self.build_set.model.DoesNotExist, IndexError):
#             return None
# 
#     @property
#     def last_stable_build(self):
#         try:
#             return self.build_set.filter(state='stable').order_by('-started')[0]
#         except (self.build_set.model.DoesNotExist, IndexError):
#             return None
# 
#     @property
#     def outstanding_builds(self):
#         return self.build_set.filter(Q(Q(state='queued') | Q(state='unknown')))
# 
#     @property
#     def builds(self):
#         return self.build_set.exclude(Q(Q(state='queued') | Q(state='unknown')))


from django import forms
from journeyman.projects.models import Project
        (e.g. git+git://github.com/stephrdev/loetwerk.git)')

class BuildProcessForm(forms.Form):
    build_steps = forms.CharField(initial='python setup.py install',
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Let\'s start off with the easy stuff, please type in all \
        the commands needed to install your package')
    test_steps = forms.CharField(initial='python setup.py test',
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Now tell us how to run your tests. If you should have \
        many different test suites, just add another line.')
    dependencies = forms.CharField(required=False, initial='dependencies.txt',
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Please enter a list of pip requirement files that you \
        have used to specify your dependencies')
    test_xmls = forms.CharField(required=False,
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Please enter a newline separated list of paths of \
        unit test result xmls.')

class JourneyConfigOutputForm(forms.Form):
    pass

class JourneyConfigFileForm(forms.Form):
    config_file = forms.CharField(initial="journey.conf/config",
        help_text="If you leave this field blank, we will store the config \
        locally.", required=False)

class ProjectForm(forms.ModelForm):
    class Meta:

# Path: journeyman/projects/models.py
# class Project(models.Model):
#     name = models.CharField(max_length=255)
#     active = models.BooleanField(default=True)
# 
#     repository = models.CharField(max_length=255)
#     ssh_key = models.TextField(blank=True)
# 
#     config_file = models.CharField(max_length=255,
#         default='journey.conf/config', blank=True)
#     config_data = models.TextField(blank=True)
# 
#     def get_state(self):
#         try:
#             return self.build_set.all().order_by('-pk')[0].state
#         except IndexError:
#             return 'unknown'
# 
#     def __unicode__(self):
#         return self.name
# 
#     @property
#     def last_build(self):
#         try:
#             return self.build_set.all().order_by('-started')[0]
#         except (self.build_set.model.DoesNotExist, IndexError):
#             return None
# 
#     @property
#     def last_stable_build(self):
#         try:
#             return self.build_set.filter(state='stable').order_by('-started')[0]
#         except (self.build_set.model.DoesNotExist, IndexError):
#             return None
# 
#     @property
#     def outstanding_builds(self):
#         return self.build_set.filter(Q(Q(state='queued') | Q(state='unknown')))
# 
#     @property
#     def builds(self):
#         return self.build_set.exclude(Q(Q(state='queued') | Q(state='unknown')))


# Path: journeyman/projects/forms.py
from django import forms
from journeyman.projects.models import Project

        (e.g. git+git://github.com/stephrdev/loetwerk.git)')

class BuildProcessForm(forms.Form):
    build_steps = forms.CharField(initial='python setup.py install',
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Let\'s start off with the easy stuff, please type in all \
        the commands needed to install your package')
    test_steps = forms.CharField(initial='python setup.py test',
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Now tell us how to run your tests. If you should have \
        many different test suites, just add another line.')
    dependencies = forms.CharField(required=False, initial='dependencies.txt',
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Please enter a list of pip requirement files that you \
        have used to specify your dependencies')
    test_xmls = forms.CharField(required=False,
        widget=forms.Textarea(attrs={'rows':3, 'cols':40}),
        help_text='Please enter a newline separated list of paths of \
        unit test result xmls.')

class JourneyConfigOutputForm(forms.Form):
    pass

class JourneyConfigFileForm(forms.Form):
    config_file = forms.CharField(initial="journey.conf/config",
        help_text="If you leave this field blank, we will store the config \
        locally.", required=False)

class ProjectForm(forms.ModelForm):
    class Meta:

        model = Project