Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 64 lines (52 sloc) 2.13 KB
#! /usr/bin/env python
import os, platform, shutil, time
from os.path import exists, join, islink
from subprocess import call
from filecmp import cmp
if exists(join(os.getenv('HOME'), '.rvm')):
print('RVM exists, ignored.')
else:
print('Installing RVM ...')
call('curl -L get.rvm.io | bash -s head', shell=True)
call('rvm pkg install zlib', shell=True)
if platform.system() == 'Darwin':
call('rvm install 1.9.3 --with-gcc=clang', shell=True)
else:
call('rvm install 1.9.3', shell=True)
if exists(join(os.getenv('HOME'), '.oh-my-zsh')):
print('oh-my-zsh exists, ignored.')
else:
print('Installing oh-my-zsh ...')
call('curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh \
| sh', shell=True)
if exists(join(os.getenv('HOME'), '.oh-my-zsh/custom/plugins/zsh-syntax-highlighting')):
print('zsh-syntax-highlighting exists, ignored.')
else:
print('Installing zsh-syntax-highlighting ...')
call('git clone git://github.com/zsh-users/zsh-syntax-highlighting.git \
~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting', shell=True)
if exists(join(os.getenv('HOME'), '.vim/janus')) and \
islink(join(os.getenv('HOME'), '.vimrc')):
print('Janus exists, ignored.')
else:
print('Installing Janus ...')
call('curl -Lo- http://bit.ly/janus-bootstrap | bash', shell=True)
if exists(join(os.getenv('HOME'), '.dotfiles/zsh/custom')):
print('custom variables file exists, ignored.')
else:
print('Copying custom variables file ...')
call('cp zsh/custom.example zsh/custom', shell=True)
cwd = os.listdir(os.getcwd())
for fname in cwd:
if fname in ['.git', 'install', 'README.md']: continue
target_file = join(os.getenv('HOME'), '.%s' % fname)
if exists(target_file):
if cmp(target_file, fname) or islink(target_file):
print('%s is identical, ignored.' % target_file)
continue
else:
shutil.move(target_file, '%s.backup.%s' % (target_file, int(time.time())))
print('%s is backed up.' % target_file)
call('ln -s "$PWD/%(fname)s" "$HOME/.%(fname)s"' % locals(), shell=True)
print('%s is linked.' % fname)
call('source ~/.zshrc', shell=True, executable='/bin/zsh')
Jump to Line
Something went wrong with that request. Please try again.