packages feed

git-vogue 0.2.0.0 → 0.2.0.1

raw patch · 4 files changed

+36/−34 lines, 4 filesdep −list-triesPVP ok

version bump matches the API change (PVP)

Dependencies removed: list-tries

API changes (from Hackage documentation)

Files

+ changelog.txt view
@@ -0,0 +1,15 @@+2015-01-30 v0.2.0.1 Christian Marie <christian@ponies.io>+	* dependencies: Drop list-tries dependency++2015-01-21 v0.2.0.0 Christian Marie <christian@ponies.io>+	* plugins: All plugins now support multiple repositories+	* plugins: Output is formatted and streamed as it is generated+	* git-vogue: Provide interface for plugin enabling/disabling+	* git-vogue: Modular VCS architecture introduced+	* git-vogue: Allow checking of a single file via git-vogue check file++2015-01-05 v0.1.0.4 Christian Marie <christian@ponies.io>+	* plugins: Allow disabling of plugins via git config++2015-01-05 v0.1.0.3 Christian Marie <christian@ponies.io>+	* Initial public release
git-vogue.cabal view
@@ -1,5 +1,5 @@ name:                git-vogue-version:             0.2.0.0+version:             0.2.0.1 synopsis:            A framework for pre-commit checks. description:         Make your Haskell git repositories fashionable. homepage:            https://github.com/anchor/git-vogue@@ -10,7 +10,7 @@ copyright:           (c) 2015 Anchor Systems, Pty Ltd and Others category:            Development build-type:          Custom-extra-source-files:  README.md+extra-source-files:  README.md, changelog.txt cabal-version:       >=1.10 data-files:          templates/pre-commit @@ -36,7 +36,6 @@                      , filepath                      , process                      , containers-                     , list-tries                      , formatting                      , split                      , text
lib/Git/Vogue/PluginCommon.hs view
@@ -37,18 +37,15 @@ import           Data.Char import           Data.Functor import           Data.List-import           Data.Map.Strict               (Map)-import qualified Data.Map.Strict               as M+import           Data.Map.Strict        (Map)+import qualified Data.Map.Strict        as M import           Data.Maybe import           Data.Monoid+import           Data.Ord import           Options.Applicative import           System.Directory import           System.FilePath -import           Data.ListTrie.Patricia.Map.Eq (TrieMap, deleteSuffixes,-                                                fromList, lookupPrefix, toList)-import           Data.Ord- -- | The check went or is going well, this should make the developer happy outputGood :: MonadIO m => String -> m () outputGood = outputWithIcon "  \x1b[32m[+]\x1b[0m "@@ -143,38 +140,29 @@     -> [FilePath]     -> (Map FilePath [FilePath], [FilePath]) findProjects p xs =-        -- We start out by putting all of the files in a trie.-        ---        -- Note that we tack on a / for everything so that they share a common-        -- root node.-    let all_trie = unFlatten (fmap (splitPath . ('/':)) xs)+        -- We start out by putting all of the files in a nested list, splitting+        -- up the path.+    let all_paths = fmap (splitPath . ('/':)) xs          -- Now we find all of the project roots. Again tacking on the root so         -- that init is safe and everything lines up.         roots = sortBy (comparing length) . fmap (init . splitPath . ('/':)) $                     filter p xs -        -- Now iterate over the project roots, taking the chunks of the tree-        -- out that belong under that as we go. It's simpler than it looks.-        f x (rs, t) =-            (M.insertWith (<>)-                          (joinPath  $ tail x)-                          ((fmap (joinPath . tail) . flatten) (lookupPrefix x t))-                          rs-            , deleteSuffixes x t)-        (projects,remainder) = foldr f (mempty, all_trie) roots+        -- Now iterate over the project roots, taking the bits of the whole+        -- list as we go.+        f current_root (result, remaining) =+            let included = isPrefixOf current_root+                to_take  = filter included remaining+                to_leave = filter (not . included) remaining+            in ( M.insert (joinPath $ tail current_root) to_take result+               , to_leave) -    -- Now put the broken up paths back together and take the roots off.-    in (projects-       ,fmap (joinPath . tail) . flatten $ remainder)-  where-    -- Stuff a list of keys into a trie with dummy values.-    unFlatten :: Eq k => [[k]] -> TrieMap k ()-    unFlatten = fromList . fmap (,())+        (projects, remainder) = foldr f (mempty, all_paths) roots -    -- Extract a list of keys from a trie, throwing away the values.-    flatten :: Eq k => TrieMap k a -> [[k]]-    flatten = fmap fst . toList+    -- Now put the broken up paths back together and take the roots off.+    in ((fmap . fmap) (joinPath . tail) projects+       , fmap (joinPath . tail) remainder)  -- | Parser for plugin arguments pluginCommandParser :: Parser PluginCommand
tests/unit.hs view
@@ -46,7 +46,7 @@                 let nested = ["a.cabal", "a.hs", "b/b.cabal", "b/b.hs"]                 join hsProjects nested `shouldBe`                     fromList [ ("",["a.cabal","a.hs"])-                             , ("b/",["b.hs","b.cabal"]) ]+                             , ("b/",["b.cabal", "b.hs"]) ]  testLEDiscovery :: FilePath -> PluginDiscoverer IO -> Spec testLEDiscovery fixtures PluginDiscoverer{..} = do