blob: 58397ac9a394c2bcc16a09ee64d14c20d8295bfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--------------------------------------------------------------------------------
-- | Exports simple compilers to just copy files
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hakyll.Core.Writable.CopyFile
( CopyFile (..)
, copyFileCompiler
) where
--------------------------------------------------------------------------------
import Data.Binary (Binary (..))
import Data.Typeable (Typeable)
import System.Directory (copyFile)
--------------------------------------------------------------------------------
import Hakyll.Core.Compiler
import Hakyll.Core.Identifier
import Hakyll.Core.Item
import Hakyll.Core.Writable
--------------------------------------------------------------------------------
-- | This will copy any file directly by using a system call
data CopyFile = CopyFile
deriving (Show, Eq, Ord, Typeable)
--------------------------------------------------------------------------------
instance Binary CopyFile where
put CopyFile = return ()
get = return CopyFile
--------------------------------------------------------------------------------
instance Writable CopyFile where
write dst item = copyFile (toFilePath $ itemIdentifier item) dst
--------------------------------------------------------------------------------
copyFileCompiler :: Compiler (Item CopyFile)
copyFileCompiler = makeItem CopyFile
|