Skip to content

Commit

Permalink
Fix incorrect documentation in deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
lord committed Nov 24, 2016
1 parent 3351506 commit e8e2e5e
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,7 @@ Options:
deploy branch.
-n, --no-hash Don't append the source commit's hash to the deploy
commit's message.
-c, --config-file PATH Override default & environment variables' values
with those in set in the file at 'PATH'. Must be the
first option specified.
Variables:
GIT_DEPLOY_DIR Folder path containing the files to deploy.
GIT_DEPLOY_BRANCH Commit deployable files to this branch.
GIT_DEPLOY_REPO Push the deploy branch to this repository.
These variables have default values defined in the script. The defaults can be
overridden by environment variables. Any environment variables are overridden
by values set in a '.env' file (if it exists), and in turn by those set in a
file specified by the '--config-file' option."
"

bundle exec middleman build --clean

Expand All @@ -38,12 +25,6 @@ parse_args() {
source .env
fi

# Set args from file specified on the command-line.
if [[ $1 = "-c" || $1 = "--config-file" ]]; then
source "$2"
shift 2
fi

# Parse arg flags
# If something is exposed as an environment variable, set/overwrite it
# here. Otherwise, set/overwrite the internal variable instead.
Expand Down Expand Up @@ -98,24 +79,24 @@ main() {

commit_title=`git log -n 1 --format="%s" HEAD`
commit_hash=` git log -n 1 --format="%H" HEAD`

#default commit message uses last title if a custom one is not supplied
if [[ -z $commit_message ]]; then
commit_message="publish: $commit_title"
fi

#append hash to commit message unless no hash flag was found
if [ $append_hash = true ]; then
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
fi

previous_branch=`git rev-parse --abbrev-ref HEAD`

if [ ! -d "$deploy_directory" ]; then
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
return 1
fi

# must use short form of flag in ls for compatibility with OS X and BSD
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
Expand All @@ -124,7 +105,7 @@ main() {

if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
# deploy_branch exists in $repo; make sure we have the latest version

disable_expanded_output
git fetch --force $repo $deploy_branch:$deploy_branch
enable_expanded_output
Expand Down Expand Up @@ -207,7 +188,7 @@ restore_head() {
else
git symbolic-ref HEAD refs/heads/$previous_branch
fi

git reset --mixed
}

Expand All @@ -219,4 +200,4 @@ sanitize() {
"$@" 2> >(filter 1>&2) | filter
}

[[ $1 = --source-only ]] || main "$@"
[[ $1 = --source-only ]] || main "$@"

0 comments on commit e8e2e5e

Please sign in to comment.