packages feed

mellon-web-0.8.0.5: package.yaml

name:       mellon-web
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) 2018, Quixoftic, LLC
license:    BSD3
github:     quixoftic/mellon

description: ! 'The @mellon-web@ package wraps a @mellon-core@ controller in a REST

  web service, making it possible to control physical access devices

  from an HTTP client. The package includes both a WAI application

  server, and native Haskell client bindings for the service.


  Like the @mellon-core@ controller interface, the @mellon-web@ REST API

  is quite simple. There are only 3 methods:


  * @GET /time@ returns the system time on the server. This is made

  available for diagnostic purposes, primarily to ensure the server

  has an accurate clock.


  * @GET /state@ returns the controller''s current state (either @Locked@

  or @Unlocked date@ where @date@ is the UTC time at which the

  controller will automatically lock again).


  * @PUT /state@ sets the controller''s current state. Use this method to

  lock and unlock the controller.


  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

  server such as Nginx.'

tested-with: GHC==8.0.2 GHC==8.2.2

flags:
  test-hlint:
    description: Build hlint test
    manual: true
    default: false
  test-doctests:
    description: Build doctests
    manual: true
    default: true
  gpio-example:
    description: Build the GPIO server example
    manual: true
    default: true
  mock-example:
    description: Build the mock server example
    manual: true
    default: true
  client-unlock-example:
    description: Build the unlock client example
    manual: true
    default: true

when:
  - condition: impl(ghc >= 8.0)
    then:
      ghc-options:
        - -Wall
        - -Wincomplete-uni-patterns
        - -Wincomplete-record-updates
    else:
      ghc-options:
        - -Wall
        - -fwarn-incomplete-uni-patterns
        - -fwarn-incomplete-record-updates

default-extensions:
  - NoImplicitPrelude

library:
  when:
    - condition: impl(ghc >= 8.0)
      then:
        ghc-options:
          - -Wcompat
          - -Wnoncanonical-monad-instances
          - -Wnoncanonical-monadfail-instances
      else:
        # provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8
        dependencies:
          - fail       == 4.9.*
          - semigroups == 0.18.*
  source-dirs: src
  other-extensions:
    - DataKinds
    - DeriveDataTypeable
    - DeriveGeneric
    - MultiParamTypeClasses
    - OverloadedStrings
    - OverloadedLists
    - ScopedTypeVariables
    - TypeOperators
  dependencies:
    - base               >=4.8    && <5
    - aeson              >=0.11   && <1.3
    - aeson-pretty       ==0.8.*
    - bytestring         ==0.10.*
    - http-client        >=0.4    && <0.6
    - http-types         ==0.9.*
    - lens               >=4      && <5
    - lucid              ==2.9.*
    - mellon-core
    - protolude          ==0.2.*
    - servant            ==0.11.*
    - servant-client     ==0.11.*
    - servant-docs       >=0.10   && <0.12
    - servant-lucid      ==0.7.*
    - servant-server     ==0.11.*
    - servant-swagger    ==1.1.*
    - servant-swagger-ui ==0.2.*
    - swagger2           >=2.1    && <2.3
    - text               ==1.2.*
    - time               >=1.5    && <2
    - transformers       >=0.4.2  && <0.6
    - wai                ==3.2.*
    - warp               ==3.2.*

tests:
  hlint:
    main: hlint.hs
    source-dirs: test
    other-modules: []
    ghc-options:
      - -w
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N
    when:
      - condition: "!(flag(test-hlint))"
        then:
          buildable: false
        else:
          dependencies:
            - base
            - hlint     ==2.0.*
            - protolude
  doctest:
    main: doctest.hs
    source-dirs: test
    other-modules: []
    ghc-options:
      - -threaded
    when:
      - condition: "!(flag(test-doctests))"
        then:
          buildable: false
        else:
          dependencies:
            - base
            - doctest   >=0.11 && <0.14
            - protolude
  spec:
    main: Main.hs
    source-dirs:
      - test
    other-extensions:
      - OverloadedStrings
      - ScopedTypeVariables
    ghc-options:
      - -w
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N
    dependencies:
      - base
      - QuickCheck           >=2.8   && <2.12
      - quickcheck-instances ==0.3.*
      - aeson
      - aeson-pretty
      - bytestring
      - hspec                >=2.2   && <2.5
      - hspec-wai            >=0.6.6 && <0.10
      - http-client
      - http-types
      - lens
      - lucid
      - mellon-core
      - mellon-web
      - network              ==2.6.*
      - protolude
      - servant
      - servant-client
      - servant-docs
      - servant-lucid
      - servant-server
      - servant-swagger
      - servant-swagger-ui
      - swagger2
      - text
      - time
      - transformers
      - wai
      - wai-extra            ==3.0.*
      - warp

executables:
  gpio-mellon-server: &executable
    main: GpioServer.hs
    source-dirs: examples
    other-modules: []
    other-extensions:
      - OverloadedStrings
    ghc-options:
      - -threaded
      - -fwarn-incomplete-uni-patterns
      - -fwarn-incomplete-record-updates
    when:
      - condition: impl(ghc >= 8.0)
        ghc-options:
          - -Wcompat
          - -Wnoncanonical-monad-instances
          - -Wnoncanonical-monadfail-instances
          - -fno-warn-redundant-constraints
      - condition: "!(flag(gpio-example))"
        then:
          buildable: false
        else:
          dependencies:
            - base
            - exceptions           >=0.8.0  && <1
            - hpio                 >=0.8    && <1
            - mellon-core
            - mellon-gpio
            - mellon-web
            - 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
    other-extensions:
      - LambdaCase
      - OverloadedStrings
    when:
      - condition: impl(ghc >= 8.0)
        ghc-options:
          - -Wcompat
          - -Wnoncanonical-monad-instances
          - -Wnoncanonical-monadfail-instances
          - -fno-warn-redundant-constraints
      - condition: "!(flag(client-unlock-example))"
        then:
          buildable: false
        else:
          dependencies:
            - base
            - bytestring
            - exceptions
            - http-client
            - 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
    when:
      - condition: impl(ghc >= 8.0)
        ghc-options:
          - -Wcompat
          - -Wnoncanonical-monad-instances
          - -Wnoncanonical-monadfail-instances
          - -fno-warn-redundant-constraints
      - condition: "!(flag(mock-example))"
        then:
          buildable: false
        else:
          dependencies:
            - base
            - mellon-core
            - mellon-web
            - protolude
            - warp

data-files:
- swagger.json

extra-source-files:
- changelog.md
- README.md
- package.yaml