Skip to content

Commit a99d73d

Browse files
committed
Added Github URL
1 parent e297085 commit a99d73d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

scripts/install.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/bin/sh
22

3+
should_use_file_from_github_url=true
34
# defaults
45
PLACEHOLDER_REGEX_COMMIT_ISSUE_NUMBER="^\s*[\-\w]*\d:"
56
PLACEHOLDER_REGEX_BRANCH_ISSUE_NUMBER="[.]*\/([\-\w]*?\-\d+)"
67
PLACEHOLDER_REGEX_GIT_COMMIT_MESSAGES="(Merge\sbranch\s\'|\#\sRebase\s|This\sreverts\scommit\s)"
78
PLACEHOLDER_LOGGING_VERBOSE="true"
89
PLACEHOLDER_NEW_COMMIT_MESSAGE="#{issue_number.upcase}: #{original_commit_message.gsub(/(\s[[:punct:]])+$/, '')}"
10+
GITHUB_SCRIPT_URL="https://raw.githubusercontent.com/yrave/prepare-commit-msg/master/scripts/prepare-commit-msg"
911

1012
PATH_GIT_GLOBAL="${HOME}/.git-template/"
1113
PATH_GIT_LOCAL="./.git/"
@@ -139,10 +141,14 @@ else
139141
HOOK_FILE="${PATH_GIT_LOCAL}${HOOK_DIR}${HOOK_NAME}"
140142
fi
141143

142-
printf -- " - Creating git hook file\n"
143-
144-
BASEDIR=$(dirname $0)
145-
cat "${BASEDIR}/prepare-commit-msg" > "$HOOK_FILE"
144+
if [ "$should_use_file_from_github_url" = true ] ; then
145+
printf -- " - Downloading git hook...\n"
146+
curl -s "$GITHUB_SCRIPT_URL" > "$HOOK_FILE"
147+
else
148+
printf -- " - Creating git hook file from local file\n"
149+
BASEDIR=$(dirname $0)
150+
cat "${BASEDIR}/prepare-commit-msg" > "$HOOK_FILE"
151+
fi
146152

147153
printf -- " - Replacing placeholders...\n"
148154
PLACEHOLDER_REGEX_COMMIT_ISSUE_NUMBER=$(printf -- "$PLACEHOLDER_REGEX_COMMIT_ISSUE_NUMBER" | sed 's/\\/\\\\/g')

0 commit comments

Comments
 (0)