Commit a195c45c authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Change version handling a little bit

Also remove the resources in `~/.local/share` when `clean` is performed
on a development version.
parent 0da8888e
......@@ -162,6 +162,7 @@ main = do
need [src]
pdflatex ["-output-directory", dir, src]
pdf2svg [pdf, out]
liftIO $ removeFile pdf
priority 2 $
"//*.css" %> \out -> do
let src = out -<.> ".scss"
......@@ -180,6 +181,9 @@ main = do
phony "clean" $ do
removeFilesAfter publicDir ["//"]
removeFilesAfter projectDir cruft
when isDevelopmentVersion $
removeFilesAfter appDataDir ["//"]
--
phony "help" $ do
text <- liftIO $ getResourceString "template/help-page.md"
......
name: decker
version: 0.4.0
version: 0.4.0.0
synopsis: All inclusive slide deck creation with pandoc.
description: Please see README.md
homepage: https://tramberend.beuth-hochschule.de/decker
......
......@@ -2,17 +2,24 @@
module Common
( DeckerException(..)
, deckerVersion
, isDevelopmentVersion
) where
import Control.Exception
import Data.Typeable
import Data.Version (showVersion)
import Data.Version (showVersion, versionBranch)
import Paths_decker (version)
-- | The version from the cabal file
deckerVersion :: String
deckerVersion = showVersion version
-- | Is this a developement version? Development versions have 4 branches, and
-- the 4th branch number is always 0. Release branches have only three.
isDevelopmentVersion :: Bool
isDevelopmentVersion =
(length $ versionBranch version) == 4 && (versionBranch version) !! 3 == 0
-- | Tool specific exceptions
data DeckerException
= MustacheException String
......
......@@ -197,6 +197,7 @@ getPandocWriter format =
versionCheck :: Meta -> Action ()
versionCheck meta =
unless isDevelopmentVersion $
case lookupMeta "decker-version" meta of
Just (MetaInlines version) -> check $ stringify version
Just (MetaString version) -> check version
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment