From d69c5e8abc9641169234354700aaa930c6a99d99 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 2 May 2016 23:51:53 +0000 Subject: [PATCH] Repos specify their VCS (i.e. Git or Darcs) in the DB --- config/models | 7 ++++--- src/Vervis/Form/Repo.hs | 2 ++ src/Vervis/Model.hs | 2 ++ src/Vervis/Model/Repo.hs | 28 ++++++++++++++++++++++++++++ vervis.cabal | 1 + 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 src/Vervis/Model/Repo.hs diff --git a/config/models b/config/models index 96826ff..4ed4d12 100644 --- a/config/models +++ b/config/models @@ -52,9 +52,10 @@ Project Repo ident Text --CI sharer SharerId - project ProjectId Maybe - desc Text Maybe - mainBranch Text default='master' + vcs VersionControlSystem default='VCSGit' + project ProjectId Maybe + desc Text Maybe + mainBranch Text default='master' UniqueRepo ident sharer diff --git a/src/Vervis/Form/Repo.hs b/src/Vervis/Form/Repo.hs index 1d49261..20a93ed 100644 --- a/src/Vervis/Form/Repo.hs +++ b/src/Vervis/Form/Repo.hs @@ -20,11 +20,13 @@ where import Vervis.Import import Vervis.Field.Repo +import Vervis.Model.Repo newRepoAForm :: SharerId -> AForm Handler Repo newRepoAForm sid = Repo <$> areq (mkIdentField sid) "Identifier*" Nothing <*> pure sid + <*> pure VCSGit <*> pure Nothing <*> aopt textField "Description" Nothing <*> pure "master" diff --git a/src/Vervis/Model.hs b/src/Vervis/Model.hs index b730c9e..95f93e0 100644 --- a/src/Vervis/Model.hs +++ b/src/Vervis/Model.hs @@ -23,6 +23,8 @@ import Yesod hiding (Header, parseTime) import Database.Persist.Quasi import Yesod.Auth.HashDB (HashDBUser (..)) +import Vervis.Model.Repo + -- You can define all of your database entities in the entities file. -- You can find more information on persistent and how to declare entities at: -- http://www.yesodweb.com/book/persistent/ diff --git a/src/Vervis/Model/Repo.hs b/src/Vervis/Model/Repo.hs new file mode 100644 index 0000000..f0f2ceb --- /dev/null +++ b/src/Vervis/Model/Repo.hs @@ -0,0 +1,28 @@ +{- This file is part of Vervis. + - + - Written in 2016 by fr33domlover . + - + - ♡ Copying is an act of love. Please copy, reuse and share. + - + - The author(s) have dedicated all copyright and related and neighboring + - rights to this software to the public domain worldwide. This software is + - distributed without any warranty. + - + - You should have received a copy of the CC0 Public Domain Dedication along + - with this software. If not, see + - . + -} + +module Vervis.Model.Repo + ( VersionControlSystem (..) + ) +where + +import Prelude + +import Database.Persist.TH + +data VersionControlSystem = VCSGit | VCSDarcs + deriving (Eq, Show, Read) + +derivePersistField "VersionControlSystem" diff --git a/vervis.cabal b/vervis.cabal index 2e27c45..98a8c41 100644 --- a/vervis.cabal +++ b/vervis.cabal @@ -60,6 +60,7 @@ library Vervis.Import.NoFoundation Vervis.MediaType Vervis.Model + Vervis.Model.Repo Vervis.Readme Vervis.Render Vervis.Settings