-
Notifications
You must be signed in to change notification settings - Fork 1
/
tasks.py
137 lines (97 loc) · 3.09 KB
/
tasks.py
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env python
from invoke import task, run, Collection
BREW_APPS = ['git', 'wget', 'autoconf', 'libevent', 'htop', 'rabbitmq', 'tmux',
'sqlite', 'memcached', 'libmemcached', 'gettext', 'ctags', 'ack',
'redis', 'readline', 'reattach-to-user-namespace',
'macvim --env-std --override-system-vim']
CASK_APPS = ['iterm2']
PIP_APPS = ['bpython', '--user git+git://github.com/Lokaltog/powerline',
'virtualenvwrapper']
@task
def pip_install_system(library):
run('sudo pip install %s' % library)
@task
def install_python_env():
run('sudo easy_install pip')
for app in PIP_APPS:
try:
pip_install_system(app)
except:
pass
python = Collection(pip_install_system, install_python_env)
@task
def install_ohmyzsh():
run('cd ~/; wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh')
@task
def install_brew():
# install if uninstalled
run('which brew > /dev/null || ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"')
# update if already installed
run('brew update')
@task
def install_brew_cask():
try:
run('brew tap phinze/homebrew-cask')
except Exception, ex:
# Ignore if there is an issue installing the cask
pass
brew_install('brew-cask')
@task
def brew_install(appname):
run('brew install %s' % appname)
@task
def brew_cask_install(appname):
run('brew cask install %s' % appname)
brew = Collection(install_brew, install_brew_cask, brew_install, brew_cask_install)
@task
def copy_font(fontname):
run('sudo cp fonts/%s /Library/Fonts/' % fontname)
@task
def install_fonts():
pass
@task
def print_python_versions():
run('cd /usr/bin/; ls -la | grep python')
fonts = Collection(install_fonts, copy_font)
@task
def bootstrap(ssh_keys=None):
print "Installing Homebrew"
install_brew()
print "Installing Homebrew cask"
install_brew_cask()
print "Installing cask apps"
for app in CASK_APPS:
try:
brew_cask_install(app)
except:
# ignore brew errors
pass
print "Installing homebrew apps"
for app in BREW_APPS:
try:
brew_install(app)
except:
# ignore brew errors
pass
print "Installing Oh-my-zsh"
install_ohmyzsh()
print "Moving default .zshrc"
run('mv ~/.zshrc ~/.zshrc.orig')
print "Symlinking files"
run('ln -s .bash_profile ~/.bash_profile')
run('ln -s .bashrc ~/.bashrc')
run('ln -s .gitconfig ~/.gitconfig')
run('ln -s .tmux.conf ~/.tmux.conf')
run('ln -s .zshalias ~/.zshalias')
run('ln -s .zshfunc ~/.zshfunc')
run('ln -s .zshenv ~/.zshenv')
run('ln -s .zshrc ~/.zshrc')
print "Copying PIP configuration"
run('ln -s .pip ~/.pip')
# optionally symlink ssh keys
if ssh_keys:
print "Symlinking SSH directory"
run('ln -s %s ~/.ssh' % ssh_keys)
print "Setting up osx defaults"
run('./.osx')
ns = Collection(bootstrap, fonts=fonts, python=python, brew=brew)