-
Notifications
You must be signed in to change notification settings - Fork 26
/
update_hooks.sh
executable file
·56 lines (49 loc) · 2.51 KB
/
update_hooks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# :noTabs=true:
# (c) Copyright Rosetta Commons Member Institutions.
# (c) This file is part of the Rosetta software suite and is made available
# (c) under license.
# (c) The Rosetta software is developed by the contributing members of the
# (c) Rosetta Commons.
# (c) For more information, see http://www.rosettacommons.org.
# (c) Questions about this can be addressed to University of Washington UW
# (c) TechTransfer, email: [email protected].
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Brief: This shell script clones repositories from GitHub and configures #
# them to play nicely with how our community is organized. #
# #
# Note: Before you begin, #
# 1) Create a GitHub account and tell Andrew Leaver-Fay #
# ([email protected]) your GitHub user name so that he can #
# add you to the RosettaCommons account, and #
# 2) Set up SSH keys with GitHub following the #
# instructions here #
# https://help.github.com/articles/generating-ssh-keys #
# #
# Authors: Brian D. Weitzner ([email protected]) #
# Tim Jacobs ([email protected]) #
# Sam DeLuca ([email protected]) #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Global data
tools_url="https://github.com/RosettaCommons/rosetta_clone_tools/raw/master"
hook_url=$tools_url"/git_hooks"
hooks=(pre-commit post-commit prepare-commit-msg)
# Ensure the output is colorized to make it a little easier to read
color_echo="echo -e"
# Make sure the required arguments were supplied
if [ -z $1 ]; then
$color_echo "\033[0;34mYou must pass the path of a git repository as the first argument to this script.\033[0m"
fi
repo=$1
# Make sure the supplied path is a git repository
if [ ! -e $repo/.git ]; then
$color_echo "\033[0;34m$repo is not a git repository!\033[0m"
fi
starting_dir=$PWD
cd $repo/.git/hooks
for hook in "${hooks[@]}"; do
$color_echo "\033[0;34mConfiguring the $hook hook...\033[0m"
curl -kL $hook_url/$hook > $hook
chmod +x $hook
done
cd $starting_dir