Skip to content
Permalink
Browse files

;api: another round of hledger-api purging; fix the build

  • Loading branch information...
simonmichael committed Sep 11, 2019
1 parent 8e40a5e commit 4db14ef70fad0cd1efa4f0bddfefca834d07e749
21 .ci
@@ -1,12 +1,13 @@
[test "website"]
command = ./Shake.hs && ./Shake Clean && ./Shake website
trackedFiles = site/_site \
site/csv.md \
site/hledger-api.md \
site/hledger-ui.md \
site/hledger-web.md \
site/hledger.md \
site/journal.md \
site/manual.md \
site/timeclock.md \
site/timedot.md
#TODO: update for new site
# trackedFiles = site/_site \
# site/csv.md \
# site/hledger-ui.md \
# site/hledger-web.md \
# site/hledger.md \
# site/journal.md \
# site/manual.md \
# site/timeclock.md \
# site/timedot.md
#
@@ -518,13 +518,14 @@ ghci> :main --serve
(This rule also creates symbolic links to hledger-web's `config`, `messages`, `static` and `templates`
directories, needed in developer mode, so it can run from the top directory. This may not work on Windows.)

#### hledger-api
#### hledger-api (old)

[package](http://hackage.haskell.org/package/hledger-api),
[code](https://github.com/simonmichael/hledger/tree/master/hledger-api),
[manual](http://hledger.org/manual.html#hledger-api)

A web API server. Uses the servant framework.
Retired as of 2019-09; use hledger-web instead.

### Quality

@@ -809,7 +810,6 @@ About testing in the hledger project, as of 201809.
hledger test builtin test command (hledger\'s + hledger-lib\'s unit tests)
hledger-ui
hledger-web
hledger-api
------------- ------------ ---------------------------------------------------------------

### Coverage
@@ -826,7 +826,6 @@ Our current test coverage can be summarised like so:
hledger X X
hledger-ui
hledger-web
hledger-api
------------- ------ ----- ------------

There are ways to generate detailed coverage reports for haskell unit
@@ -8,12 +8,11 @@ COPY ./stack*.yaml ./
RUN stack setup

# Pre-cache dependencies
RUN mkdir hledger-lib hledger hledger-ui hledger-web hledger-api
RUN mkdir hledger-lib hledger hledger-ui hledger-web
COPY hledger-lib/package.yaml hledger-lib/package.yaml
COPY hledger/package.yaml hledger/package.yaml
COPY hledger-ui/package.yaml hledger-ui/package.yaml
COPY hledger-web/package.yaml hledger-web/package.yaml
COPY hledger-api/package.yaml hledger-api/package.yaml
RUN stack install --dependencies-only

# Actually compile sources
@@ -104,7 +104,6 @@ PACKAGES=\
hledger \
hledger-ui \
hledger-web \
# hledger-api \

INCLUDEPATHS=\
-ihledger-lib \
@@ -113,7 +112,6 @@ INCLUDEPATHS=\
-ihledger-ui \
-ihledger-web \
-ihledger-web/app \
# -ihledger-api \

MAIN=hledger/app/hledger-cli.hs

@@ -330,9 +328,6 @@ ghcid-ui: $(call def-help,ghcid-ui, start ghcid autobuilder on hledger-lib + hle
ghcid-web: $(call def-help,ghcid-web, start ghcid autobuilder on hledger-lib + hledger + hledger-web)
ghcid -c 'make ghci-web'

# ghcid-api: $(call def-help,ghcid-api, start ghcid autobuilder on hledger-lib + hledger + hledger-api)
# ghcid -c 'make ghci-api'

ghcid-test: $(call def-help,ghcid-test, start ghcid autobuilding and running the test command)
ghcid -c 'make ghci' --test ':main test'

@@ -372,14 +367,10 @@ ghci-ui: $(call def-help,ghci-ui, start ghci REPL on hledger-lib + hledger + hle
ghci-web: link-web-dirs $(call def-help,ghci-web, start ghci REPL on hledger-lib + hledger + hledger-web)
$(STACK) exec -- $(GHCI) $(BUILDFLAGS) hledger-web/app/main.hs

# ghci-api: $(call def-help,ghci-api, start ghci REPL on hledger-lib + hledger + hledger-api)
# $(STACK) exec -- $(GHCI) $(BUILDFLAGS) hledger-api/hledger-api.hs

# ghci-all: $(call def-help,ghci-all, start ghci REPL on all the hledger)
# $(STACK) exec -- $(GHCI) $(BUILDFLAGS) \
# hledger-ui/Hledger/UI/Main.hs \
# hledger-web/app/main.hs \
# hledger-api/hledger-api.hs \
ghci-doctest: $(call def-help,ghci-doctest, start ghci REPL on hledger-lib doctests)
cd hledger-lib; $(STACK) ghci hledger-lib:test:doctests
@@ -495,7 +486,6 @@ travistest: $(call def-help,travistest, run tests similar to our travis CI tests
$(STACK) build --ghc-options=-Werror --test --haddock --no-haddock-deps hledger-ui
$(STACK) build --ghc-options=-Werror --test --haddock --no-haddock-deps hledger-web
make functest
# $(STACK) build --ghc-options=-Werror --test --haddock --no-haddock-deps hledger-api

# committest: hlinttest unittest doctest functest haddocktest buildtest quickcabaltest \
# $(call def-help,committest,more thorough pre-commit/pre-push tests)
@@ -121,5 +121,4 @@ downloads](https://img.shields.io/github/downloads/simonmichael/hledger/latest/t
[![](https://img.shields.io/hackage-deps/v/hledger.svg?label=hledger+bounds)](http://packdeps.haskellers.com/feed?needle=hledger)
[![](https://img.shields.io/hackage-deps/v/hledger-ui.svg?label=hledger-ui+bounds)](http://packdeps.haskellers.com/feed?needle=hledger-ui)
[![](https://img.shields.io/hackage-deps/v/hledger-web.svg?label=hledger-web+bounds)](http://packdeps.haskellers.com/feed?needle=hledger-web)
[![](https://img.shields.io/hackage-deps/v/hledger-api.svg?label=hledger-api+bounds)](http://packdeps.haskellers.com/feed?needle=hledger-api)
@@ -165,7 +165,6 @@ main = do
,"hledger"
,"hledger-ui"
,"hledger-web"
-- ,"hledger-api"
]

changelogs = "CHANGES.md" : map (</> "CHANGES.md") packages
@@ -185,7 +184,6 @@ main = do
"hledger.1"
,"hledger-ui.1"
,"hledger-web.1"
-- ,"hledger-api.1"
,"hledger_journal.5"
,"hledger_csv.5"
,"hledger_timeclock.5"
@@ -479,7 +477,6 @@ main = do
,":!hledger"
,":!hledger-ui"
,":!hledger-web"
,":!hledger-api"
,":!tests"
]

@@ -26,10 +26,6 @@ trigger:
- doc/*
- examples/*
- hledger-system.mk
- hledger-api/CHANGES*
- hledger-api/LICENSE*
- hledger-api/README*
- hledger-api/examples/*
- hledger-install/LICENSE*
- hledger-install/README*
- hledger-lib/CHANGES*
@@ -13,7 +13,6 @@ cabal sandbox init
#cabal sandbox add-source ./hledger
#cabal sandbox add-source ./hledger-ui
#cabal sandbox add-source ./hledger-web
#cabal sandbox add-source ./hledger-api

# Traditional pre-ceremony to propitiate the install gods
cabal install alex happy
@@ -24,4 +23,3 @@ cabal install \
./hledger \
./hledger-ui \
./hledger-web \
./hledger-api \
@@ -2,7 +2,6 @@ packages: hledger-lib
hledger
hledger-ui
hledger-web
hledger-api

allow-newer:
brick:base
@@ -64,7 +64,6 @@ HLEDGER_MAIN_TOOLS="\
hledger \
hledger-ui \
hledger-web \
hledger-api \
"

HLEDGER_OTHER_TOOLS="\
@@ -52,7 +52,7 @@ getDownloadR f = do
addHeader "Content-Disposition" ("attachment; filename=\"" <> T.pack f' <> "\"")
sendResponse ("text/plain" :: ByteString, toContent txt)

-- hledger-web equivalents of hledger-api's handlers
-- hledger-web equivalents of the old hledger-api's handlers

getAccountnamesR :: Handler TypedContent
getAccountnamesR = do
@@ -37,8 +37,7 @@ import GHC.Generics (Generic)

import Hledger.Data

-- JSON instances. See also hledger-api.
-- Should they be in hledger-lib Types.hs ?
-- JSON instances. Should they be in hledger-lib Types.hs ?

-- To JSON

@@ -186,9 +186,8 @@ sure that both machine clocks are roughly in step.)
# JSON API

In addition to the web UI, hledger-web provides some API routes that
serve JSON in response to GET requests. Currently these are same ones
provided by the hledger-api tool, but hledger-web will likely receive
more attention than hledger-api in future:
serve JSON in response to GET requests. (And when started with `--serve-api`,
it provides only these routes.):
```
/accountnames
/transactions
@@ -329,13 +329,12 @@ showModeUsage = (showText defaultWrap :: [Text] -> String) .
(helpText [] HelpFormatDefault :: Mode a -> [Text])

-- | Get the most appropriate documentation topic for a mode.
-- Currently, that is either the hledger, hledger-ui, hledger-web or
-- hledger-api manual.
-- Currently, that is either the hledger, hledger-ui or hledger-web
-- manual.
topicForMode :: Mode a -> Topic
topicForMode m
| n == "hledger-ui" = "ui"
| n == "hledger-web" = "web"
-- | n == "hledger-api" = lookupDocTxt "api" -- hledger-api uses docopt
| otherwise = "cli"
where n = headDef "" $ modeNames m

@@ -16,7 +16,7 @@ Examples:
```shell
$ hledger help
Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot
Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
```

```shell
@@ -53,11 +53,6 @@ docFiles = [
,$(embedFileRelative "embeddedfiles/hledger-web.txt")
,$(embedFileRelative "embeddedfiles/hledger-web.info")
))
,("hledger-api",
($(embedFileRelative "embeddedfiles/hledger-api.1")
,$(embedFileRelative "embeddedfiles/hledger-api.txt")
,$(embedFileRelative "embeddedfiles/hledger-api.info")
))
,("journal",
($(embedFileRelative "embeddedfiles/hledger_journal.5")
,$(embedFileRelative "embeddedfiles/hledger_journal.txt")
@@ -26,9 +26,6 @@ Here are some hledger add-ons available:

These are maintained and released along with hledger.

### api
[hledger-api](hledger-api.html) serves hledger data as a JSON web API.

### ui
[hledger-ui](hledger-ui.html) provides an efficient terminal interface.

@@ -33,9 +33,6 @@ extra-source-files:
- embeddedfiles/hledger.1
- embeddedfiles/hledger.txt
- embeddedfiles/hledger.info
- embeddedfiles/hledger-api.1
- embeddedfiles/hledger-api.txt
- embeddedfiles/hledger-api.info
- embeddedfiles/hledger-ui.1
- embeddedfiles/hledger-ui.txt
- embeddedfiles/hledger-ui.info
@@ -106,7 +106,6 @@ complete -F _hledger_completion_function hledger
# Register completion functions for hledger extensions:
complete -F _hledger_extension_completion_function hledger-ui
complete -F _hledger_extension_completion_function hledger-web
complete -F _hledger_extension_completion_function hledger-api

# Include lists of commands and options generated by the Makefile using the
# m4 macro processor.
@@ -146,7 +145,6 @@ cf
is
ui
web
api
TEXT

cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt"
@@ -2057,17 +2055,3 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-web.txt"
-p
TEXT

cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-api.txt"
--file
--help
--host
--port
--static-dir
--swagger
--version
-d
-f
-h
-p
TEXT

@@ -106,7 +106,6 @@ complete -F _hledger_completion_function hledger
# Register completion functions for hledger extensions:
complete -F _hledger_extension_completion_function hledger-ui
complete -F _hledger_extension_completion_function hledger-web
complete -F _hledger_extension_completion_function hledger-api

# Include lists of commands and options generated by the Makefile using the
# m4 macro processor.
@@ -10,7 +10,6 @@ packages:
# (we need megaparsec 7, only config-ini's 0.2.3.0 version allows that, but it requires a newer base/GHC).
#- hledger-ui
- hledger-web
#- hledger-api

extra-deps:
- easytest-0.2.1
@@ -76,25 +75,6 @@ extra-deps:
- word-wrap-0.4.1
- yesod-persistent-1.4.2

# - servant-0.13.0.1
# - servant-server-0.13.0.1
# - servant-swagger-1.1.5
# - swagger2-2.2.2
# # - attoparsec-iso8601-1.0.0.0
# # - base-compat-0.9.3
# - brick-0.24.2
# - cpphs-1.20.8
# - data-clist-0.1.2.0
# - http-api-data-0.3.7.1
# - natural-transformation-0.4
# # - persistent-template-2.5.2
# # - servant-0.11
# # - servant-server-0.11
# - text-zipper-0.10
# - th-orphans-0.13.4
# - vty-5.17.1
# - word-wrap-0.4.1

# hledger-ui
# newer fsnotify has a different api and may be more robust
- fsnotify-0.3.0.1
@@ -7,8 +7,8 @@ packages:
- hledger
- hledger-ui
- hledger-web
- hledger-api

# TODO: some of these were for hledger-api and can be removed
extra-deps:
- easytest-0.2.1
# Many newer versions to allow using the latest base-compat with all ghc versions.
@@ -7,8 +7,8 @@ packages:
- hledger
- hledger-ui
- hledger-web
- hledger-api

# TODO: some of these were for hledger-api and can be removed
extra-deps:
- easytest-0.2.1
# use the latest base-compat with all ghc versions
@@ -7,7 +7,6 @@ packages:
- hledger
- hledger-ui
- hledger-web
- hledger-api

extra-deps:
- easytest-0.2.1

0 comments on commit 4db14ef

Please sign in to comment.
You can’t perform that action at this time.