Skip to content

Commit ac26812

Browse files
committed
reorganize
1 parent ddfa0fb commit ac26812

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

deploy.sh

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ repo=origin
1313

1414
# Parse arg flags
1515
while : ; do
16-
if [[ $1 = "-v" || $1 = "--verbose" ]]; then
17-
verbose=true
18-
shift
19-
elif [[ $1 = "-s" || $1 = "--setup" ]]; then
20-
setup=true
21-
shift
22-
else
23-
break
24-
fi
16+
if [[ $1 = "-v" || $1 = "--verbose" ]]; then
17+
verbose=true
18+
shift
19+
elif [[ $1 = "-s" || $1 = "--setup" ]]; then
20+
setup=true
21+
shift
22+
else
23+
break
24+
fi
2525
done
2626

2727
#echo expanded commands as they are executed (for debugging)
@@ -40,26 +40,8 @@ function disable_expanded_output {
4040
fi
4141
}
4242

43-
function setup_repo {
44-
mkdir -p $deploy_directory
45-
git --work-tree $deploy_directory checkout --orphan $deploy_branch
46-
git --work-tree $deploy_directory rm -r "*"
47-
git --work-tree $deploy_directory add --all
48-
git --work-tree $deploy_directory commit -m "initial publish"
49-
git push origin $deploy_branch
50-
git symbolic-ref HEAD refs/heads/master && git reset --mixed
51-
}
52-
5343
enable_expanded_output
5444

55-
if [ $setup ]; then
56-
setup_repo
57-
exit
58-
fi
59-
60-
commit_title=`git log -n 1 --format="%s" HEAD`
61-
commit_hash=`git log -n 1 --format="%H" HEAD`
62-
6345
function set_user_id {
6446
if [[ -z `git config user.name` ]]; then
6547
git config user.name "$default_username"
@@ -69,8 +51,21 @@ function set_user_id {
6951
fi
7052
}
7153

54+
commit_title=`git log -n 1 --format="%s" HEAD`
55+
commit_hash=`git log -n 1 --format="%H" HEAD`
7256
previous_branch=`git rev-parse --abbrev-ref HEAD`
7357

58+
if [ $setup ]; then
59+
mkdir -p $deploy_directory
60+
git --work-tree $deploy_directory checkout --orphan $deploy_branch
61+
git --work-tree $deploy_directory rm -r "*"
62+
git --work-tree $deploy_directory add --all
63+
git --work-tree $deploy_directory commit -m "initial publish"
64+
git push origin $deploy_branch
65+
git symbolic-ref HEAD refs/heads/master && git reset --mixed
66+
exit
67+
fi
68+
7469
if ! git diff --exit-code --quiet --cached; then
7570
echo Aborting due to uncommitted changes in the index
7671
exit 1

0 commit comments

Comments
 (0)