shikensu 0.2.1 → 0.3.0
raw patch · 4 files changed
+42/−8 lines, 4 filesdep ~aesondep ~directoryPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, directory
API changes (from Hackage documentation)
- Shikensu.Types: instance Data.Aeson.Types.Class.ToJSON Shikensu.Types.Definition
+ Shikensu: listRelative :: [Pattern] -> FilePath -> IO Dictionary
+ Shikensu: listRelativeF :: FilePath -> [Pattern] -> IO Dictionary
+ Shikensu.Types: instance Data.Aeson.Types.ToJSON.ToJSON Shikensu.Types.Definition
Files
- shikensu.cabal +3/−3
- src/Shikensu.hs +19/−2
- src/Shikensu/Utilities.hs +2/−2
- tests/Test/Shikensu.hs +18/−1
shikensu.cabal view
@@ -1,5 +1,5 @@ name: shikensu-version: 0.2.1+version: 0.3.0 category: File IO synopsis:@@ -47,10 +47,10 @@ Shikensu.Utilities build-depends:- aeson == 0.11.*,+ aeson == 1.0.*, base == 4.*, bytestring == 0.10.*,- directory >= 1.2.6 && < 2,+ directory == 1.3.*, filepath == 1.4.*, flow == 1.0.*, Glob == 0.7.*,
src/Shikensu.hs view
@@ -6,6 +6,8 @@ module Shikensu ( list , listF+ , listRelative+ , listRelativeF , forkDefinition , makeDefinition@@ -19,6 +21,7 @@ import qualified Data.HashMap.Strict as HashMap (empty) import qualified Data.List as List (concat, map, zip)+import qualified System.Directory as Dir (canonicalizePath) @@ -48,8 +51,22 @@ {-| Flipped version of `list`. -} listF :: FilePath -> [Pattern] -> IO Dictionary-listF rootDir patterns =- list patterns rootDir+listF = flip list+++{-| Same as `list`, but given a relative directory.++> listRelative ["*.md"] ./articles+-}+listRelative :: [Pattern] -> FilePath -> IO Dictionary+listRelative patterns relativePath =+ Dir.canonicalizePath relativePath >>= list patterns+++{-| Flipped version `listRelative`.+-}+listRelativeF :: FilePath -> [Pattern] -> IO Dictionary+listRelativeF = flip listRelative
src/Shikensu/Utilities.hs view
@@ -39,8 +39,8 @@ {-| One way to deal with multiple dictionaries. > lsequence-> [ ( "pages", Shikensu.list rootDir ["src/pages/**/*.html"] )-> , ( "js", Shikensu.list rootDir ["src/javascript/**/*.js"] )+> [ ( "pages", Shikensu.list ["src/pages/**/*.html"] rootDir )+> , ( "js", Shikensu.list ["src/javascript/**/*.js"] rootDir ) > ] From multiple IO monads to a single IO monad.
tests/Test/Shikensu.hs view
@@ -12,7 +12,7 @@ shikensuTests :: TestTree shikensuTests = testGroup "Shikensu tests"- [testRegular, testDot, testWithoutWd, testRootFile]+ [testRegular, testDot, testWithoutWd, testRootFile, testRelative] @@ -137,4 +137,21 @@ , testCase "Should have the correct workingDirname" $ definition `rmap` Shikensu.workingDirname >>= assertEq "" + ]+++testRelative :: TestTree+testRelative =+ let+ pattern = "*.md"+ dictionary = fmap sort $ Shikensu.listRelative [pattern] "./"+ definition = fmap List.head dictionary+ localPath = "CHANGELOG.md"+ in+ testGroup "Test relative"+ [ testCase "Should have the correct rootDirname"+ $ definition `rmap` Shikensu.rootDirname >>= (\x -> rootPath >>= assertEq x)++ , testCase "Should have the correct localPath"+ $ definition `rmap` Shikensu.localPath >>= assertEq localPath ]