brok 0.1.6.0 → 0.1.7.0
raw patch · 7 files changed
+30/−21 lines, 7 filesdep ~ansi-terminaldep ~attoparsecdep ~file-embedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ansi-terminal, attoparsec, file-embed, http-client, http-conduit, tasty, tasty-expected-failure, tasty-hunit
API changes (from Hackage documentation)
Files
- brok.cabal +11/−11
- src/Brok.hs +2/−2
- src/Brok/IO/DB.hs +1/−1
- src/Brok/IO/Output.hs +4/−4
- src/Brok/Parser/Links.hs +2/−2
- src/Brok/Types/Result.hs +1/−1
- test/Parser/LinksTest.hs +9/−0
brok.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: brok-version: 0.1.6.0+version: 0.1.7.0 license: BSD3 license-file: LICENSE copyright: 2019 Small Hadron Collider@@ -44,14 +44,14 @@ default-language: Haskell2010 default-extensions: OverloadedStrings NoImplicitPrelude build-depends:- ansi-terminal >=0.8.2 && <0.9,- attoparsec >=0.13.2.2 && <0.14,+ ansi-terminal >=0.9.1 && <0.10,+ attoparsec >=0.13.2.3 && <0.14, base >=4.7 && <5, classy-prelude >=1.5.0 && <1.6, directory >=1.3.3.0 && <1.4,- file-embed >=0.0.11 && <0.1,- http-client >=0.5.14 && <0.6,- http-conduit >=2.3.5 && <2.4,+ file-embed >=0.0.11.1 && <0.1,+ http-client >=0.6.4 && <0.7,+ http-conduit >=2.3.7.3 && <2.4, text >=1.2.3.1 && <1.3, time >=1.8.0.2 && <1.9 @@ -67,7 +67,7 @@ base >=4.7 && <5, brok -any, classy-prelude >=1.5.0 && <1.6,- file-embed >=0.0.11 && <0.1+ file-embed >=0.0.11.1 && <0.1 test-suite brok-test type: exitcode-stdio-1.0@@ -86,8 +86,8 @@ base >=4.7 && <5, brok -any, classy-prelude >=1.5.0 && <1.6,- file-embed >=0.0.11 && <0.1,- tasty ==1.2.*,+ file-embed >=0.0.11.1 && <0.1,+ tasty >=1.2.3 && <1.3, tasty-discover >=4.2.1 && <4.3,- tasty-expected-failure >=0.11.1.1 && <0.12,- tasty-hunit >=0.10.0.1 && <0.11+ tasty-expected-failure >=0.11.1.2 && <0.12,+ tasty-hunit >=0.10.0.2 && <0.11
src/Brok.hs view
@@ -28,7 +28,7 @@ go config -- read files = do- content <- sequence (readContent . pathToResult <$> C.files config)+ content <- traverse (readContent . pathToResult) (C.files config) -- find links in each file let parsed = parseLinks links <$> content -- check cached successes@@ -37,7 +37,7 @@ -- check links in each file header "Checking URLs" putStrLn ""- checked <- sequence (linkIOMap (check (C.interval config)) <$> uncached)+ checked <- traverse (linkIOMap (check (C.interval config))) uncached replace "Fetching complete" -- display results putStrLn ""
src/Brok/IO/DB.hs view
@@ -40,7 +40,7 @@ setCached Nothing _ = return () setCached (Just age) links = do current <- load age- stamped <- sequence (stamp <$> links)+ stamped <- traverse stamp links write $ current ++ stamped -- read db
src/Brok/IO/Output.hs view
@@ -46,22 +46,22 @@ if anyErrs then do errorMessage $ outputPath path- sequence_ $- linkOutput <$>+ traverse_+ linkOutput (if onlyFailures then errs else links) else unless onlyFailures $ do message $ outputPath path if not (null links)- then sequence_ $ linkOutput <$> links+ then traverse_ linkOutput links else putStrLn "- No links found in file" return anyErrs outputMap _ _ = return False output :: Bool -> [Result] -> IO Bool output onlyFailures results = do- errs <- sequence $ outputMap onlyFailures <$> results+ errs <- traverse (outputMap onlyFailures) results let anyErrs = foldl' (||) False errs when (not anyErrs && onlyFailures) $ successMessage "All links working" return anyErrs
src/Brok/Parser/Links.hs view
@@ -31,7 +31,7 @@ -- urls part :: String -> Parser Text-part str = concat <$> many' (parens (part str) <|> manyChars (chars str))+part str = concat <$> many1 (parens (part str) <|> manyChars (chars str)) query :: Parser Text query = (++) <$> string "?" <*> part queryBodyChars@@ -42,7 +42,7 @@ option "" query noise :: Parser Token-noise = anyChar >> return Nothing+noise = anyChar $> Nothing urls :: Parser [URL] urls = nub . catMaybes <$> many1 ((Just <$> url) <|> noise)
src/Brok/Types/Result.hs view
@@ -55,7 +55,7 @@ ignoredLinks = findLinks ignoredLink linkIOMap :: (Link -> IO Link) -> Result -> IO Result-linkIOMap fn (Result path (Links links)) = Result path . Links <$> sequence (lmap fn <$> links)+linkIOMap fn (Result path (Links links)) = Result path . Links <$> traverse (lmap fn) links linkIOMap _ result = return result justLinks :: Result -> [Link]
test/Parser/LinksTest.hs view
@@ -165,5 +165,14 @@ ]) (links tex)) ]+ , testGroup+ "just protocol"+ [ testCase+ "https://"+ (assertEqual "Gives back empty list" (Right []) (links "https://"))+ , testCase+ "http://"+ (assertEqual "Gives back empty list" (Right []) (links "http://"))+ ] , testCase "nothing" (assertEqual "Gives back empty list" (Right []) (links "")) ]