cabal-meta 0.4.1.2 → 0.4.1.3
raw patch · 3 files changed
+29/−26 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- CabalMeta: readPackages :: Bool -> FilePath -> ShIO PackageSources
+ CabalMeta: readPackages :: Bool -> FilePath -> Sh PackageSources
Files
- CabalMeta.hs +6/−6
- cabal-meta.cabal +1/−1
- main.hs +22/−19
CabalMeta.hs view
@@ -122,13 +122,13 @@ vendor_dir :: FilePath vendor_dir = "vendor" -git_ :: Text -> [Text] -> ShIO ()+git_ :: Text -> [Text] -> Sh () git_ = command1_ "git" [] -darcs_ :: Text -> [Text] -> ShIO ()+darcs_ :: Text -> [Text] -> Sh () darcs_ = command1_ "darcs" [] -readPackages :: Bool -> FilePath -> ShIO PackageSources+readPackages :: Bool -> FilePath -> Sh PackageSources readPackages allowCabals startDir = do fullDir <- canonic startDir chdir fullDir $ do@@ -163,7 +163,7 @@ where isCabalFile = flip hasExtension "cabal" isCabalPresent = fmap (any isCabalFile) (ls ".")- updatePackage :: UnstablePackage -> ShIO ()+ updatePackage :: UnstablePackage -> Sh () updatePackage p@(GitPackage repo _ t) = do let d = diskPath p e <- test_d d@@ -186,7 +186,7 @@ else chdir d $ darcs_ "pull" ["--all"] updatePackage (Directory _ _) = return mempty - getSources :: ShIO PackageSources+ getSources :: Sh PackageSources getSources = do sourceContent <- readfile source_file let sources = paritionSources [ source | @@ -208,7 +208,7 @@ go _ ([]:_) = error "impossible" go sources ((name:flgs):more) = let n = T.head name in case () of- _ | n `elem` "./" -> next sources { dirs = mkDir: dirs sources }+ _ | n `elem` ("./" :: String) -> next sources { dirs = mkDir: dirs sources } | prefix "http" -> next sources { https = mkGit: https sources } | prefix "https" -> next sources { gits = mkGit: https sources } | prefix "git:" -> next sources { gits = mkGit: gits sources }
cabal-meta.cabal view
@@ -1,5 +1,5 @@ name: cabal-meta-version: 0.4.1.2+version: 0.4.1.3 license: BSD3 license-file: LICENSE author: Greg Weber <greg@gregweber.info>
main.hs view
@@ -28,27 +28,34 @@ ,"You can also set options through the CABAL_META_OPTS environment variable or the ~/.cabal-meta/opts file" ] -cabal_install_ :: CabalExe -> [Text] -> ShIO ()+cabal_install_ :: CabalExe -> [Text] -> Sh () cabal_install_ cabal = command_ (progName cabal) ["install"] data CabalExe = Cabal | CabalDev deriving Show progName :: CabalExe -> FilePath-progName Cabal = "cabal"+progName Cabal = "cabal" progName CabalDev = "cabal-dev" -assertCabalDependencies :: CabalExe -> IO ()+assertCabalDependencies :: CabalExe -> IO Bool assertCabalDependencies Cabal = shelly $ do- mPath <- which "cabal-src-install"- when (isNothing mPath) $ do- echo "please run: cabal install cabal-src"- quietExit 1+ whenM (test_e "cabal-dev") $ do+ echo help+ echo "\n\ncabal-dev/ folder found. use the --dev option"+ quietExit 1 + mPath <- which "cabal-src-install"+ if isNothing mPath+ then warn >> return False+ else return True+ where+ warn = echo "\nWARNING: cabal-src not installed. run:\n cabal install cabal-src\n"+ assertCabalDependencies CabalDev = do- mcd <- shelly $ which "cabal-dev"- case mcd of- Just _ -> return ()- Nothing -> error "--dev requires cabal-dev to be installed"+ mcd <- shelly $ which "cabal-dev"+ case mcd of+ Just _ -> return False+ Nothing -> error "--dev requires cabal-dev to be installed" main :: IO () main = do@@ -71,7 +78,7 @@ shelly $ if (headDef "" noDevArgs == "--help") then exit 0 else quietExit 1 - assertCabalDependencies cabal+ installSrc <- assertCabalDependencies cabal let (_:args) = noDevArgs @@ -82,13 +89,9 @@ mapM_ echo $ map (T.intercalate " ") installs cabal_install_ cabal $ args ++ concat installs- whenCabal cabal $ do+ case (cabal, installSrc) of+ (Cabal, True) -> forM_ (unstablePackages packageSources) $ \pkg -> chdir (diskPath pkg) $ run "cabal-src-install" ["--src-only"]+ _ -> return () return ()-- where- whenCabal cabal a =- case cabal of- CabalDev -> return ()- Cabal -> a