packages feed

mkcabal 0.2 → 0.3

raw patch · 2 files changed

+41/−16 lines, 2 files

Files

mkcabal.cabal view
@@ -1,5 +1,5 @@ Name:                mkcabal-Version:             0.2+Version:             0.3 License:             GPL License-file:        LICENSE Homepage:            http://code.haskell.org/~dons/code/mkcabal
mkcabal.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fglasgow-exts #-} -- Pattern guards -- --- Copyright (c) 2006 Don Stewart - http://www.cse.unsw.edu.au/~dons+-- Copyright (c) 2006-7 Don Stewart <dons@galois.com> --  -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License as@@ -73,6 +73,26 @@           | Executable  -- we're creating an executable     deriving (Eq, Read, Show) +data Category+    = Codec+    | Control+    | Data+    | Database+    | Development+    | Distribution+    | Game+    | Graphics+    | Language+    | Math+    | Network+    | Sound+    | System+    | Testing+    | Text+    | Web+    | Other+    deriving (Read, Show, Eq, Ord, Bounded, Enum)+ -- -- A type for a simple cabal file -- @@ -80,6 +100,7 @@     Cabal { name         :: String           , version      :: (Int,Int)           , description  :: String+          , category     :: String           , license      :: String           , author       :: String           , email        :: String@@ -101,21 +122,23 @@ -- ppr :: Cabal -> String ppr c = render $-    vcat [ field "Name"          (name          c)-         , field "Version"       ((show.fst.version$ c) +.+ (show.snd.version$ c))-         , field "Description"   (description   c)-         , field "License"       (license       c)-         , field "License-file"  "LICENSE"-         , field "Author"        (author        c)-         , field "Maintainer"    (email         c)-         , field "Build-Depends" (depends       c)] $$+    vcat [ field "name"          (name          c)+         , field "version"       ((show.fst.version$ c) +.+ (show.snd.version$ c))+         , field "synopsis"      (description   c)+         , field "description"   (description   c)+         , field "category"      (category      c)+         , field "license"       (license       c)+         , field "license-file"  "LICENSE"+         , field "author"        (author        c)+         , field "maintainer"    (email         c)+         , field "build-Depends" (depends       c)] $$      ( if cabal_type c == Executable         then             let Just e = exec_stanza c             in vcat [ text ""-                    , field "Executable"    (executable    e)-                    , field "Main-is"       (main_is_file  e)] $$ empty+                    , field "executable"    (executable    e)+                    , field "main-is"       (main_is_file  e)] $$ empty         else empty )      $$ field "ghc-options"   (ghc_options   c)@@ -136,9 +159,10 @@     evaluate mode      -- todo, provide arguments or prompting-    p <- promptStr "Project name"         Nothing-    l <- promptStr "What license"         $ Just (licenses, 4)+    p <- promptStr "Project name"      Nothing+    l <- promptStr "What license"      $ Just (licenses, 4)     e <- prompt "What kind of project" $ Just ([Executable,Library], 0)+    c <- prompt "Under what category?" $ Just ([Codec ..], 0)      (person, mail) <- queryAuthorNameMail     per <- query "Is this your name?" $ Just person@@ -149,12 +173,13 @@         d  = lc         cabal = Cabal { name        = lc                       , version     = (0,0)-                      , description = "Project description"+                      , description = "<Project description>"                       , license     = l+                      , category    = if c == Other then "" else show c                       , author      = per                       , email       = ml                       , depends     = "base"-                      , ghc_options = "-O"+                      , ghc_options = ""                       , cabal_type  = e                       , exec_stanza = if e /= Executable                                       then Nothing