Skip to content

Commit

Permalink
Merge pull request #99 from dmjio/http-client
Browse files Browse the repository at this point in the history
Default to http-client
  • Loading branch information
dmjio authored Jul 5, 2018
2 parents a0920af + 87d58d3 commit 0b7e306
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ cabal.sandbox.config
.stack-work
result
result-*
*~
19 changes: 3 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,18 @@ language: nix
matrix:
fast_finish: true
include:
- env: GHCVER=ghc7103
- env: GHCVER=ghc802
- env: GHCVER=ghc822
- env: GHCVER=ghc742
- env: GHCVER=ghc763
- env: GHCVER=ghc783
- env: GHCVER=ghc784
- env: GHCVER=ghc801
- env: GHCVER=ghc802
- env: GHCVER=ghc822
- env: GHCVER=ghc842
- env: GHCVER=ghcHEAD
allow_failures:
- env: GHCVER=ghc742
- env: GHCVER=ghc763
- env: GHCVER=ghc783
- env: GHCVER=ghc784
- env: GHCVER=ghc7103
- env: GHCVER=ghc801
- env: GHCVER=ghc802
- env: GHCVER=ghc822
- env: GHCVER=ghc842
- env: GHCVER=ghcHEAD

before_install:
- nix-channel --list
- nix-channel --update

