packages feed

HarmTrace 2.1 → 2.2.0

raw patch · 3 files changed

+63/−1 lines, 3 files

Files

HarmTrace.cabal view
@@ -1,5 +1,5 @@ name:                   HarmTrace
-version:                2.1
+version:                2.2.0
 synopsis:               Harmony Analysis and Retrieval of Music
 description:            HarmTrace: Harmony Analysis and Retrieval of Music 
                         with Type-level Representations of Abstract
@@ -33,6 +33,7 @@ executable harmtrace
   hs-source-dirs:       src
   other-modules:        Constants
+                        Replace
 
                         HarmTrace.HarmTrace
 
@@ -45,6 +46,8 @@                         HarmTrace.Audio.Evaluation
                         HarmTrace.Audio.Statistical
 
+                        HarmTrace.Base.Instances
+
                         HarmTrace.HAnTree.HAn
                         HarmTrace.HAnTree.HAnParser
                         HarmTrace.HAnTree.PostProcess
@@ -130,6 +133,8 @@                         HarmTrace.Audio.Key
                         HarmTrace.Audio.Evaluation
                         HarmTrace.Audio.Statistical
+
+                        HarmTrace.Base.Instances
 
                         HarmTrace.HAnTree.HAn
                         HarmTrace.HAnTree.HAnParser
+ src/HarmTrace/Base/Instances.hs view
@@ -0,0 +1,19 @@+{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE EmptyDataDecls             #-}
+{-# LANGUAGE TypeFamilies               #-}
+{-# LANGUAGE GADTs                      #-}
+
+module HarmTrace.Base.Instances where
+
+import Control.DeepSeq
+
+import HarmTrace.Base.MusicRep
+
+--------------------------------------------------------------------------------
+-- NFData instances for HarmTrace-Base
+--------------------------------------------------------------------------------
+
+instance NFData Mode where
+  rnf MinMode = ()
+  rnf MajMode = ()
+ src/Replace.hs view
@@ -0,0 +1,38 @@+
+--------------------------------------------------------------------------------
+-- |
+-- Module      :  Replace
+-- Copyright   :  (c) 2010-2012 Universiteit Utrecht, 2012 University of Oxford
+-- License     :  GPL3
+--
+-- Maintainer  :  bash@cs.uu.nl, jpm@cs.ox.ac.uk
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Summary: Script that fills out the 'vERSION' in 'Constants'
+--------------------------------------------------------------------------------
+
+module Replace where
+
+import System.IO
+import System.Process (readProcess)
+import Data.List (isPrefixOf)
+import HarmTrace.IO.Common (hGetContents')
+
+
+main :: IO ()
+main = do handle <- openFile "Constants.hs" ReadMode
+          file   <- hGetContents' handle
+          hClose handle
+
+          commit <- readProcess "git" ["describe", "--tags"] ""
+                 -- readProcess "git" ["rev-parse", "HEAD"] ""
+
+          let needle = "gitVersion = "
+              -- The `init` is to remove the \n at the end
+              newver = needle ++ "\"" ++ init commit ++ "\""
+              perLine line = if needle `isPrefixOf` line then newver else line
+
+          handle <- openFile "Constants.hs" WriteMode
+          hPutStr handle (unlines (map perLine (lines file)))
+          hClose handle