Browse Source

[enh] deliver.sh: prepare clean git repo and publish:
- add question f() which prompt anwser.
- ask to clean Makefile.
- prepare clean git repository:
- new copy, new git, set remote url
- check norm, compilation works:
- ask for work publication.

Moul 2 years ago
parent
commit
1957cdb2d6
1 changed files with 33 additions and 0 deletions
  1. 33 0
      deliver.sh

+ 33 - 0
deliver.sh

@@ -24,6 +24,14 @@ c_header="/* *******************************************************************
 /*                                                                            */
 /* ************************************************************************** */\n" 
 
+question() {
+    echo $1 "[y/n]"
+    read yes
+    if [ $yes != "y" ]; then
+		return
+    fi
+}
+
 add_42_headers() {
     for file in "src"/*; do
         add_42_header "$file"
@@ -51,9 +59,34 @@ clean_repository() {
     make fclean
     git rm -rf --ignore-unmatch doc non_use_src leaks.sh deliver.sh
     rm -f toto
+    question "Did you clean the Makefile?"
+    git add Makefile
     git commit -m "[mod] remove non used elements."
 }
 
+prepare_git_repository() {
+    tmp_repo="/tmp/21sh_delivery"
+    rm -rf $tmp_repo
+    cp -r ../21sh $tmp_repo
+    cd $tmp_repo
+    rm -rf .git
+    git init
+    echo "What's the repository URL?"
+    read repo_url
+    git remote add origin $repo_url
+    git add .
+    git commit -m "21sh delivery"
+}
+
+ready() {
+    norminette **/**.[ch]
+    make run
+    question "Publish?"
+    git push -u origin master
+}
+
 git checkout -B deliver
 add_42_headers
 clean_repository
+prepare_git_repository
+ready