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

This commit is contained in:
Simon Michael 2019-09-11 14:49:22 -07:00
parent 8e40a5ea93
commit 4db14ef70f
24 changed files with 23 additions and 98 deletions

21
.ci
View File

@ -1,12 +1,13 @@
[test "website"] [test "website"]
command = ./Shake.hs && ./Shake Clean && ./Shake website command = ./Shake.hs && ./Shake Clean && ./Shake website
trackedFiles = site/_site \ #TODO: update for new site
site/csv.md \ # trackedFiles = site/_site \
site/hledger-api.md \ # site/csv.md \
site/hledger-ui.md \ # site/hledger-ui.md \
site/hledger-web.md \ # site/hledger-web.md \
site/hledger.md \ # site/hledger.md \
site/journal.md \ # site/journal.md \
site/manual.md \ # site/manual.md \
site/timeclock.md \ # site/timeclock.md \
site/timedot.md # site/timedot.md
#

View File

@ -518,13 +518,14 @@ ghci> :main --serve
(This rule also creates symbolic links to hledger-web's `config`, `messages`, `static` and `templates` (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.) 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), [package](http://hackage.haskell.org/package/hledger-api),
[code](https://github.com/simonmichael/hledger/tree/master/hledger-api), [code](https://github.com/simonmichael/hledger/tree/master/hledger-api),
[manual](http://hledger.org/manual.html#hledger-api) [manual](http://hledger.org/manual.html#hledger-api)
A web API server. Uses the servant framework. A web API server. Uses the servant framework.
Retired as of 2019-09; use hledger-web instead.
### Quality ### 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 test builtin test command (hledger\'s + hledger-lib\'s unit tests)
hledger-ui hledger-ui
hledger-web hledger-web
hledger-api
------------- ------------ --------------------------------------------------------------- ------------- ------------ ---------------------------------------------------------------
### Coverage ### Coverage
@ -826,7 +826,6 @@ Our current test coverage can be summarised like so:
hledger X X hledger X X
hledger-ui hledger-ui
hledger-web hledger-web
hledger-api
------------- ------ ----- ------------ ------------- ------ ----- ------------
There are ways to generate detailed coverage reports for haskell unit There are ways to generate detailed coverage reports for haskell unit

View File

@ -8,12 +8,11 @@ COPY ./stack*.yaml ./
RUN stack setup RUN stack setup
# Pre-cache dependencies # 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-lib/package.yaml hledger-lib/package.yaml
COPY hledger/package.yaml hledger/package.yaml COPY hledger/package.yaml hledger/package.yaml
COPY hledger-ui/package.yaml hledger-ui/package.yaml COPY hledger-ui/package.yaml hledger-ui/package.yaml
COPY hledger-web/package.yaml hledger-web/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 RUN stack install --dependencies-only
# Actually compile sources # Actually compile sources

View File

@ -104,7 +104,6 @@ PACKAGES=\
hledger \ hledger \
hledger-ui \ hledger-ui \
hledger-web \ hledger-web \
# hledger-api \
INCLUDEPATHS=\ INCLUDEPATHS=\
-ihledger-lib \ -ihledger-lib \
@ -113,7 +112,6 @@ INCLUDEPATHS=\
-ihledger-ui \ -ihledger-ui \
-ihledger-web \ -ihledger-web \
-ihledger-web/app \ -ihledger-web/app \
# -ihledger-api \
MAIN=hledger/app/hledger-cli.hs 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-web: $(call def-help,ghcid-web, start ghcid autobuilder on hledger-lib + hledger + hledger-web)
ghcid -c 'make ghci-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-test: $(call def-help,ghcid-test, start ghcid autobuilding and running the test command)
ghcid -c 'make ghci' --test ':main test' 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) 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 $(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) # ghci-all: $(call def-help,ghci-all, start ghci REPL on all the hledger)
# $(STACK) exec -- $(GHCI) $(BUILDFLAGS) \ # $(STACK) exec -- $(GHCI) $(BUILDFLAGS) \
# hledger-ui/Hledger/UI/Main.hs \ # hledger-ui/Hledger/UI/Main.hs \
# hledger-web/app/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) ghci-doctest: $(call def-help,ghci-doctest, start ghci REPL on hledger-lib doctests)
cd hledger-lib; $(STACK) ghci hledger-lib:test: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-ui
$(STACK) build --ghc-options=-Werror --test --haddock --no-haddock-deps hledger-web $(STACK) build --ghc-options=-Werror --test --haddock --no-haddock-deps hledger-web
make functest make functest
# $(STACK) build --ghc-options=-Werror --test --haddock --no-haddock-deps hledger-api
# committest: hlinttest unittest doctest functest haddocktest buildtest quickcabaltest \ # committest: hlinttest unittest doctest functest haddocktest buildtest quickcabaltest \
# $(call def-help,committest,more thorough pre-commit/pre-push tests) # $(call def-help,committest,more thorough pre-commit/pre-push tests)

View File

@ -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.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-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-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)

View File

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

View File

@ -26,10 +26,6 @@ trigger:
- doc/* - doc/*
- examples/* - examples/*
- hledger-system.mk - hledger-system.mk
- hledger-api/CHANGES*
- hledger-api/LICENSE*
- hledger-api/README*
- hledger-api/examples/*
- hledger-install/LICENSE* - hledger-install/LICENSE*
- hledger-install/README* - hledger-install/README*
- hledger-lib/CHANGES* - hledger-lib/CHANGES*

View File

@ -13,7 +13,6 @@ cabal sandbox init
#cabal sandbox add-source ./hledger #cabal sandbox add-source ./hledger
#cabal sandbox add-source ./hledger-ui #cabal sandbox add-source ./hledger-ui
#cabal sandbox add-source ./hledger-web #cabal sandbox add-source ./hledger-web
#cabal sandbox add-source ./hledger-api
# Traditional pre-ceremony to propitiate the install gods # Traditional pre-ceremony to propitiate the install gods
cabal install alex happy cabal install alex happy
@ -24,4 +23,3 @@ cabal install \
./hledger \ ./hledger \
./hledger-ui \ ./hledger-ui \
./hledger-web \ ./hledger-web \
./hledger-api \

View File

@ -2,7 +2,6 @@ packages: hledger-lib
hledger hledger
hledger-ui hledger-ui
hledger-web hledger-web
hledger-api
allow-newer: allow-newer:
brick:base brick:base

View File

@ -64,7 +64,6 @@ HLEDGER_MAIN_TOOLS="\
hledger \ hledger \
hledger-ui \ hledger-ui \
hledger-web \ hledger-web \
hledger-api \
" "
HLEDGER_OTHER_TOOLS="\ HLEDGER_OTHER_TOOLS="\

View File

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

View File

@ -37,8 +37,7 @@ import GHC.Generics (Generic)
import Hledger.Data import Hledger.Data
-- JSON instances. See also hledger-api. -- JSON instances. Should they be in hledger-lib Types.hs ?
-- Should they be in hledger-lib Types.hs ?
-- To JSON -- To JSON

View File

@ -186,9 +186,8 @@ sure that both machine clocks are roughly in step.)
# JSON API # JSON API
In addition to the web UI, hledger-web provides some API routes that 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 serve JSON in response to GET requests. (And when started with `--serve-api`,
provided by the hledger-api tool, but hledger-web will likely receive it provides only these routes.):
more attention than hledger-api in future:
``` ```
/accountnames /accountnames
/transactions /transactions

View File

@ -329,13 +329,12 @@ showModeUsage = (showText defaultWrap :: [Text] -> String) .
(helpText [] HelpFormatDefault :: Mode a -> [Text]) (helpText [] HelpFormatDefault :: Mode a -> [Text])
-- | Get the most appropriate documentation topic for a mode. -- | Get the most appropriate documentation topic for a mode.
-- Currently, that is either the hledger, hledger-ui, hledger-web or -- Currently, that is either the hledger, hledger-ui or hledger-web
-- hledger-api manual. -- manual.
topicForMode :: Mode a -> Topic topicForMode :: Mode a -> Topic
topicForMode m topicForMode m
| n == "hledger-ui" = "ui" | n == "hledger-ui" = "ui"
| n == "hledger-web" = "web" | n == "hledger-web" = "web"
-- | n == "hledger-api" = lookupDocTxt "api" -- hledger-api uses docopt
| otherwise = "cli" | otherwise = "cli"
where n = headDef "" $ modeNames m where n = headDef "" $ modeNames m

View File

@ -16,7 +16,7 @@ Examples:
```shell ```shell
$ hledger help $ hledger help
Please choose a manual by typing "hledger help MANUAL" (a substring is ok). 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 ```shell

View File

@ -53,11 +53,6 @@ docFiles = [
,$(embedFileRelative "embeddedfiles/hledger-web.txt") ,$(embedFileRelative "embeddedfiles/hledger-web.txt")
,$(embedFileRelative "embeddedfiles/hledger-web.info") ,$(embedFileRelative "embeddedfiles/hledger-web.info")
)) ))
,("hledger-api",
($(embedFileRelative "embeddedfiles/hledger-api.1")
,$(embedFileRelative "embeddedfiles/hledger-api.txt")
,$(embedFileRelative "embeddedfiles/hledger-api.info")
))
,("journal", ,("journal",
($(embedFileRelative "embeddedfiles/hledger_journal.5") ($(embedFileRelative "embeddedfiles/hledger_journal.5")
,$(embedFileRelative "embeddedfiles/hledger_journal.txt") ,$(embedFileRelative "embeddedfiles/hledger_journal.txt")

View File

@ -26,9 +26,6 @@ Here are some hledger add-ons available:
These are maintained and released along with hledger. These are maintained and released along with hledger.
### api
[hledger-api](hledger-api.html) serves hledger data as a JSON web API.
### ui ### ui
[hledger-ui](hledger-ui.html) provides an efficient terminal interface. [hledger-ui](hledger-ui.html) provides an efficient terminal interface.

View File

@ -33,9 +33,6 @@ extra-source-files:
- embeddedfiles/hledger.1 - embeddedfiles/hledger.1
- embeddedfiles/hledger.txt - embeddedfiles/hledger.txt
- embeddedfiles/hledger.info - embeddedfiles/hledger.info
- embeddedfiles/hledger-api.1
- embeddedfiles/hledger-api.txt
- embeddedfiles/hledger-api.info
- embeddedfiles/hledger-ui.1 - embeddedfiles/hledger-ui.1
- embeddedfiles/hledger-ui.txt - embeddedfiles/hledger-ui.txt
- embeddedfiles/hledger-ui.info - embeddedfiles/hledger-ui.info

View File

@ -106,7 +106,6 @@ complete -F _hledger_completion_function hledger
# Register completion functions for hledger extensions: # Register completion functions for hledger extensions:
complete -F _hledger_extension_completion_function hledger-ui complete -F _hledger_extension_completion_function hledger-ui
complete -F _hledger_extension_completion_function hledger-web 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 # Include lists of commands and options generated by the Makefile using the
# m4 macro processor. # m4 macro processor.
@ -146,7 +145,6 @@ cf
is is
ui ui
web web
api
TEXT TEXT
cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt" cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt"
@ -2057,17 +2055,3 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-web.txt"
-p -p
TEXT TEXT
cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-api.txt"
--file
--help
--host
--port
--static-dir
--swagger
--version
-d
-f
-h
-p
TEXT

View File

@ -106,7 +106,6 @@ complete -F _hledger_completion_function hledger
# Register completion functions for hledger extensions: # Register completion functions for hledger extensions:
complete -F _hledger_extension_completion_function hledger-ui complete -F _hledger_extension_completion_function hledger-ui
complete -F _hledger_extension_completion_function hledger-web 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 # Include lists of commands and options generated by the Makefile using the
# m4 macro processor. # m4 macro processor.

View File

@ -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). # (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-ui
- hledger-web - hledger-web
#- hledger-api
extra-deps: extra-deps:
- easytest-0.2.1 - easytest-0.2.1
@ -76,25 +75,6 @@ extra-deps:
- word-wrap-0.4.1 - word-wrap-0.4.1
- yesod-persistent-1.4.2 - 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 # hledger-ui
# newer fsnotify has a different api and may be more robust # newer fsnotify has a different api and may be more robust
- fsnotify-0.3.0.1 - fsnotify-0.3.0.1

View File

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

View File

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

View File

@ -7,7 +7,6 @@ packages:
- hledger - hledger
- hledger-ui - hledger-ui
- hledger-web - hledger-web
- hledger-api
extra-deps: extra-deps:
- easytest-0.2.1 - easytest-0.2.1