dotfiles/Rakefile

21 lines
631 B
Ruby
Raw Normal View History

2013-12-04 06:23:05 +11:00
require 'yaml'
2010-11-22 14:53:35 +11:00
2008-08-26 08:43:57 +10:00
desc "install the dot files into user's home directory"
task :install do
2013-12-04 06:23:05 +11:00
dot_files = File.dirname(__FILE__)
install = proc do |files, cmd|
files.each do |source, destination|
source = File.expand_path(source, dot_files)
destination = File.expand_path(destination, ENV['HOME'])
system 'mkdir', '-p', File.dirname(destination)
# puts [*cmd, source, destination].join(" ")
system *cmd, source, destination
2008-08-26 08:43:57 +10:00
end
end
2010-11-22 14:53:35 +11:00
2013-12-04 06:23:05 +11:00
plan = YAML.load_file(File.expand_path("install.yml", dot_files))
2010-11-22 14:53:35 +11:00
2013-12-04 06:23:05 +11:00
install.call plan[:link], %w[ln -sinF]
install.call plan[:copy], %w[cp -n]
end