Created
June 5, 2012 19:51
-
-
Save nimbupani/2877332 to your computer and use it in GitHub Desktop.
Automating CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '=================================================================' | |
echo 'This will set up all the files necessary for Test the web forward' | |
echo '=================================================================' | |
promptValue() { | |
read -p "$1"": " val | |
echo $val | |
} | |
if [ -s ~/.hgrc ] | |
then | |
echo "Mercurial configuration file exists…appending CSSWG details" | |
echo "" | |
csswgusername=$(promptValue "Enter your CSSWG username") | |
echo "Enter your password" | |
stty -echo | |
read csswgpwd | |
stty echo | |
cat >> ./.hgrc <<EOF | |
[auth] | |
# CSSWG Test Repository | |
csswg.prefix = https://hg.csswg.org/ | |
csswg.username = $csswgusername | |
csswg.password = $csswgpwd | |
EOF | |
else | |
username=$(promptValue "Enter your full name") | |
email=$(promptValue "Enter your email address") | |
csswgusername=$(promptValue "Enter your CSSWG username") | |
echo "Enter your password" | |
stty -echo | |
read csswgpwd | |
stty echo | |
cat > ./.hgrc <<EOF | |
[ui] | |
username = $username <$email> | |
merge = internal:merge | |
[diff] | |
git = 1 | |
showfunc = 1 | |
unified = 8 | |
[defaults] | |
commit = -v | |
[extensions] | |
rebase = | |
mq = | |
graphlog = | |
[auth] | |
# CSSWG Test Repository | |
csswg.prefix = https://hg.csswg.org/ | |
csswg.username = $csswgusername | |
csswg.password = $csswgpwd | |
EOF | |
fi | |
echo "Mercurial is set up for testing!" | |
echo "Setting up the test harness…" | |
cd / | |
if [ -d /resources ] | |
then | |
echo "resources folder exists. " | |
else | |
sudo hg clone https://dvcs.w3.org/hg/resources | |
fi | |
echo "" | |
echo "Now setting up your test folder…" | |
testdir=$(promptValue "Enter parent directory to set up test repository within your home folder") | |
cd | |
if [ -d $testdir ] | |
then | |
echo "Directory exists, cloning tests repository…" | |
cd $testdir && pwd | |
else | |
echo "Directory created, cloning tests repository…" | |
mkdir $testdir | |
fi | |
hg clone https://hg.csswg.org/test/ | |
echo "" | |
echo "You are all set up!" | |
open $testdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment