Skip to content

Commit

Permalink
Merge pull request haskell-servant#31 from haskell-servant/merge
Browse files Browse the repository at this point in the history
Merge all repos
  • Loading branch information
jkarni committed Apr 20, 2015
2 parents 68a129d + 619e665 commit e9f73b0
Show file tree
Hide file tree
Showing 96 changed files with 6,024 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
dist
bin
lib
share
packages
*-packages.conf.d
cabal-dev
add-source-timestamps
*.o
*.hi
*.chi
Expand Down
19 changes: 3 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,12 @@ language: haskell
ghc:
- 7.8

before_install:
- cabal update
- cabal sandbox init

install:
- cabal install --only-dependencies --enable-tests
- ghc --version
- cabal --version

script:
- cabal configure --enable-tests --enable-library-coverage && cabal build && cabal test
- cabal check
- cabal sdist

after_script:
- |
if [ "$TRAVIS_PULL_REQUEST" -eq "$TRAVIS_PULL_REQUEST" ] 2>/dev/null || [ "$TRAVIS_BRANCH" == "master" ] ; then
cabal install hpc-coveralls
hpc-coveralls --exclude-dir=test spec doctests
fi
- ./scripts/test-all.sh

notifications:
irc:
Expand Down
42 changes: 42 additions & 0 deletions scripts/test-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash -
#===============================================================================
#
# FILE: test-all.sh
#
# USAGE: ./test-all.sh
#
# DESCRIPTION: Run tests for all source directories listed in $SOURCES.
# Uses local versions of those sources.
#
#===============================================================================

set -o nounset
set -o errexit

SOURCES=( servant servant-server servant-client servant-jquery servant-docs )
GHC_FLAGS="-Werror"

prepare_sandbox () {
cabal sandbox init
for s in ${SOURCES[@]} ; do
cd "$s"
cabal sandbox init --sandbox=../
cabal sandbox add-source .
cd ..
done
}

test_each () {
for s in ${SOURCES[@]} ; do
echo "Testing $s..."
cd "$s"
cabal install --only-dependencies --enable-tests
cabal configure --enable-tests --ghc-options="$GHC_FLAGS"
cabal build
cabal test
cd ..
done
}

prepare_sandbox
test_each
15 changes: 15 additions & 0 deletions servant-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
0.3
---
* Support content-type aware combinators and `Accept`/`Content-type` headers
* Added a lot of tests
* Support multiple concurrent threads
* Use `ServantError` to report Errors instead of `String`
* Make the clients for `Raw` endpoints return the whole `Response` value (to be able to access response headers for example)
* Support for PATCH
* Make () instances expect No Content status code, and not try to decode body.
* `Canonicalize` API types before generating client functions for them

0.2.2
-----
* Add TLS support
* Add matrix parameter support
File renamed without changes.
23 changes: 23 additions & 0 deletions servant-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# servant-client

[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-client.svg)](http://travis-ci.org/haskell-servant/servant-client)
[![Coverage Status](https://coveralls.io/repos/haskell-servant/servant-client/badge.svg)](https://coveralls.io/r/haskell-servant/servant-client)

![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)

This library lets you automatically derive Haskell functions that let you query each endpoint of a *servant* webservice.

## Example

``` haskell
type MyApi = "books" :> Get [Book] -- GET /books
:<|> "books" :> ReqBody Book :> Post Book -- POST /books

myApi :: Proxy MyApi
myApi = Proxy

getAllBooks :: BaseUrl -> EitherT String IO [Book]
postNewBook :: Book -> BaseUrl -> EitherT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi
```
File renamed without changes.
52 changes: 52 additions & 0 deletions servant-client/docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
SERVANT_DIR=/tmp/servant-client-gh-pages

# Make a temporary clone

rm -rf $SERVANT_DIR

git clone . $SERVANT_DIR

cd $SERVANT_DIR

# Make sure to pull the latest

git remote add haskell-servant [email protected]:haskell-servant/servant-client.git

git fetch haskell-servant

git reset --hard haskell-servant/gh-pages

# Clear everything away

git rm -rf $SERVANT_DIR/*

# Switch back and build the haddocks

cd -

cabal configure --builddir=$SERVANT_DIR

cabal haddock --hoogle --hyperlink-source --html-location='https://hackage.haskell.org/package/$pkg-$version/docs' --builddir=$SERVANT_DIR

commit_hash=$(git rev-parse HEAD)

# Move the HTML docs to the root

cd $SERVANT_DIR

rm *
rm -rf build
mv doc/html/servant-client/* .
rm -r doc/

# Add everything

git add .

git commit -m "Built from $commit_hash"

# Push to update the pages

git push haskell-servant HEAD:gh-pages

rm -rf $SERVANT_DIR
85 changes: 85 additions & 0 deletions servant-client/servant-client.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: servant-client
version: 0.2.2
synopsis: automatical derivation of querying functions for servant webservices
description:
This library lets you derive automatically Haskell functions that
let you query each endpoint of a <http://hackage.haskell.org/package/servant servant> webservice.
.
Example below.
.
> type MyApi = "books" :> Get [Book] -- GET /books
> :<|> "books" :> ReqBody Book :> Post Book -- POST /books
>
> myApi :: Proxy MyApi
> myApi = Proxy
>
> getAllBooks :: BaseUrl -> EitherT String IO [Book]
> postNewBook :: Book -> BaseUrl -> EitherT String IO Book
> (getAllBooks :<|> postNewBook) = client myApi
license: BSD3
license-file: LICENSE
author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
maintainer: [email protected]
copyright: 2014 Zalora South East Asia Pte Ltd
category: Web
build-type: Simple
cabal-version: >=1.10
tested-with: GHC >= 7.8
homepage: http://haskell-servant.github.io/
Bug-reports: http://github.com/haskell-servant/servant-client/issues
source-repository head
type: git
location: http://github.com/haskell-servant/servant-client.git

library
exposed-modules:
Servant.Client
Servant.Common.BaseUrl
Servant.Common.Req
build-depends:
base >=4.7 && <5
, aeson
, attoparsec
, bytestring
, either
, exceptions
, http-client
, http-client-tls
, http-media
, http-types
, network-uri >= 2.6
, safe
, servant >= 0.2.2
, string-conversions
, text
, transformers
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall

test-suite spec
type: exitcode-stdio-1.0
ghc-options:
-Wall -fno-warn-name-shadowing -fno-warn-missing-signatures
default-language: Haskell2010
hs-source-dirs: test
main-is: Spec.hs
build-depends:
base == 4.*
, aeson
, bytestring
, deepseq
, either
, hspec == 2.*
, http-client
, http-media
, http-types
, HUnit
, network >= 2.6
, QuickCheck >= 2.7
, servant >= 0.2.1
, servant-client
, servant-server >= 0.2.1
, text
, wai
, warp
Loading

0 comments on commit e9f73b0

Please sign in to comment.