Skip to content

Commit

Permalink
Merge pull request #38 from Nike-Inc/devel
Browse files Browse the repository at this point in the history
Release 1.6
  • Loading branch information
dogonthehorizon committed Aug 29, 2017
2 parents d2cbd37 + b4b5fd1 commit b8874ae
Show file tree
Hide file tree
Showing 25 changed files with 321 additions and 247 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -24,3 +24,4 @@ cabal.project.local
ptl-pthread

*.tix
*.cabal
23 changes: 23 additions & 0 deletions .stylish-haskell.yaml
@@ -0,0 +1,23 @@
# stylish-haskell configuration file
# ==================================

# The stylish-haskell tool is mainly configured by specifying steps. These steps
# are a list, so they have an order, and one specific step may appear more than
# once (if needed). Each file is processed by these steps in the given order.
steps:
- imports:
align: file
list_align: after_alias
long_list_align: inline
list_padding: 4
separate_lists: true
- language_pragmas:
style: vertical
align: true
remove_redundant: true
- tabs:
spaces: 4
- trailing_whitespace: {}
columns: 80
language_extensions:
- OverloadedStrings
6 changes: 6 additions & 0 deletions HLint.hs
@@ -0,0 +1,6 @@
-- HLint configuration file

module HLint.HLint where

import "hint" HLint.Hlint
import "hint" HLint.Generalise
23 changes: 23 additions & 0 deletions Makefile
@@ -1,3 +1,5 @@
.PHONY: hlint_install, hlint, hlint_apply_refact, hlint_refactor
.PHONY: stylish_haskell_install, stylish_haskell_check

build: clean
@stack install
Expand All @@ -14,3 +16,24 @@ package-bin: static-build

clean:
@stack clean

# The following tasks cribbed from: https://lwm.github.io/haskell-static/
hlint_install:
@stack install hlint

hlint: hlint_install
@hlint test/ src/ app/

hlint_apply_refact: hlint_install
@stack install apply-refact

HLINT=hlint --refactor --refactor-options -i {} \;
hlint_refactor: hlint_apply_refact
@find src/ test/ app/ -name "*.hs" -exec $(HLINT)

stylish_haskell_install:
@stack install stylish-haskell

STYLISH=stylish-haskell -i {} \;
stylish_haskell_check: stylish_haskell_install
@find test/ app/ src/ -name "*.hs" -exec $(STYLISH) && git diff --exit-code
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -147,13 +147,15 @@ You can get a list of available options with the `-h` flag:

```
$ bartlett -h
bartlett - the Jenkins command-line tool to serve your needs.
bartlett 1.6.0 - the Jenkins command-line tool to serve your needs.
Usage: bartlett [-u|--username USERNAME] [-j|--jenkins JENKINS_INSTANCE]
[-p|--profile PROFILE_NAME] [--refresh-credentials] COMMAND
Usage: bartlett [--version] [-u|--username USERNAME]
[-j|--jenkins JENKINS_INSTANCE] [-p|--profile PROFILE_NAME]
[--refresh-credentials] COMMAND
Available options:
-h,--help Show this help text
--version Print the current version and exit.
-u,--username USERNAME The user to authenticate with
-j,--jenkins JENKINS_INSTANCE
The Jenkins instance to interact with
Expand Down
35 changes: 18 additions & 17 deletions app/Main.hs
@@ -1,24 +1,25 @@
module Main where

import Prelude hiding (putStr)

import qualified Bartlett.Actions.Artifact as AA
import qualified Bartlett.Actions.Build as AB
import qualified Bartlett.Actions.Config as AC
import qualified Bartlett.Actions.Info as AI
import qualified Bartlett.Actions.Log as AL
import qualified Bartlett.Configuration as C
import Bartlett.Parsers (parseOptions, withInfo)
import Bartlett.Types
import Bartlett.Parsers (parseOptions, withInfo)
import qualified Bartlett.Configuration as C
import qualified Bartlett.Actions.Info as AI
import qualified Bartlett.Actions.Build as AB
import qualified Bartlett.Actions.Config as AC
import qualified Bartlett.Actions.Artifact as AA
import qualified Bartlett.Actions.Log as AL

import Control.Exception (bracket_)
import Control.Monad.Reader (local, liftIO, ask, asks, runReaderT)
import Data.ByteString.Lazy.Char8 (ByteString, pack, unpack, hPutStr)
import Data.Maybe (fromMaybe)
import Options.Applicative
import System.Exit (die)
import System.IO (hFlush, stdout, stdin, stderr, hSetEcho, hGetEcho, hPutChar)
import qualified System.Keyring as SK
import Control.Exception (bracket_)
import Control.Monad.Reader (ask, asks, liftIO, local,
runReaderT)
import Data.ByteString.Lazy.Char8 (ByteString, hPutStr, pack, unpack)
import Data.Maybe (fromMaybe)
import Options.Applicative
import Prelude hiding (putStr)
import System.Exit (die)
import System.IO (hFlush, hGetEcho, hPutChar,
hSetEcho, stderr, stdin, stdout)
import qualified System.Keyring as SK

-- | Wrapper determining if the given action should be echoed to stdout.
withEcho :: Bool -> IO a -> IO a
Expand Down
94 changes: 0 additions & 94 deletions bartlett.cabal

This file was deleted.

88 changes: 88 additions & 0 deletions package.yaml
@@ -0,0 +1,88 @@
name: bartlett
version: '1.6.0'
synopsis: The Jenkins command-line tool to serve your needs.
description: Please see README.md
category: CLI
author: Fernando Freire
maintainer: fernando.freire@nike.com
copyright: 2016-Present Nike, Inc.
license: BSD3
github: Nike-inc/bartlett
default-extensions:
- OverloadedStrings
dependencies:
- base >=4.7 && <5
- bytestring
library:
source-dirs: src
ghc-options:
- -Wall
- -fwarn-tabs
- -fwarn-unused-imports
- -fwarn-missing-signatures
- -fwarn-name-shadowing
- -fwarn-incomplete-patterns
exposed-modules:
- Bartlett.Types
- Bartlett.Util
- Bartlett.Parsers
- Bartlett.Network
- Bartlett.Configuration
- Bartlett.Actions.Info
- Bartlett.Actions.Build
- Bartlett.Actions.Config
- Bartlett.Actions.Artifact
- Bartlett.Actions.Log
dependencies:
- aeson
- aeson-pretty
- case-insensitive
- configurator
- filepath
- http-client
- http-types
- lens
- lens-aeson
- mtl
- optparse-applicative
- text
- transformers
- uri-bytestring
- wreq
executables:
bartlett:
main: app/Main.hs
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
ld-options:
- -optl-static
- -optl-pthread
dependencies:
- bartlett
- keyring
- mtl
- optparse-applicative
tests:
bartlett-test:
main: Tasty.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- aeson
- bartlett
- either-unwrap
- hspec
- http-types
- lens
- smallcheck
- tasty
- tasty-discover
- tasty-hspec
- tasty-smallcheck
- uri-bytestring
- wreq
16 changes: 8 additions & 8 deletions src/Bartlett/Actions/Artifact.hs
Expand Up @@ -12,16 +12,16 @@ module Bartlett.Actions.Artifact (
getArtifact
) where

import Bartlett.Network (execRequest)
import Bartlett.Types
import Bartlett.Util (mkUrl)
import Bartlett.Network (execRequest)
import Bartlett.Types
import Bartlett.Util (mkUrl)

import Control.Lens (set, (^.), (&))
import Control.Monad.Reader (asks, liftIO)
import Data.Maybe (fromJust)
import Data.Monoid ((<>))
import Control.Lens (set, (&), (^.))
import Control.Monad.Reader (asks, liftIO)
import qualified Data.ByteString.Lazy.Char8 as BL
import Network.Wreq (responseBody, defaults, auth)
import Data.Maybe (fromJust)
import Data.Monoid ((<>))
import Network.Wreq (auth, defaults, responseBody)

-- | Download an artifact from the provided job.
getArtifact ::
Expand Down
16 changes: 8 additions & 8 deletions src/Bartlett/Actions/Build.hs
Expand Up @@ -12,16 +12,16 @@ module Bartlett.Actions.Build (
postBuild
) where

import Bartlett.Network (execRequest)
import Bartlett.Types
import qualified Bartlett.Util as BU
import Bartlett.Network (execRequest)
import Bartlett.Types
import qualified Bartlett.Util as BU

import Control.Lens (set, (^.), (&))
import Control.Monad.Reader (asks, liftIO)
import Data.Maybe (fromJust)
import Data.Aeson.Encode.Pretty (encodePretty)
import Control.Lens (set, (&), (^.))
import Control.Monad.Reader (asks, liftIO)
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Data.ByteString.Lazy.Char8 as BL
import Network.Wreq (Options, responseStatus, auth)
import Data.Maybe (fromJust)
import Network.Wreq (Options, auth, responseStatus)


-- | Parses and determines type of job to trigger based on supplied parameters.
Expand Down
17 changes: 9 additions & 8 deletions src/Bartlett/Actions/Config.hs
Expand Up @@ -10,16 +10,17 @@ Methods for executing config requests against Jenkins.
-}
module Bartlett.Actions.Config where

import Bartlett.Network (execRequest)
import Bartlett.Types
import Bartlett.Util (toResponseStatus, mkUrl)
import Bartlett.Network (execRequest)
import Bartlett.Types
import Bartlett.Util (mkUrl, toResponseStatus)

import Control.Lens (set, (^.), (&))
import Data.Maybe (Maybe, fromJust)
import Data.Aeson.Encode.Pretty (encodePretty)
import Control.Lens (set, (&), (^.))
import Control.Monad.Reader (asks, liftIO)
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Data.ByteString.Lazy.Char8 as BL
import Network.Wreq (responseStatus, responseBody, defaults, auth)
import Control.Monad.Reader (liftIO, asks)
import Data.Maybe (Maybe, fromJust)
import Network.Wreq (auth, defaults, responseBody,
responseStatus)

-- | Construct a URL to interact with Job configurations.
configUri :: JenkinsInstance -> JobPath -> JenkinsInstance
Expand Down

0 comments on commit b8874ae

Please sign in to comment.