script:
- nix-build -A stripe-haskell --argstr compiler $GHCVER
- nix-build -A stripe-haskell --argstr compiler $GHCVER --arg check true
18 changes: 12 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{ compiler ? "ghc822" }:
{ compiler ? "ghc822", check ? false }:
let
config = {
packageOverrides = pkgs: {
packageOverrides = pkgs: with pkgs.haskell.lib; {
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
${compiler} = pkgs.haskell.packages.${compiler}.override {
overrides = self: super: with pkgs.haskell.lib; rec {
stripe-core = self.callPackage ./stripe-core {};
stripe-tests = self.callPackage ./stripe-tests { inherit stripe-core; };
stripe-http-streams = self.callPackage ./stripe-http-streams {
stripe-http-streams = dontCheck (self.callPackage ./stripe-http-streams {
inherit stripe-tests stripe-core;
};
});
stripe-http-client =
let
stripe-http-client = self.callPackage ./stripe-http-client {
inherit stripe-tests stripe-core;
};
in if check then stripe-http-client else dontCheck stripe-http-client;
stripe-haskell = self.callPackage ./stripe-haskell {
inherit stripe-http-streams stripe-core;
inherit stripe-http-streams stripe-core stripe-http-client;
};
};
};
Expand All @@ -22,6 +28,6 @@ let
};
in
with (import <nixpkgs> { inherit config; }).haskell.packages.${compiler}; {
inherit stripe-core stripe-tests stripe-haskell stripe-http-streams;
inherit stripe-core stripe-tests stripe-haskell stripe-http-streams stripe-http-client;
}

2 changes: 1 addition & 1 deletion stripe-core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}:
mkDerivation {
pname = "stripe-core";
version = "2.3.0";
version = "2.4.0";
src = ./.;
libraryHaskellDepends = [
aeson base bytestring mtl text time transformers
Expand Down
2 changes: 1 addition & 1 deletion stripe-core/stripe-core.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stripe-core
version: 2.3.0
version: 2.4.0
synopsis: Stripe API for Haskell - Pure Core
license: MIT
license-file: LICENSE
Expand Down
6 changes: 3 additions & 3 deletions stripe-haskell/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ mkDerivation, base, stdenv, stripe-core, stripe-http-streams }:
{ mkDerivation, base, stdenv, stripe-core, stripe-http-streams, stripe-http-client }:
mkDerivation {
pname = "stripe-haskell";
version = "2.3.0";
version = "2.4.0";
src = ./.;
libraryHaskellDepends = [ base stripe-core stripe-http-streams ];
libraryHaskellDepends = [ base stripe-core stripe-http-streams stripe-http-client ];
homepage = "https://github.com/dmjio/stripe";
description = "Stripe API for Haskell";
license = stdenv.lib.licenses.mit;
Expand Down
3 changes: 3 additions & 0 deletions stripe-haskell/src-http-client/Web/Stripe/Client/Stripe.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Web.Stripe.Client.Stripe (stripe) where

import Web.Stripe.Client.HttpClient (stripe)
Empty file.
33 changes: 23 additions & 10 deletions stripe-haskell/stripe-haskell.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stripe-haskell
version: 2.3.0
version: 2.4.0
synopsis: Stripe API for Haskell
license: MIT
license-file: LICENSE
Expand All @@ -13,18 +13,31 @@ build-type: Simple
cabal-version: >=1.10
Description: For usage information please consult README.md

library
hs-source-dirs: src src-http-streams
build-depends: base >= 4 && < 5,
stripe-core,
stripe-http-streams
flag http-streams
default: False

default-language: Haskell2010
library
build-depends:
base >= 4 && < 5,
stripe-core
default-language:
Haskell2010
exposed-modules:
Web.Stripe
Web.Stripe.Client.Stripe
Web.Stripe
Web.Stripe.Client.Stripe
ghc-options:
-Wall
if flag(http-streams)
hs-source-dirs:
src src-http-streams
build-depends:
stripe-http-streams
else
hs-source-dirs:
src src-http-client
build-depends:
stripe-http-client

ghc-options: -Wall

source-repository head
type: git
Expand Down
21 changes: 21 additions & 0 deletions stripe-http-client/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ mkDerivation, aeson, base, bytestring, free, hspec, http-client
, http-client-tls, http-types, stdenv, stripe-core, stripe-tests
, text
}:
mkDerivation {
pname = "stripe-http-client";
version = "2.4.0";
src = ./.;
libraryHaskellDepends = [
aeson base bytestring http-client http-client-tls http-types
stripe-core text
];
preCheck = ''
export STRIPEKEY="sk_test_igoYowTqR5IfovOKFKwigRmW"
'';
testHaskellDepends = [
base free hspec http-client stripe-core stripe-tests
];
description = "Stripe API for Haskell - http-client backend";
license = stdenv.lib.licenses.mit;
}
5 changes: 5 additions & 0 deletions stripe-http-client/src/Web/Stripe/Client/HttpClient.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}

module Web.Stripe.Client.HttpClient
Expand Down Expand Up @@ -26,7 +27,11 @@ import qualified Network.HTTP.Types as Http
import Data.Aeson as A
import Data.ByteString (ByteString)
import Data.Monoid ((<>))
#if MIN_VERSION_http_client(0,5,13)
import Network.HTTP.Client as Http hiding (withManager, withConnection)
#else
import Network.HTTP.Client as Http hiding (withManager)
#endif
import Network.HTTP.Client.TLS as TLS

import qualified Web.Stripe.StripeRequest as S
Expand Down
4 changes: 2 additions & 2 deletions stripe-http-client/stripe-http-client.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stripe-http-client
version: 0.1
version: 2.4.0
license: MIT
license-file: LICENSE
author: Christopher Reichert
Expand Down Expand Up @@ -39,7 +39,7 @@ Test-Suite tests
hs-source-dirs: tests
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, free >= 4.10 && < 4.13
, free >= 4.10 && < 6
, hspec >= 2.1.0 && < 2.5
, stripe-core
, stripe-tests
Expand Down
5 changes: 5 additions & 0 deletions stripe-http-client/tests/Main.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{-# LANGUAGE CPP #-}
module Main where

import Control.Monad.Trans.Free (FreeF(..), FreeT(..))
#if MIN_VERSION_http_client(0,5,13)
import Network.HTTP.Client hiding (withConnection)
#else
import Network.HTTP.Client
#endif
import Web.Stripe.Client (StripeConfig(..), StripeError(..))
import Web.Stripe.Client.HttpClient (withConnection, callAPI)
import Web.Stripe.Test.AllTests (allTests)
Expand Down
2 changes: 1 addition & 1 deletion stripe-http-streams/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}:
mkDerivation {
pname = "stripe-http-streams";
version = "2.3.0";
version = "2.4.0";
src = ./.;
libraryHaskellDepends = [
aeson base bytestring HsOpenSSL http-streams io-streams stripe-core
Expand Down
4 changes: 2 additions & 2 deletions stripe-http-streams/stripe-http-streams.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stripe-http-streams
version: 2.3.0
version: 2.4.0
license: MIT
license-file: LICENSE
author: David Johnson, Jeremy Shaw
Expand Down Expand Up @@ -37,7 +37,7 @@ Test-Suite tests
hs-source-dirs: tests
build-depends: HsOpenSSL
, base >= 4.7 && < 5
, free >= 4.10 && < 4.13
, free >= 4.10 && < 6
, hspec >= 2.1.0 && < 2.5
, http-streams >= 0.7 && < 0.9
, stripe-core
Expand Down
2 changes: 1 addition & 1 deletion stripe-tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}:
mkDerivation {
pname = "stripe-tests";
version = "2.3.0";
version = "2.4.0";
src = ./.;
libraryHaskellDepends = [
aeson base bytestring free hspec hspec-core mtl random stripe-core
Expand Down
4 changes: 2 additions & 2 deletions stripe-tests/stripe-tests.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stripe-tests
version: 2.3.0
version: 2.4.0
synopsis: Tests for Stripe API bindings for Haskell
license: MIT
license-file: LICENSE
Expand All @@ -25,7 +25,7 @@ library
build-depends: aeson >= 0.8 && < 0.10 || >= 0.11 && < 1.3
, base >= 4.7 && < 5
, bytestring >= 0.10 && < 0.11
, free >= 4.10 && < 4.13
, free >= 4.10 && < 6
, mtl >= 2.1.2 && < 2.3
, random >= 1.1 && < 1.2
, hspec >= 2.1.0 && < 2.5
Expand Down

0 comments on commit 0b7e306

Please sign in to comment.