aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acms/CHANGELOG.md (renamed from cli/CHANGELOG.md)2
-rw-r--r--acms/LICENSE (renamed from backend/LICENSE)7
-rw-r--r--acms/acms.cabal120
-rw-r--r--acms/app/Main.hs (renamed from cli/app/Main.hs)8
-rw-r--r--acms/src/ACMS/ACMS.hs (renamed from backend/app/Main.hs)9
-rw-r--r--acms/src/ACMS/API/Fetch.hs (renamed from backend/lib/ACMS/API/Fetch.hs)2
-rw-r--r--acms/src/ACMS/API/Query.hs (renamed from backend/lib/ACMS/API/Query.hs)2
-rw-r--r--acms/src/ACMS/API/REST.hs (renamed from backend/lib/ACMS/API/REST.hs)2
-rw-r--r--acms/src/ACMS/API/REST/Collection.hs (renamed from backend/lib/ACMS/API/REST/Collection.hs)2
-rw-r--r--acms/src/ACMS/API/REST/Collection/Paginated.hs (renamed from backend/lib/ACMS/API/REST/Collection/Paginated.hs)3
-rw-r--r--acms/src/Collection.hs (renamed from common/src/Collection.hs)4
-rw-r--r--acms/src/Version.hs (renamed from common/src/Version.hs)0
-rw-r--r--acms/test/Main.hs4
-rw-r--r--backend/backend.cabal86
-rw-r--r--cli/LICENSE26
-rw-r--r--cli/cli.cabal28
-rw-r--r--common/CHANGELOG.md5
-rw-r--r--common/LICENSE30
-rw-r--r--common/common.cabal23
-rw-r--r--default.nix7
-rw-r--r--frontend/app/Form/Input.hs2
-rw-r--r--frontend/app/Page/EditValue.hs2
-rw-r--r--frontend/frontend.cabal3
-rw-r--r--pkgs/default.nix4
-rw-r--r--tests.nix14
25 files changed, 142 insertions, 253 deletions
diff --git a/cli/CHANGELOG.md b/acms/CHANGELOG.md
index b733b96..ff5d9e1 100644
--- a/cli/CHANGELOG.md
+++ b/acms/CHANGELOG.md
@@ -1,4 +1,4 @@
-# Revision history for cli
+# Revision history for acms
## 0.1.0.0 -- YYYY-mm-dd
diff --git a/backend/LICENSE b/acms/LICENSE
index c90516a..ba1f71e 100644
--- a/backend/LICENSE
+++ b/acms/LICENSE
@@ -1,6 +1,5 @@
-Copyright (c) 2024, Alexander Foremny
+Copyright (c) 2025, Alexander Foremny
-All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -13,7 +12,7 @@ modification, are permitted provided that the following conditions are met:
disclaimer in the documentation and/or other materials provided
with the distribution.
- * Neither the name of Alexander Foremny nor the names of other
+ * Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
@@ -21,7 +20,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
diff --git a/acms/acms.cabal b/acms/acms.cabal
new file mode 100644
index 0000000..fc599ec
--- /dev/null
+++ b/acms/acms.cabal
@@ -0,0 +1,120 @@
+cabal-version: 3.4
+name: acms
+version: 0.1.0.0
+license: BSD-3-Clause
+license-file: LICENSE
+maintainer: aforemny@posteo.de
+author: Alexander Foremny
+build-type: Simple
+extra-doc-files: CHANGELOG.md
+
+common commons
+ default-extensions:
+ ApplicativeDo
+ BlockArguments
+ CPP
+ DuplicateRecordFields
+ LambdaCase
+ MultiWayIf
+ NamedFieldPuns
+ NoFieldSelectors
+ NondecreasingIndentation
+ OverloadedRecordDot
+ OverloadedStrings
+ RecordWildCards
+ TypeApplications
+ ViewPatterns
+
+ ghc-options: -Wall -threaded -fno-warn-name-shadowing -fno-warn-x-partial
+ default-language: GHC2021
+
+library
+ import: commons
+ exposed-modules:
+ ACMS.API.Query
+ ACMS.API.REST
+ ACMS.API.REST.Collection
+ ACMS.API.REST.Collection.Paginated
+ Collection
+ Version
+
+ hs-source-dirs: src
+ other-modules: ACMS.API.Fetch
+ build-depends:
+ aeson,
+ base,
+ bytestring,
+ exceptions,
+ miso,
+ split,
+ text,
+ utf8-string
+
+ if arch(javascript)
+ build-depends: ghcjs-base
+
+ else
+ exposed-modules: ACMS.ACMS
+ build-depends:
+ aeson,
+ astore,
+ attoparsec,
+ autotypes,
+ base,
+ bytestring,
+ containers,
+ directory,
+ exceptions,
+ filepath,
+ gitlib,
+ gitlib-libgit2,
+ hinotify,
+ hlibgit2,
+ http-conduit,
+ http-types,
+ mtl,
+ non-empty,
+ optparse-applicative,
+ random,
+ regex,
+ regex-base,
+ regex-pcre,
+ safe,
+ split,
+ stm,
+ tagged,
+ text,
+ utf8-string,
+ uuid,
+ vector,
+ wai,
+ warp
+
+
+executable acms
+ import: commons
+ main-is: Main.hs
+ hs-source-dirs: app
+ build-depends:
+ acms,
+ aeson,
+ aeson-pretty,
+ base,
+ bytestring,
+ filepath,
+ optparse-applicative,
+ sh,
+ text,
+ utf8-string
+
+ if arch(javascript)
+ buildable: False
+
+test-suite acms-test
+ import: commons
+ type: exitcode-stdio-1.0
+ main-is: Main.hs
+ hs-source-dirs: test
+ build-depends:
+ base,
+ acms
diff --git a/cli/app/Main.hs b/acms/app/Main.hs
index 12ba7c5..9759660 100644
--- a/cli/app/Main.hs
+++ b/acms/app/Main.hs
@@ -1,11 +1,3 @@
-{-# LANGUAGE ApplicativeDo #-}
-{-# LANGUAGE BlockArguments #-}
-{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ViewPatterns #-}
-{-# LANGUAGE NoFieldSelectors #-}
-
module Main where
import ACMS.API.Query qualified
diff --git a/backend/app/Main.hs b/acms/src/ACMS/ACMS.hs
index c9db2ea..12f8866 100644
--- a/backend/app/Main.hs
+++ b/acms/src/ACMS/ACMS.hs
@@ -1,11 +1,4 @@
-{-# LANGUAGE ApplicativeDo #-}
-{-# LANGUAGE DuplicateRecordFields #-}
-{-# LANGUAGE NamedFieldPuns #-}
-{-# LANGUAGE NondecreasingIndentation #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
-
-module Main where
+module ACMS.ACMS where
import AutoTypes qualified as U
import AutoTypes.Unify qualified as U
diff --git a/backend/lib/ACMS/API/Fetch.hs b/acms/src/ACMS/API/Fetch.hs
index 84330b1..02e3e80 100644
--- a/backend/lib/ACMS/API/Fetch.hs
+++ b/acms/src/ACMS/API/Fetch.hs
@@ -1,5 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-
module ACMS.API.Fetch
( APIMonad(fetch),
#ifndef ghcjs_HOST_OS
diff --git a/backend/lib/ACMS/API/Query.hs b/acms/src/ACMS/API/Query.hs
index ab2cabc..e668a80 100644
--- a/backend/lib/ACMS/API/Query.hs
+++ b/acms/src/ACMS/API/Query.hs
@@ -1,5 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-
module ACMS.API.Query where
import ACMS.API.Fetch
diff --git a/backend/lib/ACMS/API/REST.hs b/acms/src/ACMS/API/REST.hs
index 6cd2982..e8c2c0c 100644
--- a/backend/lib/ACMS/API/REST.hs
+++ b/acms/src/ACMS/API/REST.hs
@@ -1,5 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-
module ACMS.API.REST where
import ACMS.API.Fetch
diff --git a/backend/lib/ACMS/API/REST/Collection.hs b/acms/src/ACMS/API/REST/Collection.hs
index 7de1909..0ed96fd 100644
--- a/backend/lib/ACMS/API/REST/Collection.hs
+++ b/acms/src/ACMS/API/REST/Collection.hs
@@ -1,5 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-
module ACMS.API.REST.Collection where
import ACMS.API.Fetch
diff --git a/backend/lib/ACMS/API/REST/Collection/Paginated.hs b/acms/src/ACMS/API/REST/Collection/Paginated.hs
index 159754a..487fe69 100644
--- a/backend/lib/ACMS/API/REST/Collection/Paginated.hs
+++ b/acms/src/ACMS/API/REST/Collection/Paginated.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE RecordWildCards #-}
-
module ACMS.API.REST.Collection.Paginated where
import ACMS.API.Fetch
diff --git a/common/src/Collection.hs b/acms/src/Collection.hs
index 418278d..6ad4e7a 100644
--- a/common/src/Collection.hs
+++ b/acms/src/Collection.hs
@@ -1,7 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE ViewPatterns #-}
-
module Collection where
import Miso.String (MisoString, toMisoString)
diff --git a/common/src/Version.hs b/acms/src/Version.hs
index 6970968..6970968 100644
--- a/common/src/Version.hs
+++ b/acms/src/Version.hs
diff --git a/acms/test/Main.hs b/acms/test/Main.hs
new file mode 100644
index 0000000..3e2059e
--- /dev/null
+++ b/acms/test/Main.hs
@@ -0,0 +1,4 @@
+module Main (main) where
+
+main :: IO ()
+main = putStrLn "Test suite not yet implemented."
diff --git a/backend/backend.cabal b/backend/backend.cabal
deleted file mode 100644
index 6b13682..0000000
--- a/backend/backend.cabal
+++ /dev/null
@@ -1,86 +0,0 @@
-cabal-version: 3.4
-name: backend
-version: 0.1.0.0
-license: BSD-3-Clause
-license-file: LICENSE
-maintainer: aforemny@posteo.de
-author: Alexander Foremny
-build-type: Simple
-
-library
- exposed-modules:
- ACMS.API.Query
- ACMS.API.REST
- ACMS.API.REST.Collection
- ACMS.API.REST.Collection.Paginated
-
- hs-source-dirs: lib
- other-modules: ACMS.API.Fetch
- default-language: GHC2021
- default-extensions:
- CPP BlockArguments LambdaCase OverloadedStrings ViewPatterns
- OverloadedRecordDot NoFieldSelectors MultiWayIf
-
- ghc-options: -Wall -threaded
- build-depends:
- aeson,
- base,
- bytestring,
- common,
- exceptions,
- miso,
- text,
- utf8-string
-
- if arch(javascript)
- build-depends: ghcjs-base
-
- else
- build-depends: http-conduit
-
-executable backend
- main-is: Main.hs
- hs-source-dirs: app
- default-language: GHC2021
- default-extensions:
- BlockArguments LambdaCase OverloadedStrings ViewPatterns
- OverloadedRecordDot NoFieldSelectors MultiWayIf
-
- ghc-options: -Wall -threaded
- build-depends:
- aeson,
- astore,
- attoparsec,
- autotypes,
- base,
- bytestring,
- common,
- containers,
- directory,
- exceptions,
- filepath,
- gitlib,
- gitlib-libgit2,
- hinotify,
- hlibgit2,
- http-types,
- mtl,
- non-empty,
- optparse-applicative,
- random,
- regex,
- regex-base,
- regex-pcre,
- safe,
- split,
- stm,
- tagged,
- text,
- utf8-string,
- uuid,
- vector,
- wai,
- warp
-
- if arch(javascript)
- buildable: False
diff --git a/cli/LICENSE b/cli/LICENSE
deleted file mode 100644
index 9128a61..0000000
--- a/cli/LICENSE
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2024, Alexander Foremny
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cli/cli.cabal b/cli/cli.cabal
deleted file mode 100644
index 3d0934e..0000000
--- a/cli/cli.cabal
+++ /dev/null
@@ -1,28 +0,0 @@
-cabal-version: 3.4
-name: cli
-version: 0.1.0.0
-license: BSD-2-Clause
-license-file: LICENSE
-maintainer: aforemny@posteo.de
-author: Alexander Foremny
-build-type: Simple
-extra-doc-files: CHANGELOG.md
-
-executable acms
- main-is: Main.hs
- hs-source-dirs: app
- other-modules:
- default-language: GHC2021
- ghc-options: -Wall
- build-depends:
- aeson,
- aeson-pretty,
- backend,
- base,
- bytestring,
- common,
- filepath,
- optparse-applicative,
- sh,
- text,
- utf8-string
diff --git a/common/CHANGELOG.md b/common/CHANGELOG.md
deleted file mode 100644
index 47b7089..0000000
--- a/common/CHANGELOG.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Revision history for common
-
-## 0.1.0.0 -- YYYY-mm-dd
-
-* First version. Released on an unsuspecting world.
diff --git a/common/LICENSE b/common/LICENSE
deleted file mode 100644
index c90516a..0000000
--- a/common/LICENSE
+++ /dev/null
@@ -1,30 +0,0 @@
-Copyright (c) 2024, Alexander Foremny
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of Alexander Foremny nor the names of other
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/common/common.cabal b/common/common.cabal
deleted file mode 100644
index d67e5d6..0000000
--- a/common/common.cabal
+++ /dev/null
@@ -1,23 +0,0 @@
-cabal-version: 3.4
-name: common
-version: 0.2.0
-license: BSD-3-Clause
-license-file: LICENSE
-maintainer: aforemny@posteo.de
-author: Alexander Foremny
-build-type: Simple
-extra-doc-files: CHANGELOG.md
-
-library
- exposed-modules: Version,
- Collection
- hs-source-dirs: src
- default-language: GHC2021
- default-extensions: ViewPatterns
- ghc-options: -Wall
- build-depends:
- aeson,
- base,
- miso,
- split,
- text
diff --git a/default.nix b/default.nix
index 2f99f59..43fff14 100644
--- a/default.nix
+++ b/default.nix
@@ -6,15 +6,12 @@ let
jsHaskellPackages = pkgs.pkgsCross.ghcjs.haskell.packages.ghc98;
in
rec {
- inherit (haskellPackages) backend cli;
+ inherit (haskellPackages) acms;
inherit (jsHaskellPackages) frontend;
shell = haskellPackages.shellFor {
packages = _: [
+ haskellPackages.acms
haskellPackages.autotypes
- haskellPackages.backend
- haskellPackages.cli
- haskellPackages.common
- haskellPackages.cli
haskellPackages.frontend
];
buildInputs = [
diff --git a/frontend/app/Form/Input.hs b/frontend/app/Form/Input.hs
index 0b4f1ca..040b961 100644
--- a/frontend/app/Form/Input.hs
+++ b/frontend/app/Form/Input.hs
@@ -160,7 +160,7 @@ inputText label =
value_ i,
onInput id
],
- div_ [ class_ "error-helper" ] $
+ div_ [class_ "error-helper"] $
[either text (\_ -> text "") (parse i)]
]
]
diff --git a/frontend/app/Page/EditValue.hs b/frontend/app/Page/EditValue.hs
index 942d9db..8a7ca15 100644
--- a/frontend/app/Page/EditValue.hs
+++ b/frontend/app/Page/EditValue.hs
@@ -8,6 +8,7 @@ module Page.EditValue
where
import ACMS.API.REST.Collection qualified as API.REST.Collection
+import Collection
import Control.Monad.Catch (SomeException, try)
import Data.Aeson qualified as A
import Data.Aeson.KeyMap qualified as AM
@@ -17,7 +18,6 @@ import Form qualified as F
import Miso
import Miso.String (toMisoString)
import Schema
-import Collection
data Model = Model
{ collectionItem :: CollectionItem,
diff --git a/frontend/frontend.cabal b/frontend/frontend.cabal
index c4affab..fb0ad6a 100644
--- a/frontend/frontend.cabal
+++ b/frontend/frontend.cabal
@@ -34,12 +34,11 @@ executable frontend
-fno-warn-orphans
build-depends:
+ acms,
aeson,
attoparsec,
- backend,
base,
bytestring,
- common,
containers,
data-default,
exceptions,
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 7dce871..f893125 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -4,11 +4,9 @@
{
haskell = super.haskell // {
packageOverrides = self: super: {
+ acms = self.callCabal2nix "acms" ../acms { };
astore = self.callCabal2nix "astore" sources.json2sql { };
autotypes = self.callCabal2nix "autotypes" ../autotypes { };
- backend = self.callCabal2nix "backend" ../backend { };
- cli = self.callCabal2nix "cli" ../cli { };
- common = self.callCabal2nix "common" ../common { };
frontend = self.callCabal2nix "frontend" ../frontend { };
sh = pkgs.haskell.lib.dontCheck (self.callCabal2nix "sh" sources.sh { });
websockets = pkgs.haskell.lib.doJailbreak super.websockets;
diff --git a/tests.nix b/tests.nix
index b62bd7f..e7cdf82 100644
--- a/tests.nix
+++ b/tests.nix
@@ -10,22 +10,22 @@ let
{
machine = { lib, pkgs, nodes, ... }: {
environment.systemPackages = [ ];
- systemd.services.backend.wantedBy = [ "multi-user.target" ];
- systemd.services.backend.preStart = ''
+ systemd.services.acms.wantedBy = [ "multi-user.target" ];
+ systemd.services.acms.preStart = ''
export HOME=$(mktemp -d)
${pkgs.git}/bin/git config --global user.email "you@example.com"
${pkgs.git}/bin/git config --global user.name "Your Name"
${pkgs.git}/bin/git init
${pkgs.git}/bin/git commit -m init --allow-empty
'';
- systemd.services.backend.script = ''
- UUID_SEED=0 ${haskellPackages.backend}/bin/backend serve .
+ systemd.services.acms.script = ''
+ UUID_SEED=0 ${haskellPackages.acms}/bin/acms serve .
'';
};
};
testScript = ''
start_all();
- machine.wait_for_unit("backend");
+ machine.wait_for_unit("acms");
machine.succeed("${pkgs.bash}/bin/bash ${makeDocTestScript n i}");
'';
@@ -49,8 +49,8 @@ let
cd "$tmp"
export ACMS_CONTENT=$PWD/content # TODO
export PATH=${pkgs.lib.makeBinPath [
- haskellPackages.cli
- pkgs.jq
+ haskellPackages.acms
+ pkgs.jq
]}''${PATH+:$PATH}
EOF
cat ${i} | pandoc --to json | jq -c '