packages feed

persistent-discover 0.1.0.3 → 0.1.0.4

raw patch · 4 files changed

+28/−10 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -2,6 +2,11 @@  ## Unreleased changes +## 0.1.0.4++- Fix a bug where non-Haskell files would be picked up and imported in the+  generated file. [#]()+ ## 0.1.0.3  - Remove embarrasing lib module.
persistent-discover.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 6d2dc6102b0f263435cf1bacdc2fc42faaa6e8924391f1a49cfd72f806950dbc+-- hash: 02c55b7bab0afd35d762f5a1f8f30fbab6f0b6c13966145570b5572c2773bdc5  name:           persistent-discover-version:        0.1.0.3+version:        0.1.0.4 synopsis:       Persistent module discover utilities description:    This package provides an executable for discovering Persistent model definition files, as well as a library function to glob all persistent model files. Please see the README on GitHub at <https://github.com/parsonsmatt/persistent-discover#readme> category:       Web
src/Database/Persist/Discover/Exe.hs view
@@ -170,21 +170,26 @@ mkModulePieces     :: FilePath     -> [String]-mkModulePieces fp =-    fmap dropSuffixes $ reverse $ takeWhile (not . isLowerFirst) $ reverse $ filter noDots $ splitDirectories fp+mkModulePieces fp = do+    let+        extension =+            takeExtension fp+    guard (extension == ".hs" || extension == ".lhs")+    reverse+        . takeWhile (not . isLowerFirst)+        . reverse+        . filter noDots+        . splitDirectories+        . dropExtension+        $ fp   where     noDots x =         "." /= x && ".." /= x-    dropSuffixes str =-        fromMaybe str-            $ stripSuffix ".hs" str-            <|> stripSuffix ".lhs" str  isLowerFirst :: String -> Bool isLowerFirst [] = True isLowerFirst (c:_) = isLower c - pathToModule     :: FilePath     -> Maybe Module@@ -192,7 +197,8 @@     case mkModulePieces file of         [] ->             empty-        x:xs ->  do+        x : xs ->  do+            guard $ all isValidModuleName (x : xs)             pure (Module (intercalate "." (x:xs)) file)  -- | Returns True if the given string is a valid task module name.
test/Database/Persist/Discover/ExeSpec.hs view
@@ -34,6 +34,13 @@                 `shouldBe`                     ["Foo", "Bar"] +        it "does not eat non-hs files" do+            let+                mdFile =+                    "src/Foo/README.md"+            mkModulePieces mdFile+                `shouldBe`+                    []      describe "pathToModule" do         let