packages feed

rib 0.2.0.0 → 0.3.0.0

raw patch · 4 files changed

+39/−13 lines, 4 files

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Change Log for rib +## 0.3.0.0++- Rename `Rib.App.Watch` to `Rib.App.WatchAndGenerate`+ ## 0.2.0.0  - Initial release.
README.md view
@@ -1,10 +1,10 @@-<!---Credit for this image: https://www.svgrepo.com/svg/24439/ribs--->-<img align="right" width="50" src="https://raw.githubusercontent.com/srid/rib/master/assets/rib.svg?sanitize=true" />+![Logo](https://raw.githubusercontent.com/srid/rib/master/assets/rib.png)  # rib +[![BSD3](https://img.shields.io/badge/License-BSD-blue.svg)](https://en.wikipedia.org/wiki/BSD_License)+[![Hackage](https://img.shields.io/hackage/v/rib.svg)](https://hackage.haskell.org/package/rib)+ Rib is a Haskell library for writing your own **static site generator**.  How does it compare to Hakyll?@@ -25,7 +25,7 @@ Here is how your code may look like if you were to generate your static site using Rib: -<img src="https://raw.githubusercontent.com/srid/rib/master/assets/rib-sample-main.png" />+![Example](https://raw.githubusercontent.com/srid/rib/master/assets/rib-sample-main.png)  ## Getting Started @@ -66,6 +66,10 @@ nix-shell --run 'ghcid -T main' ``` +(Note even though the author recommends it Nix is strictly not required; you may+simply run `ghcid -T main` instead of the above command if you do not wish to+use Nix.)+ Running this command gives you a local HTTP server at http://localhost:8080/ (serving the generated files) that automatically reloads when either the content (`a/`) or the HTML/CSS/build-actions (`Main.hs`) changes. Hot reload, in other@@ -123,7 +127,8 @@ [`Rib.Simple`](https://github.com/srid/rib/blob/master/src/Rib/Simple.hs) module to your `Main.hs` -1. Make any customizations you want in *your* `buildAction` function.+1. Make any customizations you want in *your* `buildAction` function. Refer to+   [Hackage](http://hackage.haskell.org/package/rib) for API docs.  1. Use that as the argument to the `Rib.App.run` function in your `main` 
rib.cabal view
@@ -1,14 +1,17 @@ cabal-version: 2.2 name: rib-version: 0.2.0.0+version: 0.3.0.0 license: BSD-3-Clause copyright: 2019 Sridhar Ratnakumar maintainer: srid@srid.ca author: Sridhar Ratnakumar homepage: https://github.com/srid/rib#readme bug-reports: https://github.com/srid/rib/issues+synopsis:+    Static site generator using Shake description:     Haskell library for writing your own static site generator+category: Web build-type: Simple extra-source-files:     README.md
src/Rib/App.hs view
@@ -25,10 +25,24 @@  import qualified Rib.Server as Server +-- | Application modes+--+-- The mode in which to run the Rib CLI data App-  = Watch-  | Serve { port :: Int, dontWatch :: Bool }-  | Generate { force :: Bool }+  = Generate+    { force :: Bool+      -- ^ Force generation of /all/ files+    }+  -- ^ Generate static files once.+  | WatchAndGenerate+  -- ^ Watch for changes in `ribInputDir` and run `Generate`+  | Serve+    { port :: Int+      -- ^ Port to bind the server+    , dontWatch :: Bool+      -- ^ Unless set run `WatchAndGenerate` automatically+    }+  -- ^ Run a HTTP server serving `ribOutputDir`   deriving (Data,Typeable,Show,Eq)  -- | The path where static files will be generated.@@ -56,7 +70,7 @@           , dontWatch = False &= help "Do not watch in addition to serving generated files"           } &= help "Serve the generated site"             &= auto-      , Watch+      , WatchAndGenerate           &= help "Watch for changes and generate"       , Generate           { force = False &= help "Force generation of all files"@@ -66,7 +80,7 @@ -- | Like `run` but with an explicitly passed `App` mode runWith :: Action () -> App -> IO () runWith buildAction = \case-  Watch -> withManager $ \mgr -> do+  WatchAndGenerate -> withManager $ \mgr -> do     -- Begin with a *full* generation as the HTML layout may have been changed.     runWith buildAction $ Generate True     -- And then every time a file changes under the current directory@@ -77,7 +91,7 @@     forever $ threadDelay maxBound    Serve p dw -> concurrently_-    (unless dw $ runWith buildAction Watch)+    (unless dw $ runWith buildAction WatchAndGenerate)     (Server.serve p ribOutputDir)    Generate forceGen ->