[meta] rake sync:puzzles, sync:config

pull/28/head
Alpha Chen 8 years ago
parent d807642fbc
commit 1362c08dd7

@ -29,25 +29,31 @@ namespace :sync do
end end
end end
desc "Sync crosswords from ~/Downloads" desc "Sync puzzles from ~/Downloads"
task :crosswords do task :puzzles do
# Dir[File.expand_path('~/Downloads/*.puz')].each do |puz| Dir[File.expand_path("~/Downloads/*")].each do |file|
# crossword = File.basename(puz, '.puz') dir = case file.pathmap("%f")
# dir = case crossword when /^Diagramless\d+.pdf$/
# when /av\d{6}/ "diagramless"
# 'AV' when /^201\dW\d.*/
# when /\d{3}[a-zA-Z]+/ "GM"
# 'BEQ' end
# when /mgwcc\d{3}/ next if dir.nil?
# 'MGWCC'
# when /[A-Z][a-z]{2}\d{4}/ dir = File.expand_path(File.join("~/Dropbox/Shared/Puzzles", dir))
# 'NYT' mv file, dir
# else end
# 'etc' end
# end
# dir = File.expand_path("~/Dropbox/Shared/Crosswords/#{dir}") desc "Sync a config"
# FileUtils.mv puz, to, verbose: true task :config, [:config] do |t, args|
# end config = args[:config]
dotfiles = File.expand_path("..", __FILE__)
to = path.sub(Dir.home, dotfiles)
mv config, to
ln_s to, config
end end
end end

Loading…
Cancel
Save