Giuseppe Lavagetto has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/381936 )
Change subject: utils/git-setup: add installation of the post-commit hook
......................................................................
utils/git-setup: add installation of the post-commit hook
Change-Id: I47169376e78d213eb9ebf8e297fcd82210df22bc
---
M utils/git-setup
1 file changed, 20 insertions(+), 6 deletions(-)
Approvals:
Giuseppe Lavagetto: Looks good to me, approved
jenkins-bot: Verified
diff --git a/utils/git-setup b/utils/git-setup
index 0b91acc..e4e7ccb 100755
--- a/utils/git-setup
+++ b/utils/git-setup
@@ -20,20 +20,34 @@
git config alias.push-for-review-production "push puppet
HEAD:refs/for/production"
TOPLEVEL=`git rev-parse --show-toplevel`
-which curl
-if [ "$?" == "0" ]
+
+if which curl > /dev/null;
then
curl "https://gerrit.wikimedia.org/r/tools/hooks/commit-msg" >
$TOPLEVEL/.git/hooks/commit-msg && chmod u+x $TOPLEVEL/.git/hooks/commit-msg
else
- which wget
- if [ "$?" == "0" ]
+ if which wget > /dev/null;
then
wget "https://gerrit.wikimedia.org/r/tools/hooks/commit-msg" -O
$TOPLEVEL/.git/hooks/commit-msg && chmod u+x $TOPLEVEL/.git/hooks/commit-msg
else
- scp -p 29418 gerrit.wikimedia.org:hooks/commit-msg
$TOPLEVEL/.git/hooks/commit-msg
- if [ "$?" != "0" ]
+
+ if ! scp -p 29418 gerrit.wikimedia.org:hooks/commit-msg
$TOPLEVEL/.git/hooks/commit-msg;
then
echo "Please download the commit message hook from
https://gerrit.wikimedia.org/r/tools/hooks/commit-msg, place it in
.git/hooks/commit-msg, and chmod u+x the file."
fi
fi
fi
+
+RBENV=$(which rbenv)
+if [ "$RBENV" == "" ]; then
+ echo "Please install rbenv in order to add the post-commit hook"
+ exit 1
+fi
+if ! $RBENV which bundle > /dev/null; then
+ echo "Please install bundler in your rbenv in order to add the
post-commit hook"
+ exit 1
+fi
+
+cat <<EOF > "${TOPLEVEL}/.git/hooks/post-commit"
+#!/bin/bash
+$RBENV exec bundle exec rake test
+EOF
--
To view, visit https://gerrit.wikimedia.org/r/381936
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I47169376e78d213eb9ebf8e297fcd82210df22bc
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits