Refactor dropbox linking.

This commit is contained in:
Ivan Malison 2014-12-15 16:50:58 -08:00
parent 40e70473cc
commit 7d30be57e2

View File

@ -43,7 +43,8 @@ def dropbox_dotfiles(ctx, flags='f'):
),
flags
))
link_dropbox_other(ctx)
link_filenames(ctx, [('~/Dropbox/configs/custom.el', '~/.emacs.d/custom.el')], force=True)
@ctask
def powerline(ctx):
@ -77,16 +78,22 @@ def change_shell(ctx):
@ctask
def link_dropbox_other(ctx):
def link_dropbox_other(ctx, force=False):
link_pairs = (
('~/Dropbox/configs/custom.el', '~/.emacs.d/custom.el'),
('~/Dropbox/Documents', '~/Documents'),
('~/Dropbox/Pictures', '~/Pictures'),
('~/Dropbox/org', '~/org')
('~/Dropbox/Desktop', '~/Desktop')
)
link_filenames(ctx, link_pairs, force)
def link_filenames(ctx, link_pairs, force=False)
for source, destination in link_pairs:
destination = os.path.expanduser(destination)
source = os.path.expanduser(source)
if force:
ctx.run("sudo rm -rf {0}".format(destination))
if os.path.exists(destination):
print("Skipping {0} because path already exists".format(destination))
else: