Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhadroncollider committed Dec 5, 2018
2 parents 88e5990 + 540d861 commit f69aea0
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 28 deletions.
15 changes: 7 additions & 8 deletions .bin/build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resolver="lts-12.4"
ghcv="8.4.3"
resolver="lts-12.21"
ghcv="8.4.4"

branch=$(git rev-parse --abbrev-ref HEAD)

Expand All @@ -20,6 +20,9 @@ fi

rm -rf .stack-work/install

# sort out releases directory
rm -rf "releases/$1/taskell"
mkdir -p "releases/$1/taskell"

# Mac
stack build --ghc-options -O3
Expand All @@ -31,11 +34,12 @@ tar -czvf "releases/$1/taskell-$1_x86-64-mac.tar.gz" --directory=".stack-work/in
stack docker pull
stack build --docker --ghc-options -O3

LINUX_DIR=$(ls .stack-work/install | grep linux)

tar -czvf "releases/$1/taskell-$1_x86-64-linux.tar.gz" --directory=".stack-work/install/$LINUX_DIR/$resolver/$ghcv/bin" "taskell"

mkdir -p "releases/$1/taskell/DEBIAN"
mkdir -p "releases/$1/taskell/usr/local/bin"
LINUX_DIR=$(ls .stack-work/install | grep linux)

cp ".stack-work/install/$LINUX_DIR/$resolver/$ghcv/bin/taskell" "releases/$1/taskell/usr/local/bin"

Expand All @@ -51,12 +55,7 @@ mv "releases/$1/taskell.deb" "releases/$1/taskell-$1_x86-64-linux.deb"


# Homebrew Pull Request

(cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git pull)
brew bump-formula-pr --url="https://github.com/smallhadroncollider/taskell/archive/$1.tar.gz"
(cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git add Formula/taskell.rb && git commit -m "taskell $1" && git push -f smallhadroncollider && git reset --hard origin)

open "https://github.com/Homebrew/homebrew-core/compare/master...smallhadroncollider:master"


# Release Template
Expand Down
2 changes: 1 addition & 1 deletion docs/html/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: taskell
tagline: Command-line Kanban board/task managment
baseurl: ""
locale: "en"
version: 1.3.3
version: 1.3.4
destination: _site/public
exclude: [deployment, Capfile, log, Gemfile, Gemfile.lock]

Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: taskell
version: '1.3.3.0'
version: '1.3.4.0'
category: CLI
author: Mark Wales
maintainer: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion src/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ClassyPrelude
import Data.FileEmbed (embedFile)

version :: Text
version = "1.3.3"
version = "1.3.4"

usage :: Text
usage = decodeUtf8 $(embedFile "templates/usage.txt")
4 changes: 2 additions & 2 deletions src/IO/HTTP/Aeson.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ import Data.FileEmbed (embedFile)
deriveFromJSON :: Name -> Q [Dec]
deriveFromJSON = TH.deriveFromJSON defaultOptions { fieldLabelModifier = drop 1 }

parseError :: Text
parseError = decodeUtf8 $(embedFile "templates/api-error.txt")
parseError :: String -> Text
parseError err = decodeUtf8 $(embedFile "templates/api-error.txt") ++ "\n\n" ++ pack err
25 changes: 16 additions & 9 deletions src/IO/HTTP/GitHub.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ClassyPrelude
import Control.Lens ((^.))
import Data.Sequence ((!?), mapWithIndex)
import Data.Text (strip, splitOn)
import Data.Either (lefts, rights)

import Data.Aeson
import UI.CLI (prompt)
Expand All @@ -33,6 +34,12 @@ type GitHubIdentifier = Text

type ReaderGitHubToken a = ReaderT GitHubToken IO a

concatEithers :: [Either String [a]] -> Either String [a]
concatEithers vals = if null ls
then Right $ concat (rights vals)
else Left $ concat ((++ "\n") <$> ls)
where ls = lefts vals

root :: Text
root = "https://api.github.com/"

Expand Down Expand Up @@ -76,9 +83,9 @@ getCards url = do
(status, body) <- fetch url

return $ case status of
200 -> case concat (decodeStrict <$> body) of
Just cards -> Right cards
Nothing -> Left parseError
200 -> case concatEithers (eitherDecodeStrict <$> body) of
Right cards -> Right cards
Left err -> Left (parseError err)
429 -> Left "Too many cards"
_ -> Left $ tshow status ++ " error while fetching " ++ url

Expand All @@ -101,9 +108,9 @@ getColumns url = do
(status, body) <- fetch url

case status of
200 -> case concat (decodeStrict <$> body) of
Just columns -> addCards columns
Nothing -> return $ Left parseError
200 -> case concatEithers (eitherDecodeStrict <$> body) of
Right columns -> addCards columns
Left err -> return $ Left (parseError err)
404 -> return . Left $ "Could not find GitHub project ."
401 -> return . Left $ "You do not have permission to view GitHub project " ++ url
_ -> return . Left $ tshow status ++ " error. Cannot fetch columns from GitHub."
Expand Down Expand Up @@ -137,12 +144,12 @@ getLists identifier = do
(status, body) <- fetch url

case status of
200 -> case concat (decodeStrict <$> body) of
Just projects -> if null projects
200 -> case concatEithers (eitherDecodeStrict <$> body) of
Right projects -> if null projects
then return . Left $ concat ["\nNo projects found for ", identifier, "\n"]
else chooseProject projects

Nothing -> return $ Left parseError
Left err -> return $ Left (parseError err)
404 -> return . Left $ "Could not find GitHub org/repo. For organisation make sure you use 'orgs/<org-name>' and for repos use 'repos/<username>/<repo-name>'"
401 -> return . Left $ "You do not have permission to view the GitHub projects for " ++ identifier
_ -> return . Left $ tshow status ++ " error. Cannot fetch projects from GitHub."
12 changes: 6 additions & 6 deletions src/IO/HTTP/Trello.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ getChecklist checklist = do
(status, body) <- lift $ fetch url

return $ case status of
200 -> case (^. checkItems) <$> decodeStrict body of
Just ls -> Right ls
Nothing -> Left parseError
200 -> case (^. checkItems) <$> eitherDecodeStrict body of
Right ls -> Right ls
Left err -> Left $ parseError err
429 -> Left "Too many checklists"
_ -> Left $ tshow status ++ " error while fetching checklist " ++ checklist

Expand All @@ -94,9 +94,9 @@ getLists board = do
timezone <- lift getCurrentTimeZone

case status of
200 -> case decodeStrict body of
Just raw -> fmap (trelloListsToLists timezone) <$> getChecklists raw
Nothing -> return $ Left parseError
200 -> case eitherDecodeStrict body of
Right raw -> fmap (trelloListsToLists timezone) <$> getChecklists raw
Left err -> return . Left $ parseError err
404 -> return . Left $ "Could not find Trello board " ++ board ++ ". Make sure the ID is correct"
401 -> return . Left $ "You do not have permission to view Trello board " ++ board
_ -> return . Left $ tshow status ++ " error. Cannot fetch from Trello."

0 comments on commit f69aea0

Please sign in to comment.