xonecas.io
2780
D2

dotfiles-2014 / commit f6e2c79

dicking around with shells and pythons"

xonecas2014-10-13 f6e2c799767d24a81ba48cc2fe081cbccf59500b parent a8e4f9d

1 file changed

install.py+27−13
@@ -1,6 +1,7 @@
11 #!/usr/bin/env python
22
33 from os import makedirs
4+from os import remove
45 from os.path import basename
56 from os.path import dirname
67 from os.path import exists
@@ -8,13 +9,24 @@ from os.path import expanduser
89 from os.path import join
910 from os.path import splitext
1011 from shutil import copyfile
12+from shutil import rmtree
1113 from subprocess import call
14+from time import sleep
1215
1316
1417 HOME = expanduser("~")
1518 PWD = dirname(__file__)
1619
1720
21+def clean():
22+ """ This rests everything """
23+
24+ remove(join(HOME, ".vimrc"))
25+ remove(join(HOME, ".zshrc"))
26+ rmtree(join(HOME, ".vim"))
27+ rmtree(join(HOME, ".oh-my-zsh"))
28+
29+
1830 def create_vim_bundle():
1931 """ Create necessary folders: .vim/bundle """
2032
@@ -47,8 +59,8 @@ def clone_plugins():
4759 plugins_list = f.readlines()
4860
4961 for plugin_url in plugins_list:
62+ plugin_url = plugin_url.rstrip()
5063 foldername = splitext(basename(plugin_url))[0]
51- print join(bundle, foldername)
5264 call(["git", "clone", plugin_url, join(bundle, foldername)])
5365
5466
@@ -68,9 +80,7 @@ def install_ohmyzsh():
6880 zshrc_file = join(HOME, ".zshrc")
6981 install_script = join(PWD, "ohmyzsh_install.sh")
7082
71- if exists(ohmyzsh_folder) and exists(zshrc_file):
72- print "Looks installed, won't forcefully re-install"
73- return
83+ print "Script: %s" % install_script
7484
7585 call(["curl", "-L", "http://install.ohmyz.sh", "-o", install_script])
7686 call(["sh", install_script])
@@ -80,26 +90,30 @@ def setup_zsh():
8090 """ moves the file into the correct place """
8191
8292 zshrc = join(HOME, ".zshrc")
83- theme = join(HOME, ".oh-my-zsh/custom/themes/xonecas.zsh-theme")
93+ theme_folder = join(HOME, ".oh-my-zsh/custom/themes")
8494
85- if not exists(zshrc):
86- copyfile(join(PWD, "zshrc"), zshrc)
95+ copyfile(join(PWD, "zshrc"), zshrc)
8796
88- if not exists(theme):
89- copyfile(join(PWD, "xonecas.zsh-theme"), join(theme))
97+ if not exists(theme_folder):
98+ makedirs(theme_folder)
99+ copyfile(join(PWD, "xonecas.zsh-theme"), join(theme_folder, "xonecas.zsh-theme"))
90100
91101
92102 def main():
103+ #clean()
104+
93105 # vim
94- create_vim_bundle()
95- install_pathogen()
96- clone_plugins()
97- setup_vim()
106+ #create_vim_bundle()
107+ #install_pathogen()
108+ #clone_plugins()
109+ #setup_vim()
98110
99111 # zsh
100112 install_ohmyzsh()
101113 setup_zsh()
102114
115+ print "done."
116+
103117
104118 if __name__ == "__main__":
105119 main()