packages feed

project-template 0.2.0.1 → 0.2.1.0

raw patch · 4 files changed

+22/−4 lines, 4 filesdep ~base

Dependency ranges changed: base

Files

ChangeLog.md view
@@ -1,3 +1,9 @@+# ChangeLog for project-template++## 0.2.1.0++* Support base64-bytestring 1.1.0.0 [#4](https://github.com/fpco/haskell-ide/issues/4)+ ## 0.2.0.1  * Use `throwM` instead of `monadThrow`
Text/ProjectTemplate.hs view
@@ -33,6 +33,7 @@                                                runConduit, (.|)) import qualified Data.Conduit.Binary          as CB import           Data.Conduit.List            (consume, sinkNull)+import           Conduit                      (concatMapC, chunksOfCE) import qualified Data.Conduit.List            as CL import qualified Data.Conduit.Text            as CT import           Data.Map                     (Map)@@ -57,7 +58,7 @@             yield "{-# START_FILE BASE64 "             yield $ encodeUtf8 $ T.pack fp             yield " #-}\n"-            yield $ B64.joinWith "\n" 76 $ B64.encode bs+            yield (B64.encode bs) .| chunksOfCE 76 .| concatMapC (\x -> [x, "\n"])             yield "\n"         Just _ -> do             yield "{-# START_FILE "
project-template.cabal view
@@ -1,5 +1,5 @@ name:                project-template-version:             0.2.0.1+version:             0.2.1.0 synopsis:            Specify Haskell project templates and generate files description:         See initial blog post for explanation: <http://www.yesodweb.com/blog/2012/09/project-templates> homepage:            https://github.com/fpco/haskell-ide@@ -9,10 +9,11 @@ maintainer:          michael@fpcomplete.com category:            Development build-type:          Simple-cabal-version:       >=1.8+cabal-version:       >=1.10 extra-source-files:  README.md ChangeLog.md  library+  default-language:    Haskell2010   exposed-modules:     Text.ProjectTemplate   build-depends:       base                         >= 4          && < 5                      , base64-bytestring@@ -29,6 +30,7 @@   ghc-options:     -Wall  test-suite test+    default-language:    Haskell2010     hs-source-dirs: test     main-is: Spec.hs     other-modules: Text.ProjectTemplateSpec
test/Text/ProjectTemplateSpec.hs view
@@ -31,10 +31,19 @@     describe "binaries" $ do         prop "works with multilines" $ \words' -> do             let bs = S.pack words'-                encoded = B64.joinWith "\n" 5 $ B64.encode bs+                encoded = joinWith "\n" 5 $ B64.encode bs                 content = "{-# START_FILE BASE64 foo #-}\n" `mappend` encoded             m <- execWriterT $ runConduit $ yield content .| unpackTemplate receiveMem id             Map.lookup "foo" m `shouldBe` Just (L.fromChunks [bs])++joinWith :: S.ByteString -> Int -> S.ByteString -> S.ByteString+joinWith joiner size = S.concat . map (`S.append` joiner) . chunksOf size++chunksOf :: Int -> S.ByteString -> [S.ByteString]+chunksOf _ bs | S.null bs = []+chunksOf size bs =+    let (x, y) = S.splitAt size bs+     in x : chunksOf size y  newtype Helper = Helper (Map.Map FilePath S.ByteString)     deriving (Show, Eq)