packages feed

shake-pack (empty) → 0.1.0

raw patch · 4 files changed

+87/−0 lines, 4 filesdep +basedep +bytestringdep +bzlibsetup-changed

Dependencies added: base, bytestring, bzlib, shake, tar

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2015, Luke Hoersten++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Luke Hoersten nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ shake-pack.cabal view
@@ -0,0 +1,29 @@+name:                shake-pack+version:             0.1.0+synopsis:            Shake File Pack Actions+description:         Shake rule for tar-ing and compressing files with bzip2.+                     Uses bz2 C library on the system.+homepage:            https://github.com/LukeHoersten/shake-pack+license:             BSD3+license-file:        LICENSE+author:              Luke Hoersten+maintainer:          luke@hoersten.org+category:            Shake, Development+build-type:          Simple+cabal-version:       >=1.10++library+  exposed-modules:     Development.Shake.Pack+  build-depends:       base >=4.7 && <4.8+                     , bytestring >= 0.10 && < 0.11+                     , bzlib      >= 0.5  && < 0.6+                     , shake      >= 0.14 && < 0.15+                     , tar        >= 0.4  && < 0.5++  hs-source-dirs:      src+  default-language:    Haskell2010+  ghc-options:        -Wall -fwarn-tabs++source-repository head+  type:     git+  location: git://github.com/LukeHoersten/shake-pack.git
+ src/Development/Shake/Pack.hs view
@@ -0,0 +1,26 @@+-- | Pack given files into the target with tar and bzip. Uses bz2 C library on the system.+--+-- @+-- main :: IO ()+-- main = shakeArgs shakeOptions $ do+--     want ["pack.tar.bz2"]+--     "pack.tar.bz2" *> pack ["ex.txt", "ex2.txt"]+-- @++module Development.Shake.Pack where++import qualified Codec.Archive.Tar      as Tar+import qualified Codec.Compression.BZip as BZip+import qualified Data.ByteString.Lazy   as BS+import           Development.Shake      (Action, liftIO, need)+++-- | Pack files into a tar then compress with bzip. For static files,+-- be sure to use `Development.Shake.getDirectoryFiles` to track file+-- changes.+pack :: [FilePath] -- ^ Files to be included in package.+     -> FilePath   -- ^ Resulting package file name including extension. (ex: @"package.tar.bz2"@)+     -> Action ()+pack assets package = do+    need assets+    liftIO $ BS.writeFile package . BZip.compress . Tar.write =<< Tar.pack "" assets