1
1
mirror of https://github.com/srid/rib.git synced 2024-11-27 01:12:09 +03:00
Commit Graph

358 Commits

Author SHA1 Message Date
Sridhar Ratnakumar
57163591c2 De-expose Target constructor 2020-02-02 16:15:31 -05:00
Sridhar Ratnakumar
295974df87 Remove the Source type 2020-02-02 16:09:08 -05:00
Sridhar Ratnakumar
c43641eaac Add src type variable to Target type
And use it from Rib.Shake
2020-02-02 16:07:51 -05:00
Sridhar Ratnakumar
4e524aaa12 Add Rib.Target
Like Source but without sourcePath. In order to represent documents with
no associated source.
2020-02-02 15:15:08 -05:00
Sridhar Ratnakumar
2dca8d270b Always log before invoking Shake
For directories with large number of files Shake takes a long while to
bootstrap.
2020-02-02 13:13:11 -05:00
Sridhar Ratnakumar
039cb9a009
Merge pull request #98 from srid/update-shake
Update shake to 0.18.5, and nixpkgs
2020-02-02 12:48:24 -05:00
Sridhar Ratnakumar
57b242b275 Disable tests for Shake 2020-02-02 12:18:04 -05:00
Sridhar Ratnakumar
93de574526 Update nixpkgs; and shake to 0.18.5 2020-02-02 12:00:25 -05:00
Sridhar Ratnakumar
94e3822615 Replace concurrently_ with forkIO
When one thread fails, concurrently_ cancels the other thread; this
raises AsyncCancelled in that thread.

We don't want this behaviour. One thread should not have to handle the
exceptions from other thread.

Just use forkIO for getting back to reasonable behaviour. In future I
might want to manage these threads in a saner manner.
2020-01-29 14:12:34 -05:00
Sridhar Ratnakumar
a57e7ab7ef Use watchTreeChan instead of watchTree
The later spawns a thread, and can run shake concurrently which is not
what we want. The former allows us to process the events serially.

