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 :: IO ()
|
||||||
init = do
|
init = do
|
||||||
echo "* wiki.org"
|
echo "* wiki.org"
|
||||||
output "wiki.org" $(embedStringFile "templates/wiki.org")
|
writeFile "wiki.org" $(embedStringFile "templates/wiki.org")
|
||||||
debug_ "git add wiki.org"
|
debug_ "git add wiki.org"
|
||||||
|
|
|
@ -11,13 +11,15 @@ module GPM.Init
|
||||||
(init)
|
(init)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Protolude
|
import Protolude hiding (die,fold)
|
||||||
import Turtle
|
import Turtle
|
||||||
|
|
||||||
import GPM.Helpers (debug_)
|
import qualified Control.Foldl as Fold
|
||||||
import qualified GPM.Docs as Docs
|
|
||||||
import qualified GPM.Issue as Issue
|
import qualified GPM.Docs as Docs
|
||||||
import qualified GPM.Review as Review
|
import GPM.Helpers (debug_)
|
||||||
|
import qualified GPM.Issue as Issue
|
||||||
|
import qualified GPM.Review as Review
|
||||||
|
|
||||||
-- | Init a repository with a new empty branch named @gpm@
|
-- | Init a repository with a new empty branch named @gpm@
|
||||||
init :: IO ()
|
init :: IO ()
|
||||||
|
@ -32,9 +34,14 @@ init = do
|
||||||
|
|
||||||
-- | Create a new empty branch, fail if the branch already exists
|
-- | Create a new empty branch, fail if the branch already exists
|
||||||
mkNewEmptyBranch :: Text -> IO ()
|
mkNewEmptyBranch :: Text -> IO ()
|
||||||
mkNewEmptyBranch br = do
|
mkNewEmptyBranch br = sh $ do
|
||||||
putText $ "create a new branch " <> br <> " (be sure the branch " <> br <> " doesn't already exists)"
|
clean <- fold (inshell "git status --porcelain" empty) Fold.null
|
||||||
debug_ $ "git checkout --orphan " <> br
|
if clean
|
||||||
echo "cleanup the branch"
|
then liftIO $ do
|
||||||
debug_ "git rm --cached -r ."
|
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 :: IO ()
|
||||||
init = do
|
init = do
|
||||||
echo "* issue.org"
|
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"
|
let fic = "reviews" </> "write-contributing-yogsototh.org"
|
||||||
mktree "reviews"
|
mktree "reviews"
|
||||||
putText $ format ("* "%fp) fic
|
putText $ format ("* "%fp) fic
|
||||||
output fic $(embedStringFile "templates/review.org")
|
writeFile (toS (format fp fic)) $(embedStringFile "templates/review.org")
|
||||||
debug_ "git add reviews"
|
debug_ "git add reviews"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue