Sha256: 1fdc92336a42064ab1411ecf4a823b8541c6adf23a675754000bcbd72344d631
Contents?: true
Size: 807 Bytes
Versions: 8
Compression:
Stored size: 807 Bytes
Contents
namespace :cache do task :update do require "rexml/document" list = FileList["**/*--latest.{css,js,png,gif,jpg}"] list.each do |path| src = %x{svn info --xml #{path}} begin doc = REXML::Document.new(src) revision = doc.elements['/info/entry/commit/@revision'].value rescue puts "Can't get revision number: #{path}" end to = path.pathmap("%{--latest$,-#{revision}}X%x") if File.exist?(to) puts " SKIP(exists): #{path} -> #{to}" next else puts " COPY: #{path} -> #{to}" end unless ENV["DRYRUN"] next if File.exist?(to) begin FileUtils.copy(path,to) rescue => e puts " ERROR: #{e} #{path} -> #{to}" end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems