-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile_local.py
66 lines (49 loc) · 1.87 KB
/
fabfile_local.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
# -*- encoding:utf-8 -*-
from fabric.api import env, local, lcd
from fabric.decorators import task
from fabric.contrib import console
from fabric.colors import white
env.warn_only = True dotfiles_path = '.ghq/github.com/pika-shi/dotfiles'
@task(default=True)
def main():
clone_dotfiles()
set_symlinks()
restore_mackup()
change_shell()
set_mac_environment()
@task
def clone_dotfiles():
print white('--- clone dotfiles ---', bold=True)
with lcd('~/'):
if console.confirm('Set sshkey to github?'):
local('git clone --recursive git@github.com:pika-shi/dotfiles.git {0}'.format(dotfiles_path))
@task
def set_symlinks():
print white('--- set symlinks ---', bold=True)
with lcd('~/'):
dotfiles = '''
zshrc zshenv tmux.conf vimrc tmux tmuxinator vim gitignore gitconfig gitattributes mackup.cfg
'''.split()
map(lambda _: local('ln -sf {0}/_{1} .{1}'.format(dotfiles_path, _)), dotfiles)
@task
def change_shell():
print white('--- change shell ---', bold=True)
local('echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells')
local('chsh -s /usr/local/bin/zsh')
@task
def restore_mackup():
print white('--- restore mackup ---', bold=True)
local('mackup restore')
@task
def set_mac_environment():
print white('--- set mac environment ---', bold=True)
local('nvram SystemAudioVolume=%80')
local('defaults write com.apple.dock autohide -bool true')
local('defaults write com.apple.dock autohide-delay -float 0')
local('defaults write com.apple.dock magnification -bool true')
local('defaults write com.apple.dock tilesize -int 40')
local('defaults write com.apple.dock largesize -int 80')
local('defaults write com.apple.dock mineffect -string "scale"')
local('killall Dock')
local('defaults write com.apple.finder CreateDesktop -bool false')
local('killall Finder')