-
Notifications
You must be signed in to change notification settings - Fork 5
/
osx-cmd-intallation.sh
76 lines (50 loc) · 1.86 KB
/
osx-cmd-intallation.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Error handling
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
terminate()
{
echo >&2 '
*** terminated ***
'
echo "\"$last_command\" command failed with exit code $?."
exit 1
}
trap 'terminate' 0
set -e
# Check if homebrew is installed
if [[ $(command -v brew) == "" ]]; then
# Install Homebrew
echo 'Installing Homebrew...'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
:
fi
echo 'Installing package dependencies...'
brew install python3 ruby subversion
echo 'Installing ruby gem dependencies...'
sudo gem install asciidoctor concurrent-ruby haml tilt
pip3 install pygit2
echo 'Creating resources directories...'
# Create resource directories
mkdir PantheonCMD/{haml,locales}
# Get HAML templates
echo 'Getting HAML templates...'
svn checkout https://github.com/redhataccess/pantheon/trunk/pantheon-bundle/src/main/resources/apps/pantheon/templates/haml/html5 PantheonCMD/haml
# Get locales
echo 'Getting locales...'
svn checkout https://github.com/asciidoctor/asciidoctor/trunk/data/locale PantheonCMD/locales
rm -rf PantheonCMD/{haml,locales}/.svn
echo 'Updating styling references...'
# Replace remote CSS locations with local ones
sed -i '' 's/^-\ pantheonCssPath.*/-\ pantheonCssPath\ \=\ \"resources\/rhdocs.min.css\"/' PantheonCMD/haml/document.html.haml
sed -i '' 's/href\=\"https\:\/\/static\.redhat\.com\/libs\/redhat\/redhat-font\/2\/webfonts\/red-hat-font\.css/href\=\"resources\/red-hat-font.css/' PantheonCMD/haml/document.html.haml
echo 'Copying the source files to the local binaries directory...'
cp -r PantheonCMD /usr/local/bin
echo 'Adding an alias to ~/.zshrc file...'
alias pcmd="/usr/local/bin/python3 /usr/local/bin/PantheonCMD/pcmd.py $@"
echo 'Sourcing your ~/.zshrc file...'
source ~/.zshrc
trap : 0
echo >&2 '
*** DONE ***
'