[rake] update sync tasks

pull/28/head
Alpha Chen 8 years ago
parent b206c0d6c9
commit 49f1e18bc9

@ -12,8 +12,10 @@ namespace :sync do
task :dlanham do task :dlanham do
rm_rf File.expand_path("~/Dropbox/wallpapers/dlanham wallpapers/Newest Additions") rm_rf File.expand_path("~/Dropbox/wallpapers/dlanham wallpapers/Newest Additions")
FileList[File.expand_path("~/Downloads/dlanham*")].each do |dir| FileList[File.expand_path("~/Downloads/dlanham*")].each do |dir|
cmd = %w[ rsync -avz --exclude *.DS_Store . ]
cmd << File.expand_path(dir.pathmap("~/Dropbox/wallpapers/%f"))
Dir.chdir dir do Dir.chdir dir do
sh 'rsync -avz --exclude "*.DS_Store" . ~/Dropbox/wallpapers/dlanham\ wallpapers' sh *cmd
end end
rm_r dir rm_r dir
end end
@ -33,9 +35,9 @@ namespace :sync do
task :puzzles do task :puzzles do
Dir[File.expand_path("~/Downloads/*")].each do |file| Dir[File.expand_path("~/Downloads/*")].each do |file|
dir = case file.pathmap("%f") dir = case file.pathmap("%f")
when /^Diagramless\d+.pdf$/ when /^diagramless\d+.pdf$/i
"diagramless" "diagramless"
when /^201\dW\d.*/ when /^201\dW(?:eek)?\d.*/
"GM" "GM"
end end
next if dir.nil? next if dir.nil?
@ -47,10 +49,8 @@ namespace :sync do
desc "Sync a config" desc "Sync a config"
task :config, [:config] do |t, args| task :config, [:config] do |t, args|
config = args[:config] config = File.expand_path(args[:config])
to = config.sub(Dir.home, '\1/.dotfiles')
dotfiles = File.expand_path("..", __FILE__)
to = path.sub(Dir.home, dotfiles)
mv config, to mv config, to
ln_s to, config ln_s to, config

Loading…
Cancel
Save