diff options
-rw-r--r-- | hakyll.cabal | 31 | ||||
-rw-r--r-- | src/Hakyll/Core/Configuration.hs | 16 | ||||
-rw-r--r-- | src/Hakyll/Main.hs | 12 |
3 files changed, 41 insertions, 18 deletions
diff --git a/hakyll.cabal b/hakyll.cabal index ba89a6d..47b0948 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -56,28 +56,29 @@ Library Build-Depends: base >= 4 && < 5, - filepath == 1.*, - directory == 1.*, + binary >= 0.5, + blaze-html >= 0.4, + bytestring >= 0.9, containers == 0.*, - pandoc == 1.*, - regex-base >= 0.93, - regex-pcre >= 0.93, + directory == 1.*, + filepath == 1.*, + hamlet >= 0.7, + hopenssl >= 1.4, + HTTP >= 4000, mtl >= 1, old-locale == 1.*, old-time == 1.*, - time >= 1.1, - binary >= 0.5, - hamlet >= 0.7, - blaze-html >= 0.4, - snap-server >= 0.4, + pandoc == 1.*, + process >= 1.0, + regex-base >= 0.93, + regex-pcre >= 0.93, snap-core >= 0.4, - bytestring >= 0.9, - utf8-string >= 0.3, - HTTP >= 4000, + snap-server >= 0.4, + strict-concurrency >= 0.2, tagsoup >= 0.12, - hopenssl >= 1.4, + time >= 1.1, unix >= 2.4, - strict-concurrency >= 0.2 + utf8-string >= 0.3 Exposed-Modules: Hakyll diff --git a/src/Hakyll/Core/Configuration.hs b/src/Hakyll/Core/Configuration.hs index 985f5ae..e71d52d 100644 --- a/src/Hakyll/Core/Configuration.hs +++ b/src/Hakyll/Core/Configuration.hs @@ -13,7 +13,7 @@ data HakyllConfiguration = HakyllConfiguration { -- | Directory in which the output written destinationDirectory :: FilePath , -- | Directory where hakyll's internal store is kept - storeDirectory :: FilePath + storeDirectory :: FilePath , -- | Function to determine ignored files -- -- In 'defaultHakyllConfiguration', the following files are ignored: @@ -28,7 +28,18 @@ data HakyllConfiguration = HakyllConfiguration -- also be ignored. Note that this is the configuration parameter, if you -- want to use the test, you should use @shouldIgnoreFile@. -- - ignoreFile :: FilePath -> Bool + ignoreFile :: FilePath -> Bool + , -- | Here, you can plug in a system command to upload/deploy your site. + -- + -- Example: + -- + -- > rsync -ave 'ssh -p 2217' _site jaspervdj@jaspervdj.be:hakyll + -- + -- You can execute this by using + -- + -- > ./hakyll deploy + -- + deployCommand :: String } -- | Default configuration for a hakyll application @@ -38,6 +49,7 @@ defaultHakyllConfiguration = HakyllConfiguration { destinationDirectory = "_site" , storeDirectory = "_cache" , ignoreFile = ignoreFile' + , deployCommand = "echo 'No deploy command specified'" } where ignoreFile' path diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs index 2513303..ef5c4c8 100644 --- a/src/Hakyll/Main.hs +++ b/src/Hakyll/Main.hs @@ -8,8 +8,9 @@ module Hakyll.Main import Control.Applicative ((<$>)) import Control.Concurrent (forkIO) import Control.Monad (when) -import System.Environment (getProgName, getArgs) import System.Directory (doesDirectoryExist, removeDirectoryRecursive) +import System.Environment (getProgName, getArgs) +import System.Process (system) import qualified Data.Set as S import Hakyll.Core.Configuration @@ -40,6 +41,7 @@ hakyllWith conf rules = do ["rebuild"] -> rebuild conf rules ["server"] -> server conf 8000 ["server", p] -> server conf (read p) + ["deploy"] -> deploy conf _ -> help -- | Build the site @@ -80,6 +82,7 @@ help = do , name ++ " preview [port] Run a server and autocompile" , name ++ " rebuild Clean up and build again" , name ++ " server [port] Run a local test server" + , name ++ " deploy Upload/deploy your site" ] -- | Preview the site @@ -109,3 +112,10 @@ server conf port = do staticServer destination preServeHook port where preServeHook _ = return () + +-- Upload the site +-- +deploy :: HakyllConfiguration -> IO () +deploy conf = do + _ <- system $ deployCommand conf + return () |