packages feed

cabalg 0.2.7 → 0.2.8

raw patch · 6 files changed

+117/−32 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ CHANGELOG.markdown view
@@ -0,0 +1,69 @@+0.2.8+=====++  * Respect `$TMPDIR` and `$TEMP` environment variables++0.2.7+=====++  * Add `--help` and `--version` command line options++  * Bug fixed: download the default upstream branch unless another one is explicitly provided+    https://github.com/dmalikov/cabalg/issues/5+++0.2.6+=====++  * Display progress incrementally during install by allowing standard handles to inherit (@cpennington)++0.2.5+=====++  * Print cabal logs to the output++0.2.4+=====++  * Bug fixed: internal `git checkout` producing redundant copy of git repository+    https://github.com/dmalikov/cabalg/issues/3+++0.2.3+=====++  * All non-base dependencies are dropped+  * `7.2`, `7.4`, `7.6`, `7.8` are supported++0.2.2+=====++  * Select `*.cabal` files found only with depth 1++0.2.1+=====++  * Get rid of `temporary` dependency++0.2.0+=====++  * Remove cabal sandbox support++  * Handle multiple number of git repository at once++  * Cloning repo in a current directory++  * Cmd line arguments are interpreting like `<repo1> ... <repoN> [-- <cabal-install flags>]`++  * Remove `--branch <branch_name>` flag++  * Add syntax to mentioning revisions like `https://<repourl>@<revision>`++0.1.2+=====+  Initial version introduced:++  * Cloning repo into a temporary directory according to `System.FilePath.getTemporaryDirectory`++  * Cabal sandbox support
cabalg.cabal view
@@ -1,5 +1,5 @@ name: cabalg-version: 0.2.7+version: 0.2.8 synopsis: alias for cabal install from given git repo license: MIT license-file: LICENSE@@ -35,6 +35,9 @@   Please notice, that '--single-branch' flag  comes with git-1.7.10 (<https://lkml.org/lkml/2012/3/28/418>) and later, so you probably want to have it.   .   It's supposed to be Windows-compatible (not sure about the tests)++extra-source-files:+  CHANGELOG.markdown  executable cabalg   main-is: Main.hs
src/Args.hs view
@@ -1,6 +1,6 @@ module Args where -import Control.Arrow (second)+import           Control.Arrow (second)  data Action   = Help
src/Main.hs view
@@ -1,17 +1,21 @@-import Control.Applicative-import Control.Monad-import Data.List-import Data.Maybe-import Data.Version (showVersion)-import Paths_cabalg (version)-import System.Directory-import System.Environment-import System.FilePath-import System.Process+import           Control.Applicative+import           Control.Exception+import           Control.Monad+import           Data.Foldable+import           Data.List+import           Data.Maybe+import           Data.Traversable+import           Data.Version                 (showVersion)+import           Paths_cabalg                 (version)+import           System.Directory+import           System.Environment+import           System.FilePath+import           System.IO.Error+import           System.Process -import Args-import Git-import System.Directory.NonExistent+import           Args+import           Git+import           System.Directory.NonExistent   main :: IO ()@@ -21,14 +25,14 @@     Help -> printHelp     Version -> putStrLn $ showVersion version     Install repos args -> do-      cabalFiles <- mapM fetch repos+      cabalFiles <- Data.Traversable.mapM fetch repos       cabalInstall (catMaybes cabalFiles) args   fetch :: String -> IO (Maybe FilePath) fetch urlAndMaybeRevision = do-  currentDir <- getCurrentDirectory-  newDir <- createNonExistentDirectory currentDir ("cabalg_" ++ repoName urlAndMaybeRevision)+  dir <-  getWorkingDirectory+  newDir <- createNonExistentDirectory dir ("cabalg_" ++ repoName urlAndMaybeRevision)   case maybeRevision of     Just revision -> cloneRevision url revision newDir     Nothing -> clone url newDir@@ -40,6 +44,19 @@       url = takeWhile (/= '@') urlAndMaybeRevision  +getWorkingDirectory :: IO FilePath+getWorkingDirectory =+  liftM2 fromMaybe getCurrentDirectory . fmap Data.Foldable.msum . traverse lookupEnv' $ ["TMPDIR", "TEMP"]+++lookupEnv' :: String -> IO (Maybe String)+lookupEnv' var = do+  fmap eitherToMaybe . tryJust (guard . isDoesNotExistError) $ getEnv var+ where+  eitherToMaybe (Left  _) = Nothing+  eitherToMaybe (Right x) = Just x++ cabalInstall :: [String] -> Maybe String -> IO () cabalInstall cabalFiles args = do   let process = proc "cabal" ("install" : cabalFiles ++ words (fromMaybe "" args))@@ -58,4 +75,4 @@   findCabalFile :: FilePath -> IO (Maybe FilePath)-findCabalFile path = ((path </>) `fmap`) `fmap` find (".cabal" `isSuffixOf`) `fmap` getDirectoryContents path+findCabalFile path = ((path </>) `fmap`) `fmap` Data.List.find (".cabal" `isSuffixOf`) `fmap` getDirectoryContents path
src/System/Directory/NonExistent.hs view
@@ -1,7 +1,7 @@ module System.Directory.NonExistent where -import System.FilePath-import System.Directory+import           System.Directory+import           System.FilePath  -- | create non existent directory appending a number to the end of the name createNonExistentDirectory :: FilePath -> String -> IO FilePath
test/Test.hs view
@@ -1,11 +1,9 @@ module Main where -import Control.Monad-import System.Directory-import System.FilePath-import System.Process--import System.Directory.NonExistent+import           Control.Monad+import           System.Directory+import           System.FilePath+import           System.Process   main :: IO ()@@ -15,17 +13,15 @@   case exec of     Nothing -> error "unable to find cabalg executable in dist/build"     Just cabalg -> do-      tmpDir <- createNonExistentDirectory currentDir "cabalgtest"-      setCurrentDirectory tmpDir       void $ readProcess cabalg ["https://github.com/dmalikov/dotfiles@master", "https://github.com/biegunka/biegunka@develop"] []       setCurrentDirectory currentDir   findExecutableCabalg :: FilePath -> IO (Maybe FilePath) findExecutableCabalg dir = do-  exists <- doesFileExist executable+  exists <- doesFileExist executable'   if (exists)-    then return $ Just $ executable+    then return $ Just $ executable'     else return Nothing  where-  executable = dir </> "dist" </> "build" </> "cabalg" </> "cabalg"+  executable' = dir </> "dist" </> "build" </> "cabalg" </> "cabalg"