Updated Rakefile, added reload! alias
This commit is contained in:
16
Rakefile
16
Rakefile
@@ -7,13 +7,13 @@ def linkables
|
|||||||
linkables.each do |linkable|
|
linkables.each do |linkable|
|
||||||
file = linkable.split('/').last.split('.symlink').last
|
file = linkable.split('/').last.split('.symlink').last
|
||||||
target = "#{ENV["HOME"]}/.#{file}"
|
target = "#{ENV["HOME"]}/.#{file}"
|
||||||
yield file, target if block_given?
|
yield linkable, file, target if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "make a backup of all files that will be replaced (if they exist)"
|
desc "make a backup of all files that will be replaced (if they exist)"
|
||||||
task :backup do
|
task :backup do
|
||||||
linkables do |file, target|
|
linkables do |linkable, file, target|
|
||||||
if File.exists?(target) || File.symlink?(target)
|
if File.exists?(target) || File.symlink?(target)
|
||||||
`mv "$HOME/.#{file}" "$HOME/.#{file}.backup"`
|
`mv "$HOME/.#{file}" "$HOME/.#{file}.backup"`
|
||||||
end
|
end
|
||||||
@@ -22,7 +22,7 @@ end
|
|||||||
|
|
||||||
desc "restore the backups"
|
desc "restore the backups"
|
||||||
task :restore do
|
task :restore do
|
||||||
linkables do |file, target|
|
linkables do |linkable, file, target|
|
||||||
if File.exists?("#{ENV['HOME']}/.#{file}.backup")
|
if File.exists?("#{ENV['HOME']}/.#{file}.backup")
|
||||||
`mv "$HOME/.#{file}.backup" "$HOME/.#{file}"`
|
`mv "$HOME/.#{file}.backup" "$HOME/.#{file}"`
|
||||||
end
|
end
|
||||||
@@ -31,20 +31,14 @@ end
|
|||||||
|
|
||||||
desc "create all the symlinks"
|
desc "create all the symlinks"
|
||||||
task :install do
|
task :install do
|
||||||
linkables = Dir.glob('*/**{.symlink}')
|
linkables do |linkable, file, target|
|
||||||
|
|
||||||
linkables.each do |linkable|
|
|
||||||
file = linkable.split('/').last.split('.symlink').last
|
|
||||||
target = "#{ENV["HOME"]}/.#{file}"
|
|
||||||
`ln -s "$PWD/#{linkable}" "#{target}"`
|
`ln -s "$PWD/#{linkable}" "#{target}"`
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "remove all files added"
|
desc "remove all files added"
|
||||||
task :uninstall do
|
task :uninstall do
|
||||||
Dir.glob('**/*.symlink').each do |linkable|
|
linkable do |linkable, file, target|
|
||||||
file = linkable.split('/').last.split('.symlink').last
|
|
||||||
target = "#{ENV["HOME"]}/.#{file}"
|
|
||||||
if File.symlink?(target)
|
if File.symlink?(target)
|
||||||
FileUtils.rm(target)
|
FileUtils.rm(target)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,11 +13,14 @@ if [[ -a ~/.localrc ]]; then
|
|||||||
source ~/.localrc
|
source ~/.localrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# reload zsh config
|
||||||
|
alias reload!='source ~/.zshrc'
|
||||||
|
|
||||||
# initialize autocomplete
|
# initialize autocomplete
|
||||||
autoload -U compinit
|
autoload -U compinit
|
||||||
compinit
|
compinit
|
||||||
|
|
||||||
for config ($ZSH/**/completion.sh) source $config
|
# for config ($ZSH/**/completion.sh) source $config
|
||||||
|
|
||||||
export EDITOR='vim'
|
export EDITOR='vim'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user