packdeps 0.0.2.1 → 0.0.3
raw patch · 4 files changed
+65/−46 lines, 4 filesdep ~hamletdep ~timedep ~yesod
Dependency ranges changed: hamlet, time, yesod, yesod-newsfeed
Files
- Distribution/PackDeps.hs +1/−1
- packdeps-cli.hs +8/−2
- packdeps-yesod.hs +23/−19
- packdeps.cabal +33/−24
Distribution/PackDeps.hs view
@@ -81,7 +81,7 @@ addPackage :: Newest -> Tar.Entry -> Newest addPackage m entry =- case splitOn "/" $ Tar.entryPath entry of+ case splitOn "/" $ Tar.fromTarPathToPosixPath (Tar.entryTarPath entry) of [package', versionS, _] -> case simpleParse versionS of Just version ->
packdeps-cli.hs view
@@ -1,5 +1,6 @@ import Distribution.PackDeps import System.Environment (getArgs)+import System.Exit (exitFailure, exitSuccess) import Distribution.Text (display) import Distribution.Package (PackageName (PackageName)) @@ -14,14 +15,15 @@ case mdi of Just di -> return di Nothing -> error $ "Could not parse cabal file: " ++ fp- case checkDeps newest di of- (pn, v, AllNewest) ->+ allGood <- case checkDeps newest di of+ (pn, v, AllNewest) -> do putStrLn $ concat [ unPackageName pn , "-" , display v , ": Can use newest versions of all dependencies" ]+ return True (pn, v, WontAccept p _) -> do putStrLn $ concat [ unPackageName pn@@ -30,7 +32,11 @@ , ": Cannot accept the following packages" ] flip mapM_ p $ \(x, y) -> putStrLn $ x ++ " " ++ y+ return False putStrLn ""+ if allGood+ then exitSuccess+ else exitFailure unPackageName :: PackageName -> String unPackageName (PackageName n) = n
packdeps-yesod.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE QuasiQuotes, TypeFamilies, OverloadedStrings, MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} import Yesod-import Yesod.Helpers.AtomFeed-import Yesod.Helpers.Feed+import Yesod.AtomFeed+import Yesod.Feed import Distribution.PackDeps import Data.Maybe import Data.List (sortBy)@@ -15,10 +15,9 @@ import qualified Data.Map as Map import qualified Data.ByteString.Char8 as S8 import Data.Text (Text, pack, unpack)-import Text.Hamlet.NonPoly (html)+import Text.Hamlet (shamlet) data PD = PD Newest Reverses-type Handler = GHandler PD PD mkYesod "PD" [$parseRoutes| /favicon.ico FaviconR GET / RootR GET@@ -65,7 +64,7 @@ getRootR = defaultLayout $ do setTitle "Hackage dependency monitor" addCassius mainCassius- [$hamlet|\+ [whamlet| <h1>Hackage Dependency Monitor <form action="@{FeedR}"> <input type="text" name="needle" required="" placeholder="Search string">@@ -94,9 +93,12 @@ $ mapMaybe (go . checkDeps newest) descs return deps +instance RenderMessage PD FormMessage where+ renderMessage _ _ = defaultFormMessage+ getFeedR :: Handler RepHtml getFeedR = do- needle <- runFormGet' $ stringInput "needle"+ needle <- runInputGet $ ireq textField "needle" deps <- getDeps $ unpack needle let title = "Newer dependencies for " ++ unpack needle defaultLayout $ do@@ -119,10 +121,10 @@ |] let feedR = Feed2R needle atomLink feedR title- [$hamlet|\+ [whamlet| <h1>#{title} <p>- \The following are the packages which have restrictive upper bounds. You can also + \The following are the packages which have restrictive upper bounds. You can also # <a href="@{feedR}">view this information as a news feed \ so you can get automatic updates in your feed reader of choice. $if null deps@@ -155,7 +157,7 @@ { feedEntryLink = Feed3R needle (pack name) (pack $ display version) (pack $ show time) , feedEntryUpdated = time , feedEntryTitle = pack $ "Outdated dependencies for " ++ name ++ " " ++ display version- , feedEntryContent = [$hamlet|+ , feedEntryContent = [shamlet| <table border="1"> $forall d <- deps <tr>@@ -204,10 +206,10 @@ |] let feedR = SpecificFeedR $ pack $ unwords $ map unpack packages' atomLink feedR title- [$hamlet|\+ [whamlet| <h1>#{title} <p>- \The following are the packages which have restrictive upper bounds. You can also + The following are the packages which have restrictive upper bounds. You can also # <a href="@{feedR}">view this information as a news feed \ so you can get automatic updates in your feed reader of choice. $forall p <- packages@@ -247,7 +249,7 @@ { feedEntryLink = Feed3R packages' (pack name) (pack $ display version) (pack $ show time) , feedEntryUpdated = time , feedEntryTitle = pack $ "Outdated dependencies for " ++ name ++ " " ++ display version- , feedEntryContent = [$hamlet|\+ , feedEntryContent = [shamlet| <table border="1"> $forall d <- deps <tr>@@ -291,20 +293,22 @@ PD _ reverse <- getYesod (version, rels) <- maybe notFound return $ Map.lookup (unpack dep) reverse defaultLayout $ do- setTitle [html|Reverse dependencies for #{dep}|]+ setTitle [shamlet|Reverse dependencies for #{dep}|] addCassius mainCassius- addHamlet [$hamlet|-<h1>Reverse dependencies for #{dep} #{display version}+ addHamlet [hamlet|+<h1>#{show $ length rels} reverse dependencies for #{dep} #{display version} <table> <tr> <th>Package <th>Uses current version? $forall rel <- rels <tr>- <td- <a href=@{ReverseR $ pack $ fst rel}>#{fst rel}+ $if Map.member (fst rel) reverse+ <td><a href=@{ReverseR $ pack $ fst rel}>#{fst rel}+ $else+ <td>#{fst rel} $if withinRange version (snd rel)- <td>Yes+ <td>#{display (snd rel)} $else- <td style="color:#900">No (#{display (snd rel)})+ <td style="background-color:#fbb">#{display (snd rel)} |]
packdeps.cabal view
@@ -1,5 +1,5 @@ name: packdeps-version: 0.0.2.1+version: 0.0.3 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -16,43 +16,52 @@ homepage: http://packdeps.haskellers.com/ flag web+ description: Build the web-based interface.+ manual: True library if flag(web) Buildable: False- build-depends: base >= 4 && < 5- , tar >= 0.3.1 && < 0.4- , split >= 0.1.2.3 && < 0.2- , bytestring >= 0.9 && < 0.10- , text >= 0.7 && < 0.12- , Cabal >= 1.8 && < 1.13- , time >= 1.1.4 && < 1.4- , containers >= 0.2 && < 0.5- , directory >= 1.0 && < 1.2- , filepath >= 1.1 && < 1.3- exposed-modules: Distribution.PackDeps- ghc-options: -Wall+ else+ build-depends: base >= 4 && < 5+ , tar >= 0.3.1 && < 0.4+ , split >= 0.1.2.3 && < 0.2+ , bytestring >= 0.9 && < 0.10+ , text >= 0.7 && < 0.12+ , Cabal >= 1.8 && < 1.13+ , time >= 1.1.4+ , containers >= 0.2 && < 0.5+ , directory >= 1.0 && < 1.2+ , filepath >= 1.1 && < 1.3+ exposed-modules: Distribution.PackDeps+ ghc-options: -Wall executable packdeps+ main-is: packdeps-cli.hs+ if flag(web) Buildable: False- ghc-options: -Wall- main-is: packdeps-cli.hs+ else+ ghc-options: -Wall executable packdeps-yesod- if !flag(web)- Buildable: False- ghc-options: -Wall main-is: packdeps-yesod.hs -executable save-newest- if !flag(web)+ if flag(web)+ ghc-options: -Wall+ else Buildable: False- ghc-options: -Wall++executable save-newest main-is: save-newest.hs- build-depends: yesod-newsfeed == 0.1.*- , yesod == 0.8.*- , hamlet == 0.8.*++ if flag(web)+ ghc-options: -Wall+ build-depends: yesod-newsfeed == 0.3.*+ , yesod == 0.9.*+ , hamlet == 0.10.*+ else+ Buildable: False source-repository head type: git