Skip to content

Commit

Permalink
fix dependencies for index file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
monofon committed Jan 10, 2025
1 parent 163e842 commit d66f00d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
39 changes: 30 additions & 9 deletions app/Decker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ deckerRules = do
deps <- getDeps
let sources = Map.elems (deps ^. questions)
need sources
-- renderQuestionBrowser meta (deps ^. questions) out
renderCatalog meta sources out
--
privateDir <//> "quest-catalog.xml" %> \out -> do
Expand Down Expand Up @@ -265,6 +266,8 @@ deckerRules = do
generated %> \out -> do
deps <- getDeps
meta <- getGlobalMeta
targets <- liftIO targetsFile
need [targets]
writeIndexLists meta deps out
--
generatedIndex %> \out -> do
Expand Down Expand Up @@ -330,17 +333,31 @@ deckerRules = do
withTargetDocs "Provide information about project parameters, sources and targets" $
phony "info" $ do
project <- liftIO $ Dir.canonicalizePath projectDir
putWarn $ "\nproject directory: " ++ project
putWarn $ "public directory: " ++ publicDir
putWarn $ "support directory: " ++ supportDir
meta <- getGlobalMeta
deps <- getDeps
resources <- liftIO $ deckerResources meta
putWarn $ "template source: " <> show resources
putWarn "\ndependencies:\n"
putWarn (groom deps)
putWarn "\ntop level meta data:\n"
putWarn (groom meta)
liftIO $ do
putStrLn $ "\nproject directory: " ++ project
putStrLn $ "public directory: " ++ publicDir
putStrLn $ "support directory: " ++ supportDir
putStrLn $ "transient directory: " ++ transient
putStrLn $ "template source: " <> show resources
--
withTargetDocs "Provide information about project parameters, sources and targets" $
phony "more-info" $ do
need ["info"]
meta <- getGlobalMeta
liftIO $ do
putStrLn "\ntop level meta data:\n"
putStrLn (groom meta)
--
withTargetDocs "Provide information about project parameters, sources and targets" $
phony "even-more-info" $ do
need ["more-info"]
deps <- getDeps
liftIO $ do
putStrLn "\ndependencies:\n"
putStrLn (groom deps)
--
withTargetDocs "Check the existence of usefull external programs" $
phony "check" $
Expand All @@ -349,7 +366,7 @@ deckerRules = do
withTargetDocs "Copy runtime support files to public dir." $
phony "support" $ do
deps <- getDeps
need [indexFile, "static-files"]
need [indexFile, generatedIndex, "static-files"]
-- Resources and their locations are now recorded in deps
need $ Map.keys (deps ^. resources)
withTargetDocs "Publish the public dir to the configured destination using rsync." $
Expand Down Expand Up @@ -393,6 +410,10 @@ deckerRules = do
ssh [host, "mkdir -p", path] Nothing
rsync [src, dst] Nothing

renderQuestionBrowser :: Meta -> Dependencies -> FilePath -> Action ()
renderQuestionBrowser meta questDeps out = do
return ()

createPublicManifest :: Action ()
createPublicManifest = do
let manifestPath = publicDir <> "/" <> "manifest.json"
Expand Down
13 changes: 7 additions & 6 deletions src/Text/Decker/Project/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ import Text.Decker.Project.ActionContext
import Text.Decker.Project.Glob (fastGlobDirs)
import Text.Decker.Project.Project
import Text.Decker.Project.Version
import Text.Decker.Reader.Markdown (formatStdin)
import Text.Decker.Resource.Resource
import Text.Decker.Server.Server
import Text.Decker.Server.Types
import Text.Decker.Server.Video
import Text.Pandoc (Meta)
import Text.Pandoc.Definition (nullMeta)
import Text.Decker.Reader.Markdown (formatStdin)

runDecker :: Rules () -> IO ()
runDecker rules = do
Expand Down Expand Up @@ -94,11 +94,6 @@ runTargets context targets rules = do
let PortFlag port = fromMaybe (PortFlag 8888) $ find aPort flags
openBrowser $ "http://localhost:" <> show port <> "/index.html"

-- always rescan the targets file in case files where added or removed
let meta = context ^. globalMeta
targets <- targetsFile
scanTargetsToFile meta targets

-- Always run at least once
runShake context rules

Expand All @@ -117,6 +112,11 @@ runTargets context targets rules = do

runShake :: ActionContext -> Rules () -> IO ()
runShake context rules = do
-- always rescan the targets file in case files where added or removed
let meta = context ^. globalMeta
targets <- targetsFile
scanTargetsToFile meta targets

options <- deckerShakeOptions context
shakeArgsWith options deckerFlags (\_ _ -> return $ Just rules)

Expand All @@ -126,6 +126,7 @@ _runShakeSlyly context rules = do
let meta = context ^. globalMeta
targets <- targetsFile
scanTargetsToFile meta targets

let flags = context ^. extra
extractMetaIntoFile flags
options <- deckerShakeOptions context
Expand Down

0 comments on commit d66f00d

Please sign in to comment.