Browse Source

Remove unnecessary dependency, add log of PRs opened

pull/8/head
Wesley Kerfoot 6 years ago
parent
commit
95c5d5c027
  1. 3
      pullwatch.cabal
  2. 10
      src/PullWatch/PullWatch.hs

3
pullwatch.cabal

@ -37,7 +37,6 @@ library
, base-compat , base-compat
, text , text
, bytestring , bytestring
, libiserv
, vector , vector
, async , async
, containers , containers
@ -59,7 +58,6 @@ executable pullwatch-exe
, base-compat , base-compat
, text , text
, bytestring , bytestring
, libiserv
, vector , vector
, async , async
, containers , containers
@ -82,7 +80,6 @@ test-suite pullwatch-test
, base-compat , base-compat
, text , text
, bytestring , bytestring
, libiserv
, vector , vector
, async , async
, containers , containers

10
src/PullWatch/PullWatch.hs

@ -65,7 +65,7 @@ getPRTitle = Just . simplePullRequestTitle . (! 0)
getPRBody = simplePullRequestBody . (! 0) getPRBody = simplePullRequestBody . (! 0)
-- Converts a pull request into a dbus notification -- Converts a pull request into a dbus notification
toNote :: PullWatch.PullWatch.PullRequest -> Note toNote :: PullRequest -> Note
toNote pr = toNote pr =
blankNote { blankNote {
@ -74,13 +74,16 @@ toNote pr =
, appImage = (Just $ Icon "dialog-information") , appImage = (Just $ Icon "dialog-information")
} }
notifyPR client pr = notify client pr
notifyPR client pr = (print $ (summary pr) ++ " was opened") >>
notify client pr
getLatest :: (?pat :: (Maybe Auth.Auth)) => getLatest :: (?pat :: (Maybe Auth.Auth)) =>
(PR.Name PR.Owner) -> (PR.Name PR.Owner) ->
(PR.Name PR.Repo) -> (PR.Name PR.Repo) ->
IO (Maybe PullRequest) IO (Maybe PullRequest)
-- TODO fix this crap
getLatest owner repo = do getLatest owner repo = do
prs <- PR.pullRequestsFor' ?pat owner repo prs <- PR.pullRequestsFor' ?pat owner repo
let pr = case prs of let pr = case prs of
@ -106,7 +109,6 @@ monitorPRs :: (?pat :: (Maybe Auth.Auth)) =>
Maybe PullRequests -> Maybe PullRequests ->
[(PR.Name PR.Owner, PR.Name PR.Repo)] -> [(PR.Name PR.Owner, PR.Name PR.Repo)] ->
IO () IO ()
monitorPRs previous repos = do monitorPRs previous repos = do
currentPRs <- getLatestPRs repos currentPRs <- getLatestPRs repos
client <- connectSession client <- connectSession
@ -125,7 +127,7 @@ monitorPRs previous repos = do
threadDelay tenMinutes threadDelay tenMinutes
monitorPRs currentPRs repos monitorPRs currentPRs repos
-- Helpers functions for converting to an IntMap -- Helper functions for converting to an IntMap
prToTuple :: PullRequest -> (Int, PullRequest) prToTuple :: PullRequest -> (Int, PullRequest)
prToTuple pr = (fromIntegral $ prID pr, pr) prToTuple pr = (fromIntegral $ prID pr, pr)

Loading…
Cancel
Save