Commit 930cc82e authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Use threaded builds by default

parent 029ee029
......@@ -10,6 +10,7 @@ import Data.Maybe
import Data.String ()
import Development.Shake
import Development.Shake.FilePath
import GHC.Conc (numCapabilities)
import Project
import Resources
import System.Exit
......@@ -28,10 +29,8 @@ main = do
let publicDir = public dirs
let supportDir = support dirs
let appDataDir = appData dirs
let serverPort = 8888
let serverUrl = "http://localhost:" ++ (show serverPort)
-- Find sources. These are formulated as actions in the Action mondad, such
-- that each new iteration rescans all possible source files.
let deckSourcesA = globA "**/*-deck.md"
......@@ -167,8 +166,7 @@ main = do
everythingA <++> everythingPdfA >>= mapM_ putNormal
--
-- phony "support" $ writeEmbeddedFiles deckerSupportDir supportDir
phony "support" $ do
liftIO $ writeResourceFiles "support" supportDir
phony "support" $ do liftIO $ writeResourceFiles "support" supportDir
--
phony "publish" $ do
need ["support"]
......@@ -181,10 +179,13 @@ main = do
let src = publicDir ++ "/"
let dst = intercalate ":" [fromJust host, fromJust path]
cmd "ssh " (fromJust host) "mkdir -p" (fromJust path) :: Action ()
cmd "rsync --recursive --no-xattrs --no-group --perms --chmod=a+r,go-w --no-owner --copy-links" src dst :: Action ()
cmd
"rsync --recursive --no-xattrs --no-group --perms --chmod=a+r,go-w --no-owner --copy-links"
src
dst :: Action ()
else throw RsyncUrlException
-- Calculate some directories
-- | Some constants that might need tweaking
options :: ShakeOptions
options = shakeOptions {shakeFiles = ".shake"}
options = shakeOptions {shakeFiles = ".shake", shakeThreads = numCapabilities}
......@@ -12,6 +12,7 @@ module Context
, getProjectDirs
, actionContextKey
, getActionContext
, getPublicResource
) where
import Control.Monad ()
......@@ -20,7 +21,7 @@ import qualified Data.HashMap.Lazy as HashMap
import Data.IORef
import Data.Maybe (fromMaybe)
import Data.Typeable ()
import Development.Shake
import Development.Shake as Shake
import Project
import Server
......@@ -28,6 +29,7 @@ data ActionContext = ActionContext
{ ctxFilesToWatch :: IORef [FilePath]
, ctxServerHandle :: IORef (Maybe Server)
, ctxDirs :: ProjectDirs
, ctxPublicResource :: Shake.Resource
} deriving (Typeable, Show)
instance Show (IORef a) where
......@@ -37,7 +39,8 @@ defaultActionContext :: IO ActionContext
defaultActionContext = do
files <- newIORef []
server <- newIORef Nothing
return $ ActionContext files server (ProjectDirs "" "" "" "" "" "")
resource <- newResourceIO "PublicDir" 1
return $ ActionContext files server (ProjectDirs "" "" "" "" "" "") resource
actionContextKey :: IO TypeRep
actionContextKey = do
......@@ -90,3 +93,8 @@ getProjectDirs :: Action ProjectDirs
getProjectDirs = do
ctx <- getActionContext
return $ ctxDirs ctx
getPublicResource :: Action Shake.Resource
getPublicResource = do
ctx <- getActionContext
return $ ctxPublicResource ctx
......@@ -43,11 +43,11 @@ import qualified Data.Text.Encoding as E
import qualified Data.Yaml as Y
import Development.Shake
import Development.Shake.FilePath as SFP
import Render
import Filter
import Meta
import Network.URI
import Project
import Render
import Resources
import Server
import qualified System.Directory as Dir
......@@ -260,12 +260,14 @@ provisionResource provisioning base path =
dirs <- getProjectDirs
need [uriPath uri]
let resource = resourcePathes dirs base uri
liftIO $
case provisioning of
Copy -> copyResource resource
SymLink -> linkResource resource
Absolute -> absRefResource resource
Relative -> relRefResource base resource
publicResource <- getPublicResource
withResource publicResource 1 $ do
liftIO $
case provisioning of
Copy -> copyResource resource
SymLink -> linkResource resource
Absolute -> absRefResource resource
Relative -> relRefResource base resource
putCurrentDocument :: FilePath -> Action ()
putCurrentDocument out = do
......
......@@ -113,7 +113,11 @@ history: True
- Assign content to layout area
- On elements *Header 2*, *Image*, *Code Block*, *DIV*
## Example {.right}
## Second box
- In this extra wide column
## {.right}
![](include/06-metal.png)
......
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