mirror of
https://github.com/srid/rib.git
synced 2024-11-30 03:45:00 +03:00
Rib.App: fix ghcid not resetting cmdargs state
The `modes` need to be inside a function, apparently.
This commit is contained in:
parent
bc380f5869
commit
aae2906737
@ -5,9 +5,7 @@ Credit for this image: https://www.svgrepo.com/svg/24439/ribs
|
|||||||
-->
|
-->
|
||||||
<img src="https://raw.githubusercontent.com/srid/rib/master/example/content/static/ribs.svg?sanitize=true" width="150" />
|
<img src="https://raw.githubusercontent.com/srid/rib/master/example/content/static/ribs.svg?sanitize=true" width="150" />
|
||||||
|
|
||||||
Rib is a static site generator written in Haskell using sensible technologies
|
Rib is a static site generator written in Haskell that reuses existing tools (`Shake`, `Lucid` and `Clay`) and is thus non-monolithic. It is nearly done but still a work in progress and will soon be ready for general use.
|
||||||
like `Shake`, `Lucid` and `Clay`. It is nearly done but still a work in progress
|
|
||||||
and will soon be ready for general use.
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
@ -25,7 +23,9 @@ example/Main.hs 15 6 90
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
```
|
```
|
||||||
|
|
||||||
With Rib you do not have to deal with the less powerful template engines or
|
(See `Rib.Simple` if you need further customization.)
|
||||||
|
|
||||||
|
With Rib you do not have to deal with less powerful template engines or
|
||||||
write raw HTML/CSS by hand. Do everything in Haskell, and concisely at that!
|
write raw HTML/CSS by hand. Do everything in Haskell, and concisely at that!
|
||||||
|
|
||||||
To get the example site up and running run:
|
To get the example site up and running run:
|
||||||
|
12
ghcid
12
ghcid
@ -1,7 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
RIB=$(cd `dirname $0` && pwd)
|
# The path to git checkout of github.com/srid/rib.
|
||||||
MAIN="Main.hs"
|
# As this script resides under this repo, it is simply the parent directory of it.
|
||||||
|
RIBDIR=$(cd `dirname $0` && pwd)
|
||||||
|
|
||||||
nix-shell ${RIB}/default.nix --run \
|
# If your program file is Main.hs set this to Main
|
||||||
"ghcid --reload=${MAIN} -c 'ghci -Wall -i${RIB}/src ${MAIN}' -T 'System.Environment.withArgs [\"serve\", \"-w\"] Main.main'"
|
MAIN="Main"
|
||||||
|
|
||||||
|
nix-shell ${RIBDIR}/default.nix --run \
|
||||||
|
"ghcid --reload=${MAIN}.hs -c 'ghci -Wall -i${RIBDIR}/src ${MAIN}.hs' -T 'System.Environment.withArgs [\"serve\", \"-w\"] ${MAIN}.main'"
|
||||||
|
@ -12,7 +12,7 @@ import Control.Concurrent (threadDelay)
|
|||||||
import Control.Concurrent.Async (concurrently_)
|
import Control.Concurrent.Async (concurrently_)
|
||||||
import Control.Monad (forever, void, when)
|
import Control.Monad (forever, void, when)
|
||||||
|
|
||||||
import System.Console.CmdArgs (Data, Typeable, auto, cmdArgs, help, modes, (&=))
|
import System.Console.CmdArgs
|
||||||
import System.FSNotify (watchTree, withManager)
|
import System.FSNotify (watchTree, withManager)
|
||||||
|
|
||||||
import qualified Rib.Server as Server
|
import qualified Rib.Server as Server
|
||||||
@ -25,8 +25,11 @@ data App
|
|||||||
| Generate { force :: Bool }
|
| Generate { force :: Bool }
|
||||||
deriving (Data,Typeable,Show,Eq)
|
deriving (Data,Typeable,Show,Eq)
|
||||||
|
|
||||||
cli :: App
|
-- | CLI entry point for running the Rib app
|
||||||
cli = modes
|
run :: S.Settings page -> IO ()
|
||||||
|
run cfg = runWith cfg =<< cmdArgs ribCli
|
||||||
|
where
|
||||||
|
ribCli = modes
|
||||||
[ Watch
|
[ Watch
|
||||||
&= help "Watch for changes and generate"
|
&= help "Watch for changes and generate"
|
||||||
, Serve
|
, Serve
|
||||||
@ -39,10 +42,6 @@ cli = modes
|
|||||||
&= auto -- Generate is the default command.
|
&= auto -- Generate is the default command.
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | CLI entry point for running the Rib app
|
|
||||||
run :: S.Settings page -> IO ()
|
|
||||||
run cfg = runWith cfg =<< cmdArgs cli
|
|
||||||
|
|
||||||
-- | Like `run` but uses the given `App` mode instead of reading it from CLI
|
-- | Like `run` but uses the given `App` mode instead of reading it from CLI
|
||||||
-- arguments.
|
-- arguments.
|
||||||
runWith :: S.Settings page -> App -> IO ()
|
runWith :: S.Settings page -> App -> IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user