Updated Rakefile, added reload! alias

This commit is contained in:
Nick Nisi
2012-04-30 23:03:48 -05:00
parent 9857275162
commit 7d9bdc2469
2 changed files with 9 additions and 12 deletions

View File

@@ -7,13 +7,13 @@ def linkables
linkables.each do |linkable|
file = linkable.split('/').last.split('.symlink').last
target = "#{ENV["HOME"]}/.#{file}"
yield file, target if block_given?
yield linkable, file, target if block_given?
end
end
desc "make a backup of all files that will be replaced (if they exist)"
task :backup do
linkables do |file, target|
linkables do |linkable, file, target|
if File.exists?(target) || File.symlink?(target)
`mv "$HOME/.#{file}" "$HOME/.#{file}.backup"`
end
@@ -22,7 +22,7 @@ end
desc "restore the backups"
task :restore do
linkables do |file, target|
linkables do |linkable, file, target|
if File.exists?("#{ENV['HOME']}/.#{file}.backup")
`mv "$HOME/.#{file}.backup" "$HOME/.#{file}"`
end
@@ -31,20 +31,14 @@ end
desc "create all the symlinks"
task :install do
linkables = Dir.glob('*/**{.symlink}')
linkables.each do |linkable|
file = linkable.split('/').last.split('.symlink').last
target = "#{ENV["HOME"]}/.#{file}"
linkables do |linkable, file, target|
`ln -s "$PWD/#{linkable}" "#{target}"`
end
end
desc "remove all files added"
task :uninstall do
Dir.glob('**/*.symlink').each do |linkable|
file = linkable.split('/').last.split('.symlink').last
target = "#{ENV["HOME"]}/.#{file}"
linkable do |linkable, file, target|
if File.symlink?(target)
FileUtils.rm(target)
end

View File

@@ -13,11 +13,14 @@ if [[ -a ~/.localrc ]]; then
source ~/.localrc
fi
# reload zsh config
alias reload!='source ~/.zshrc'
# initialize autocomplete
autoload -U compinit
compinit
for config ($ZSH/**/completion.sh) source $config
# for config ($ZSH/**/completion.sh) source $config
export EDITOR='vim'