packages feed

mellon-web 0.8.0.4 → 0.8.0.5

raw patch · 18 files changed

+119/−67 lines, 18 filesdep +protoludedep ~http-client-tlsdep ~mellon-coredep ~mellon-gpioPVP ok

version bump matches the API change (PVP)

Dependencies added: protolude

Dependency ranges changed: http-client-tls, mellon-core, mellon-gpio, mtl, network

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2017, Quixoftic, LLC+Copyright (c) 2018, Quixoftic, LLC  All rights reserved. 
README.md view
@@ -19,7 +19,8 @@ * `PUT /state` sets the controller's current state. Use this method to   lock and unlock the controller. -See [API.md](API.md) for detailed documentation on the REST service.+For detailed documentation, the server includes a self-documenting+Swagger spec.  Note that the `mellon-web` server does not provide an authentication mechanism! You should proxy it behind a secure, authenticating HTTPS@@ -31,8 +32,7 @@  An extremely simple example server (with on-line documentation support) is provided in the `examples` directory. You can run it with-`cabal run mock-mellon-server` and test it using the endpoints-described in [API.md](API.md). The server is will run on the+`cabal run mock-mellon-server`. The server is will run on the `localhost` loopback interface on port 8081.  This particular example server uses a "mock lock" device which only
changelog.md view
@@ -1,3 +1,26 @@+## 0.8.0.5 (2018-02-04)++Changes:++  - This package now uses Protolude.++  - Disable hlint tests by default.++  - Add a `stack-lts-9.yaml` file for LTS 9 Stack builds.++  - Pare down support to just GHC 8.0.2 and GHC 8.2.2.++Fixes:++  - Fix the `swagger.json` test on Stack.++  - Add PVP bounds for `mtl`, `http-client-tls`, `network`+    dependencies.++  - Remove references in the documentation to the no-longer-present+    `API.md` file. The `SwaggerAPI` server includes a self-documenting+    Swagger spec; please see that for detailed REST API documentation.+ ## 0.8.0.4 (2018-01-26)  - Require hlint 2.0.x.
examples/GpioServer.hs view
@@ -5,6 +5,7 @@  module Main where +import Protolude hiding (option) import Control.Monad.IO.Class (liftIO) import Data.Monoid ((<>)) import Data.Time.Clock (NominalDiffTime)
examples/MockServer.hs view
@@ -2,6 +2,7 @@  module Main where +import Protolude import Mellon.Controller (controller) import Mellon.Device (mockLock, mockLockDevice) import Mellon.Web.Server (swaggerApp)
examples/ScheduleUnlock.hs view
@@ -16,9 +16,10 @@  module Main where +import Protolude hiding (State, state) import Control.Monad.Catch.Pure (runCatch)-import Data.ByteString.Char8 as C8 (unpack) import Data.Monoid ((<>))+import Data.String (String) import Data.Time.Clock        (NominalDiffTime, UTCTime(..), addUTCTime) import qualified Data.Time.LocalTime as Time@@ -105,14 +106,14 @@             let clientEnv = ClientEnv manager url             runClientM (putState state) clientEnv >>= \case                         Right status ->-                          do putStrLn $ show status+                          do putStrLn $ ((show status) :: String)                              exitWith ExitSuccess                         Left e ->                           do putStrLn $ "Mellon service error: " ++ prettyServantError e                              exitWith $ ExitFailure 1     prettyServantError :: ServantError -> String     prettyServantError (FailureResponse _ status _ _) =-      show (statusCode status) ++ " " ++ (C8.unpack $ statusMessage status)+      show (statusCode status) ++ " " ++ (toS $ statusMessage status)     prettyServantError (DecodeFailure _ _ _) =       "decode failure"     prettyServantError (UnsupportedContentType _ _) =
mellon-web.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: a9487a8a210c186753d613c0da759adc43eff2eef6a18ea865efb5add7474532+-- hash: 55af04fb959faaa66f7f850ad4ce3d6ebb14a32c54b20fb5450b1fe5a51ef64a  name:                   mellon-web-version:                0.8.0.4+version:                0.8.0.5 synopsis:               A REST web service for Mellon controllers description:            The @mellon-web@ package wraps a @mellon-core@ controller in a REST                         web service, making it possible to control physical access devices@@ -26,8 +26,8 @@                         * @PUT /state@ sets the controller's current state. Use this method to                         lock and unlock the controller.                         .-                        See the included <API.md API.md> document for detailed documentation-                        on the REST service.+                        For detailed documentation, the server includes a self-documenting+                        Swagger spec.                         .                         Note that the @mellon-web@ server does not provide an authentication                         mechanism! You should proxy it behind a secure, authenticating HTTPS@@ -38,10 +38,10 @@ bug-reports:            https://github.com/quixoftic/mellon/issues author:                 Drew Hess <dhess-src@quixoftic.com> maintainer:             Drew Hess <dhess-src@quixoftic.com>-copyright:              Copyright (c) 2017, Quixoftic, LLC+copyright:              Copyright (c) 2018, Quixoftic, LLC license:                BSD3 license-file:           LICENSE-tested-with:            GHC==7.10.3 GHC==8.0.1 GHC==8.0.2 GHC==8.2.1 GHC==8.2.2+tested-with:            GHC==8.0.2 GHC==8.2.2 build-type:             Simple cabal-version:          >= 1.10 @@ -49,6 +49,8 @@     changelog.md     package.yaml     README.md++data-files:     swagger.json  source-repository head@@ -78,11 +80,12 @@ flag test-hlint   description: Build hlint test   manual: True-  default: True+  default: False  library   hs-source-dirs:       src+  default-extensions: NoImplicitPrelude   other-extensions: DataKinds DeriveDataTypeable DeriveGeneric MultiParamTypeClasses OverloadedStrings OverloadedLists ScopedTypeVariables TypeOperators   build-depends:       aeson >=0.11 && <1.3@@ -93,7 +96,8 @@     , http-types ==0.9.*     , lens >=4 && <5     , lucid ==2.9.*-    , mellon-core ==0.8.*+    , mellon-core+    , protolude ==0.2.*     , servant ==0.11.*     , servant-client ==0.11.*     , servant-docs >=0.10 && <0.12@@ -130,6 +134,7 @@   main-is: GpioServer.hs   hs-source-dirs:       examples+  default-extensions: NoImplicitPrelude   other-extensions: OverloadedStrings   ghc-options: -threaded -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates   if impl(ghc >= 8.0)@@ -146,11 +151,12 @@       , exceptions >=0.8.0 && <1       , hpio >=0.8 && <1       , mellon-core-      , mellon-gpio ==0.8.*+      , mellon-gpio       , mellon-web-      , mtl-      , network ==2.6.*+      , mtl >=2.1.3 && <2.3+      , network       , optparse-applicative >=0.11.0 && <0.15+      , protolude       , time       , transformers       , warp@@ -160,6 +166,7 @@   main-is: ScheduleUnlock.hs   hs-source-dirs:       examples+  default-extensions: NoImplicitPrelude   other-extensions: LambdaCase OverloadedStrings   ghc-options: -threaded -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates   if impl(ghc >= 8.0)@@ -176,13 +183,14 @@       , bytestring       , exceptions       , http-client-      , http-client-tls+      , http-client-tls ==0.3.*       , http-types       , mellon-core       , mellon-web       , mtl       , network       , optparse-applicative+      , protolude       , servant-client       , time       , transformers@@ -192,6 +200,8 @@   main-is: MockServer.hs   hs-source-dirs:       examples+  default-extensions: NoImplicitPrelude+  other-extensions: OverloadedStrings   ghc-options: -threaded -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates   if impl(ghc >= 8.0)     ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates@@ -206,6 +216,7 @@         base       , mellon-core       , mellon-web+      , protolude       , warp   default-language: Haskell2010 @@ -214,6 +225,7 @@   main-is: doctest.hs   hs-source-dirs:       test+  default-extensions: NoImplicitPrelude   ghc-options: -threaded   if impl(ghc >= 8.0)     ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates@@ -225,6 +237,7 @@     build-depends:         base       , doctest >=0.11 && <0.14+      , protolude   default-language: Haskell2010  test-suite hlint@@ -232,6 +245,7 @@   main-is: hlint.hs   hs-source-dirs:       test+  default-extensions: NoImplicitPrelude   ghc-options: -w -threaded -rtsopts -with-rtsopts=-N   if impl(ghc >= 8.0)     ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates@@ -243,6 +257,7 @@     build-depends:         base       , hlint ==2.0.*+      , protolude   default-language: Haskell2010  test-suite spec@@ -250,6 +265,7 @@   main-is: Main.hs   hs-source-dirs:       test+  default-extensions: NoImplicitPrelude   other-extensions: OverloadedStrings ScopedTypeVariables   ghc-options: -w -threaded -rtsopts -with-rtsopts=-N   build-depends:@@ -266,7 +282,8 @@     , lucid     , mellon-core     , mellon-web-    , network+    , network ==2.6.*+    , protolude     , quickcheck-instances ==0.3.*     , servant     , servant-client
package.yaml view
@@ -1,11 +1,11 @@ name:       mellon-web-version:    0.8.0.4+version:    0.8.0.5 synopsis:   A REST web service for Mellon controllers category:   Web stability:  experimental author:     Drew Hess <dhess-src@quixoftic.com> maintainer: Drew Hess <dhess-src@quixoftic.com>-copyright:  Copyright (c) 2017, Quixoftic, LLC+copyright:  Copyright (c) 2018, Quixoftic, LLC license:    BSD3 github:     quixoftic/mellon @@ -42,9 +42,9 @@   lock and unlock the controller.  -  See the included <API.md API.md> document for detailed documentation+  For detailed documentation, the server includes a self-documenting -  on the REST service.+  Swagger spec.     Note that the @mellon-web@ server does not provide an authentication@@ -53,13 +53,13 @@    server such as Nginx.' -tested-with: GHC==7.10.3 GHC==8.0.1 GHC==8.0.2 GHC==8.2.1 GHC==8.2.2+tested-with: GHC==8.0.2 GHC==8.2.2  flags:   test-hlint:     description: Build hlint test     manual: true-    default: true+    default: false   test-doctests:     description: Build doctests     manual: true@@ -90,6 +90,9 @@         - -fwarn-incomplete-uni-patterns         - -fwarn-incomplete-record-updates +default-extensions:+  - NoImplicitPrelude+ library:   when:     - condition: impl(ghc >= 8.0)@@ -122,7 +125,8 @@     - http-types         ==0.9.*     - lens               >=4      && <5     - lucid              ==2.9.*-    - mellon-core        ==0.8.*+    - mellon-core+    - protolude          ==0.2.*     - servant            ==0.11.*     - servant-client     ==0.11.*     - servant-docs       >=0.10   && <0.12@@ -154,7 +158,8 @@         else:           dependencies:             - base-            - hlint ==2.0.*+            - hlint     ==2.0.*+            - protolude   doctest:     main: doctest.hs     source-dirs: test@@ -168,7 +173,8 @@         else:           dependencies:             - base-            - doctest >=0.11 && <0.14+            - doctest   >=0.11 && <0.14+            - protolude   spec:     main: Main.hs     source-dirs:@@ -183,12 +189,12 @@       - -with-rtsopts=-N     dependencies:       - base-      - QuickCheck           >=2.8 && <2.12+      - QuickCheck           >=2.8   && <2.12       - quickcheck-instances ==0.3.*       - aeson       - aeson-pretty       - bytestring-      - hspec                >=2.2 && <2.5+      - hspec                >=2.2   && <2.5       - hspec-wai            >=0.6.6 && <0.10       - http-client       - http-types@@ -196,7 +202,8 @@       - lucid       - mellon-core       - mellon-web-      - network+      - network              ==2.6.*+      - protolude       - servant       - servant-client       - servant-docs@@ -213,7 +220,7 @@       - warp  executables:-  gpio-mellon-server:+  gpio-mellon-server: &executable     main: GpioServer.hs     source-dirs: examples     other-modules: []@@ -236,28 +243,24 @@         else:           dependencies:             - base-            - exceptions           >=0.8.0 && <1-            - hpio                 >=0.8 && <1+            - exceptions           >=0.8.0  && <1+            - hpio                 >=0.8    && <1             - mellon-core-            - mellon-gpio          ==0.8.*+            - mellon-gpio             - mellon-web-            - mtl-            - network              ==2.6.*+            - mtl                  >=2.1.3  && <2.3+            - network             - optparse-applicative >=0.11.0 && <0.15+            - protolude             - time             - transformers             - warp   mellon-schedule-unlock:+    <<: *executable     main: ScheduleUnlock.hs-    source-dirs: examples-    other-modules: []     other-extensions:       - LambdaCase       - OverloadedStrings-    ghc-options:-      - -threaded-      - -fwarn-incomplete-uni-patterns-      - -fwarn-incomplete-record-updates     when:       - condition: impl(ghc >= 8.0)         ghc-options:@@ -274,24 +277,20 @@             - bytestring             - exceptions             - http-client-            - http-client-tls+            - http-client-tls       ==0.3.*             - http-types             - mellon-core             - mellon-web             - mtl             - network             - optparse-applicative+            - protolude             - servant-client             - time             - transformers   mock-mellon-server:+    <<: *executable     main: MockServer.hs-    source-dirs: examples-    other-modules: []-    ghc-options:-      - -threaded-      - -fwarn-incomplete-uni-patterns-      - -fwarn-incomplete-record-updates     when:       - condition: impl(ghc >= 8.0)         ghc-options:@@ -307,10 +306,13 @@             - base             - mellon-core             - mellon-web+            - protolude             - warp +data-files:+- swagger.json+ extra-source-files: - changelog.md - README.md-- swagger.json - package.yaml
src/Mellon/Web/Client.hs view
@@ -1,7 +1,7 @@ {-| Module      : Mellon.Web.Client Description : Client actions for the REST web service-Copyright   : (c) 2017, Quixoftic, LLC+Copyright   : (c) 2018, Quixoftic, LLC License     : BSD3 Maintainer  : Drew Hess <dhess-src@quixoftic.com> Stability   : experimental
src/Mellon/Web/Server.hs view
@@ -1,7 +1,7 @@ {-| Module      : Mellon.Web.Server Description : Top-level server re-exports-Copyright   : (c) 2017, Quixoftic, LLC+Copyright   : (c) 2018, Quixoftic, LLC License     : BSD3 Maintainer  : Drew Hess <dhess-src@quixoftic.com> Stability   : experimental
src/Mellon/Web/Server/API.hs view
@@ -1,7 +1,7 @@ {-| Module      : Mellon.Web.Server.API Description : A REST web service for @mellon-core@ controllers-Copyright   : (c) 2017, Quixoftic, LLC+Copyright   : (c) 2018, Quixoftic, LLC License     : BSD3 Maintainer  : Drew Hess <dhess-src@quixoftic.com> Stability   : experimental@@ -37,8 +37,9 @@          , server          ) where +import Protolude hiding (State, state) import Control.Lens ((&), (.~), (?~), mapped)-import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask)+import Control.Monad.Fail (fail) import Control.Monad.IO.Class (liftIO) import qualified Data.Aeson.Types as Aeson (Value(String)) import Data.Aeson.Types@@ -56,7 +57,6 @@ import Data.Text (Text) import Data.Time.Calendar (fromGregorian) import Data.Time.Clock (UTCTime(..), getCurrentTime)-import GHC.Generics import Lucid        (ToHtml(..), HtmlT, doctypehtml_, head_, title_, body_) import Mellon.Controller@@ -71,6 +71,7 @@  -- $setup -- >>> :set -XOverloadedStrings+-- >>> import Data.String (String) -- >>> import Data.Aeson (eitherDecode, encode) -- >>> import Data.Swagger.Schema.Validation @@ -203,7 +204,7 @@  instance ToHtml State where   toHtml Locked = stateDocument "Locked"-  toHtml (Unlocked time) = stateDocument $ "Unlocked until " >> toHtml (show time)+  toHtml (Unlocked time) = stateDocument $ "Unlocked until " >> toHtml (Time time)   toHtmlRaw = toHtml  -- | A newtype wrapper around 'UTCTime', for serving HTML without
src/Mellon/Web/Server/SwaggerAPI.hs view
@@ -1,7 +1,7 @@ {-| Module      : Mellon.Web.Server.SwaggerAPI Description : A Swagger-enhanced REST web service for @mellon-core@ controllers-Copyright   : (c) 2017, Quixoftic, LLC+Copyright   : (c) 2018, Quixoftic, LLC License     : BSD3 Maintainer  : Drew Hess <dhess-src@quixofticg.com> Stability   : experimental@@ -32,6 +32,7 @@          , writeSwaggerJSON          ) where +import Protolude import Control.Lens ((&), (.~), (?~)) import Data.Aeson.Encode.Pretty (encodePretty) import qualified Data.ByteString.Lazy.Char8 as C8 (writeFile)
test/Main.hs view
@@ -1,5 +1,6 @@ module Main where +import Protolude import Test.Hspec import Spec 
test/Mellon/Web/ClientSpec.hs view
@@ -1,10 +1,11 @@ module Mellon.Web.ClientSpec (spec) where +import Protolude hiding (state) import Control.Concurrent (ThreadId, forkIO, killThread, threadDelay) import Data.Time.Clock import Mellon.Controller (controller) import Mellon.Device (mockLock, mockLockDevice)-import Network.HTTP.Client (Manager, newManager, defaultManagerSettings)+import Network.HTTP.Client (newManager, defaultManagerSettings) import Network.Socket import Network.Wai.Handler.Warp import Servant.Client
test/Mellon/Web/ServerSpec.hs view
@@ -1,8 +1,10 @@+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-incomplete-uni-patterns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}  module Mellon.Web.ServerSpec (spec) where +import Protolude hiding (State, get) import Control.Concurrent (threadDelay) import Data.Aeson (decode, encode) import Data.ByteString (ByteString)@@ -17,7 +19,7 @@ import Test.Hspec import Test.Hspec.Wai ((<:>), WaiSession, get, liftIO, matchHeaders, request, shouldRespondWith, with) import Test.QuickCheck-       (Arbitrary(..), elements, genericShrink, oneof, property)+       (Arbitrary(..), genericShrink, oneof, property) import Test.QuickCheck.Instances ()  import Mellon.Web.Server (State(..), Time(..), app, swaggerApp)
test/Mellon/Web/SwaggerAPISpec.hs view
@@ -2,16 +2,17 @@  module Mellon.Web.SwaggerAPISpec (spec) where -import Mellon.Web.Server (State(..), Time(..), mellonAPI, mellonSwagger)-+import Protolude hiding (State) import Data.Aeson (eitherDecode) import qualified Data.ByteString.Lazy.Char8 as C8 (readFile) import Paths_mellon_web import Servant.Swagger.Test import Test.Hspec import Test.QuickCheck-       (Arbitrary(..), elements, genericShrink, oneof, property)+       (Arbitrary(..), genericShrink, oneof) import Test.QuickCheck.Instances ()++import Mellon.Web.Server (State(..), Time(..), mellonAPI, mellonSwagger)  spec :: Spec spec =
test/doctest.hs view
@@ -1,6 +1,7 @@ module Main where +import Protolude import Test.DocTest  main :: IO ()-main = doctest ["src"]+main = doctest ["src", "-XNoImplicitPrelude"]
test/hlint.hs view
@@ -1,9 +1,8 @@ module Main where +import Protolude import Control.Monad (unless) import Language.Haskell.HLint-import System.Environment-import System.Exit  main :: IO () main =