make-package 1.1.0 → 1.2.0
raw patch · 3 files changed
+11/−9 lines, 3 filesdep ~github
Dependency ranges changed: github
Files
- make-package.cabal +2/−2
- src/Github.hs +6/−4
- src/IO.hs +3/−3
make-package.cabal view
@@ -1,5 +1,5 @@ name: make-package-version: 1.1.0+version: 1.2.0 synopsis: Make a cabalized package description: Create a cabalized haskell project license: BSD3@@ -34,7 +34,7 @@ containers >= 0.5, directory >= 1.2, filepath >= 1.3,- github >= 0.7,+ github >= 0.11, haskeline >= 0.7, mtl >= 2.1, process >= 1.1,
src/Github.hs view
@@ -9,6 +9,8 @@ import Control.Monad.Trans import qualified Data.Text as T import qualified Data.Text.Encoding as T+import qualified Data.Foldable as Foldable+import Github.Auth import Github.Repos import System.Exit (exitSuccess) import System.Timeout@@ -25,14 +27,13 @@ timeoutDelay <- toSeconds <$> confLookup "github.timeout" mbRepoUrl <- liftIO . timeout timeoutDelay $ getRepo uname case mbRepoUrl of- Nothing -> return ()- Just (Left _) -> return ()- Just (Right rUrl) ->+ Just (Right (Just rUrl)) -> do cloneP <- promptYesNo "clone" "A repository with this name already exists\ \in your github account. Clone it instead?" when cloneP $ do run "git" ["clone", rUrl, T.unpack dir] liftIO exitSuccess+ _ -> return () where toSeconds Nothing = 5 * 10^(6::Int) toSeconds (Just t) = t * 10^(6::Int)@@ -65,7 +66,8 @@ Left e -> do liftIO $ putStrLn $ "An Error occured while trying to create the repository:" ++ show e Right r -> do liftIO $ putStrLn "Done." liftIO $ putStrLn "Configuring git to track the new repository"- run "git" ["remote", "add", "origin", repoSshUrl r]+ Foldable.forM_ (repoSshUrl r) $ \url ->+ run "git" ["remote", "add", "origin", url] run "git" ["config", "branch.master.remote", "origin"] run "git" [ "config" , "branch.master.merge"
src/IO.hs view
@@ -6,7 +6,7 @@ module IO where -import Control.Applicative ((<$>))+import Control.Applicative import Control.Monad.Reader import Control.Monad.State import Data.Char (isSpace)@@ -21,7 +21,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as T import System.Console.Haskeline as HL-import System.Console.Haskeline.MonadException()+import System.Console.Haskeline.MonadException () import System.Directory import System.Exit import System.FilePath@@ -32,7 +32,7 @@ newtype MakePackage a = MP {unConf :: StateT (Map Text Text) (ReaderT Conf.Config IO) a}- deriving (Monad, MonadIO, Functor)+ deriving (Monad, MonadIO, Functor, Applicative) withConfig :: MakePackage a -> IO a withConfig (MP f) = do conf <- loadConfig