hpack 0.17.0 → 0.17.1
raw patch · 4 files changed
+23/−14 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hpack.cabal +3/−3
- src/Hpack/Config.hs +1/−1
- src/Hpack/Util.hs +4/−4
- test/Hpack/UtilSpec.hs +15/−6
hpack.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.15.0.+-- This file has been generated from package.yaml by hpack version 0.17.0. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.17.0+version: 0.17.1 synopsis: An alternative format for Haskell packages description: See README at <https://github.com/sol/hpack#readme> category: Development@@ -76,7 +76,7 @@ main-is: Spec.hs hs-source-dirs: test- , src+ src ghc-options: -Wall cpp-options: -DTEST build-depends:
src/Hpack/Config.hs view
@@ -792,7 +792,7 @@ if exists then do src <- canonicalizePath (dir </> src_)- removeSetup src . toModules <$> getFilesRecursive src+ removeSetup src . toModules <$> getModuleFilesRecursive src else return [] where toModules :: [[FilePath]] -> [String]
src/Hpack/Util.hs view
@@ -8,7 +8,7 @@ , LdOption , parseMain , toModule-, getFilesRecursive+, getModuleFilesRecursive , tryReadFile , expandGlobs , sort@@ -84,13 +84,13 @@ stripSuffix :: String -> String -> Maybe String stripSuffix suffix x = reverse <$> stripPrefix (reverse suffix) (reverse x) -getFilesRecursive :: FilePath -> IO [[String]]-getFilesRecursive baseDir = go []+getModuleFilesRecursive :: FilePath -> IO [[String]]+getModuleFilesRecursive baseDir = go [] where go :: [FilePath] -> IO [[FilePath]] go dir = do c <- map ((dir ++) . return) . filter (`notElem` [".", ".."]) <$> getDirectoryContents (pathTo dir)- subdirsFiles <- filterM (doesDirectoryExist . pathTo) c >>= mapM go+ subdirsFiles <- filterM (doesDirectoryExist . pathTo) c >>= mapM go . filter isModule files <- filterM (doesFileExist . pathTo) c return (files ++ concat subdirsFiles) where
test/Hpack/UtilSpec.hs view
@@ -49,18 +49,27 @@ it "rejects invalid module names" $ do toModule ["resources", "hello.hs"] `shouldBe` Nothing - describe "getFilesRecursive" $ do- it "gets all files from given directory and all its subdirectories" $ do- inTempDirectoryNamed "test" $ do+ describe "getModuleFilesRecursive" $ do+ it "gets all files from given directory" $ do+ inTempDirectory $ do touch "foo/bar" touch "foo/baz"- touch "foo/foobar/baz"- actual <- getFilesRecursive "foo"+ actual <- getModuleFilesRecursive "foo" actual `shouldMatchList` [ ["bar"] , ["baz"]- , ["foobar", "baz"] ]++ it "descends into subdirectories" $ do+ inTempDirectory $ do+ touch "foo/Bar/baz"+ getModuleFilesRecursive "foo" `shouldReturn` [["Bar", "baz"]]++ context "when a subdirectory is not a valid module name" $ do+ it "does not descend" $ do+ inTempDirectory $ do+ touch "foo/bar/baz"+ getModuleFilesRecursive "foo" `shouldReturn` empty describe "List" $ do let invalid = [aesonQQ|{