brendano /get

curl dotfiles.org/~brendano/get | ruby -
#    curl dotfiles.org/~brendano/get | ruby -

require 'open-uri'
$stdout.sync = true

$base = "http://dotfiles.org/~brendano"

def dotfiles(html=open($base).read)
  ret = []
  html.scan(/
  • .*?>(\.[^<]*)<\/a>\s*<\/li>/m){ ret << $1 } ret end home = ENV['HOME'] for dotfile in dotfiles print dotfile print " \t" newdot = `curl -s #{$base}/#{dotfile}` if ! File.exists? "#{home}/#{dotfile}" puts "saving" open("#{home}/#{dotfile}",'w'){|f| f.write newdot} else if newdot.strip == File.read("#{ENV['HOME']}/#{dotfile}").strip puts "same" next else puts "no overwrite, see changes via: diff #{dotfile} #{dotfile}.new.#{$$}" open("#{home}/#{dotfile}.new.#{$$}","w"){|f| f.write newdot} # bak = "#{home}/#{dotfile}.bak.#{$$}" # print "backup #{dotfile} => #{bak} \t" # system "cp ~/#{dotfile} #{bak}" end end end system "mv ~/vim.tgz ~/vim.bak.#{$$}.tgz" if File.exists? "#{home}/vim.tgz" system "curl http://anyall.org/vim.tgz | tar xzf -" system "mkdir -p ~/.bak" # vim:ft=ruby # curl dotfiles.org/~brendano/get | ruby -