Fixes #95
2020-01-22 10:59:58 -05:00
Sridhar Ratnakumar
7d6e1e74eb
Ability to customize the output filepath (#94)
- Introduced `forEvery` to run a Shake action over a pattern of files when they change.
- Removed `buildHtmlMulti` (use `forEvery` with `buildHtml` instead)
2020-01-22 10:58:24 -05:00
Sridhar Ratnakumar
1a1470534f Use nix gitignore to speedup builds 2020-01-21 13:00:50 -05:00
Sridhar Ratnakumar
ca3e9fbd1b
Cleanup and update default.nix (#91)
* Advance nixpkgs

* Remove dhall, tomland and dependent-sum from default.nix

* Update path and relude

* override hspec-megaparsec

* Cleanup overrides

* Refactor
2020-01-19 17:38:59 -05:00
Sridhar Ratnakumar
55c7799e0f Remove obfuscateEmail mmark exts
Originally added without much careful thought. Not useful.
2020-01-16 11:19:32 -05:00
Sridhar Ratnakumar
1794b37e59 Remove ghcSyntaxHighlighter extension 2020-01-16 11:14:58 -05:00
Sridhar Ratnakumar
55cbca1f24 Make multi-line errors from Shake build legible
Ref: #53
2020-01-16 10:16:01 -05:00
Sridhar Ratnakumar
da6494a9ce Update README's example 2020-01-15 09:54:48 -05:00
Sridhar Ratnakumar
40cc8d7f41 Add Show instance for Source
fixes #86
2020-01-12 17:10:10 -05:00
Sridhar Ratnakumar
9e5067bb65 Nix: fix megaparsec drv for tomland
Triggered by the recent nixpkgs upgrade
2020-01-11 20:20:31 -05:00
Sridhar Ratnakumar
4232999fc6 Prevent ribInputDir='.'
Fixes #83
2020-01-11 20:19:40 -05:00
Sridhar Ratnakumar
6f7968e19d
Advance nixpkgs, and update some packages (#85)
mmark, megaparsec, clay.
2020-01-08 19:22:27 -05:00
Sridhar Ratnakumar
c99d99e0fe Add DEVELOPMENT.md 2020-01-08 15:20:26 -05:00
Sridhar Ratnakumar
5123ed1245 Begin 0.7 2020-01-08 14:56:52 -05:00
Sridhar Ratnakumar
03510616ab
Release 0.6 (#84)
* Finalize changelog

* Haddock updates
2020-01-08 14:54:47 -05:00
Sridhar Ratnakumar
a472023784 Edit key points, fixes #74 2020-01-08 14:33:23 -05:00
Sridhar Ratnakumar
f6e3f68a91
Merge pull request #81 from srid/source-url-without-index.html
sourceUrl: strip index.html
2020-01-07 16:11:22 -05:00
Sridhar Ratnakumar
d0901ed52d Store the generated HTML path as is in Source record 2020-01-07 12:17:01 -05:00
Sridhar Ratnakumar
552e48c250 sourceUrl: strip index.html 2020-01-07 11:58:22 -05:00
Sridhar Ratnakumar
c03c090d0f Add latest version of tomland in default.nix 2020-01-06 17:53:33 -05:00
Sridhar Ratnakumar
4d834d246e Remove implicit Prelude (other files) 2020-01-04 17:56:49 -05:00
Sridhar Ratnakumar
2fde4754b0 Remove implicit Prelude 2020-01-04 17:55:43 -05:00
Sridhar Ratnakumar
f30213c744
Have buildHtml set sourceUrl (#79)
Consequently readSource returns repr directly.
2020-01-04 17:22:35 -05:00
Sridhar Ratnakumar
054e360372
Remove PandocFormat; directly use pandoc readers (#75)
Just have the user pass around one of the pandoc reader
functions (re-exported in Rib.Parser.Pandoc) directly instead of having
to know to use a custom wrapper type.
2020-01-01 17:26:50 -05:00
Sridhar Ratnakumar
0a2ec4c34d Fix README example 2020-01-01 17:19:58 -05:00
Sridhar Ratnakumar
bb17c2bd30
buildHtml* API changes (#73)
Add outfile argument to buildHtml*
Make parser the first argument in buildHtml*
Add buildHtml_ that discards its results
2020-01-01 14:13:27 -05:00
Sridhar Ratnakumar
36670e03a4 Fix README example 2019-12-31 21:39:34 -05:00
Sridhar Ratnakumar
e9a326fd79
Merge pull request #71 from srid/build-html-single
Add singular version of buildHtmlMulti
2019-12-31 21:33:09 -05:00
Sridhar Ratnakumar
7ec05a94af Add singular version of buildHtmlMulti
buildHtml was incorrectly named; it should have actually been called
writeHtml. This commit also actually implements buildHtml, which is like
buildHtmlMulti but operating on a single file.
2019-12-31 21:25:29 -05:00
Sridhar Ratnakumar
916f671b3a
Merge pull request #70 from srid/shake-dont-crash
Don't crash on Shake errors
2019-12-31 21:24:58 -05:00
Sridhar Ratnakumar
3fa3943559 Add to changelog 2019-12-31 20:15:42 -05:00
Sridhar Ratnakumar
1ef7941ad5 Don't crash on Shake errors
During the initial full generation we are not handing exceptions from
Shake (which can happen due to parser errors from user code). This
change handles it.
2019-12-31 20:13:52 -05:00
Sridhar Ratnakumar
e82ca00c7c
Merge pull request #69 from srid/source-reader-action
Make SourceReader a Shake Action
2019-12-31 20:12:12 -05:00
Sridhar Ratnakumar
a1409e4963 readSource: handle errors internally
So the user does not have to.
2019-12-31 19:40:25 -05:00
Sridhar Ratnakumar
ece3101f89 Simplify and expose readSource
Useful in user code when wanting to read a single source file, as
opposed to a pattern of them. The other difference to buildHtmlMulti is
that readSource merely parses the source, but does not write HTML of it.

Example:

```haskell
  blurb <- Rib.readSource MMark.parse [relfile|fragments/index.md|] >>= \case
    Left e -> fail $ toString e
    Right v -> pure v
```
2019-12-31 19:35:09 -05:00
Sridhar Ratnakumar
2203052ceb parseIO -> parse
Because it is not simply an IO action anymore.
2019-12-31 13:11:20 -05:00
Sridhar Ratnakumar
5e82a20762 Make SourceReader a Shake Action
This will allow us to do Shake-y things in our readers. For example,
parsing our Dhall files may require `need`'ing its dependent .dhall
files, doing which ensures that when those files change rib will
re-generate our site accordingly.

Code example:

```haskell
parseIO :: FromDhall a => Path b File -> Action (Either Text a)
parseIO (toFilePath -> f) = do
  inputDir <- ribInputDir
  let dhallDeps =
        [ [relfile|Entry.dhall|],
          [relfile|Metric.dhall|]
        ]
  need $ fmap (toFilePath . (inputDir </>)) dhallDeps
  s <- toText <$> readFile' f
  e <-
    liftIO $ withCurrentDirectory (toFilePath inputDir) $
      input auto s
  pure $ Right e

```
2019-12-31 12:00:48 -05:00
Sridhar Ratnakumar
eadcdfd4cc
Add macOS to CI matrix (#68)
Also, re-enable fsatrace in default.nix but only on Linux.
2019-12-31 10:53:06 -05:00
Sridhar Ratnakumar
11a9f5d6f4 Remove fsatrace
Not supported on macOS
2019-12-31 09:49:24 -05:00
Sridhar Ratnakumar
054acd260d Use + here 2019-12-30 19:25:44 -05:00
Sridhar Ratnakumar
6867cd9a12 Expose getDirectoryFiles' 2019-12-30 19:20:11 -05:00