packages feed

haskellscript 0.1.2 → 0.2.0

raw patch · 2 files changed

+8/−3 lines, 2 files

Files

haskellscript.cabal view
@@ -1,5 +1,5 @@ name:                   haskellscript-version:                0.1.2+version:                0.2.0 synopsis:               Command line tool for running Haskell scripts with a hashbang. description:   This tool provides the ability to script in a shell with Haskell (including dependencies) the same way that has been possible with bash scripts or Python.
src/HaskellScript.hs view
@@ -89,14 +89,19 @@   let dependenciesHash = getDependenciesHash scriptDetails   let scriptHash = getContentHash scriptDetails   let scriptDir = homeDirectory </> ".haskellscript" </> dependenciesHash-  scriptDirExists <- lift $ doesDirectoryExist $ scriptDir-  unless scriptDirExists $ do+  let dependenciesMarker = scriptDir </> ".dependencieswritten"+  dependenciesMarkerExists <- lift $ doesFileExist $ dependenciesMarker+  unless dependenciesMarkerExists $ do+    -- Remove the directory first.+    lift $ removeDirectoryRecursive scriptDir     -- Create hashed path directory.     lift $ createDirectoryIfMissing True scriptDir     -- Init sandbox in directory.     runInWorkingDir scriptDir "cabal" ["sandbox", "init"]     -- For each dependency install it into the sandbox.     traverse (\dep -> runInWorkingDir scriptDir "cabal" ["install", (unpack dep)]) (scriptDependencies scriptDetails)+    -- Write file to confirm dependencies have been written.+    lift $ TIO.writeFile dependenciesMarker mempty     return ()   let scriptLocation = scriptDir </> scriptHash <.> "hs"   -- Create a file containing the code.