fixed init
This commit is contained in:
parent
8ca2ed83a7
commit
ee7fe89d12
4 changed files with 24 additions and 13 deletions
|
@ -21,5 +21,5 @@ import GPM.Helpers (debug_)
|
|||
init :: IO ()
|
||||
init = do
|
||||
echo "* wiki.org"
|
||||
output "wiki.org" $(embedStringFile "templates/wiki.org")
|
||||
writeFile "wiki.org" $(embedStringFile "templates/wiki.org")
|
||||
debug_ "git add wiki.org"
|
||||
|
|
|
@ -11,11 +11,13 @@ module GPM.Init
|
|||
(init)
|
||||
where
|
||||
|
||||
import Protolude
|
||||
import Protolude hiding (die,fold)
|
||||
import Turtle
|
||||
|
||||
import GPM.Helpers (debug_)
|
||||
import qualified Control.Foldl as Fold
|
||||
|
||||
import qualified GPM.Docs as Docs
|
||||
import GPM.Helpers (debug_)
|
||||
import qualified GPM.Issue as Issue
|
||||
import qualified GPM.Review as Review
|
||||
|
||||
|
@ -32,9 +34,14 @@ init = do
|
|||
|
||||
-- | Create a new empty branch, fail if the branch already exists
|
||||
mkNewEmptyBranch :: Text -> IO ()
|
||||
mkNewEmptyBranch br = do
|
||||
mkNewEmptyBranch br = sh $ do
|
||||
clean <- fold (inshell "git status --porcelain" empty) Fold.null
|
||||
if clean
|
||||
then liftIO $ do
|
||||
putText $ "create a new branch " <> br <> " (be sure the branch " <> br <> " doesn't already exists)"
|
||||
debug_ $ "git checkout --orphan " <> br
|
||||
echo "cleanup the branch"
|
||||
debug_ "git rm --cached -r ."
|
||||
debug_ "git clean -fd"
|
||||
else die "Please take care of pending modification and untracked files (you can use git stash --all)"
|
||||
|
||||
|
|
|
@ -172,5 +172,9 @@ gatherNewIssueInfos iss = do
|
|||
init :: IO ()
|
||||
init = do
|
||||
echo "* issue.org"
|
||||
output "issues.org" $(embedStringFile "templates/issues.org")
|
||||
writeFile "issues.org" $(embedStringFile "templates/issues.org")
|
||||
debug_ "git add issues.org"
|
||||
mktree "templates"
|
||||
writeFile "templates/new-issue.org" $(embedStringFile "templates/new-issue.org")
|
||||
debug_ "git add templates"
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ init = do
|
|||
let fic = "reviews" </> "write-contributing-yogsototh.org"
|
||||
mktree "reviews"
|
||||
putText $ format ("* "%fp) fic
|
||||
output fic $(embedStringFile "templates/review.org")
|
||||
writeFile (toS (format fp fic)) $(embedStringFile "templates/review.org")
|
||||
debug_ "git add reviews"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue