class Assets
Public Class Methods
new()
click to toggle source
# File lib/zarchitect/assets.rb, line 5 def initialize @from = ASSETDIR @to = File.join(HTMLDIR, ASSETSDIR) end
Public Instance Methods
copy_file(a, b)
click to toggle source
# File lib/zarchitect/assets.rb, line 45 def copy_file(a, b) GPI.print "Copying from #{a} to #{b}.", GPI::CLU.check_option('v') File.copy(a, b) end
cpdirs()
click to toggle source
# File lib/zarchitect/assets.rb, line 32 def cpdirs Dir[ File.join(@from, '**', '*') ].reject do |fullpath| path = fullpath[(@from.length)..-1] if path.include?(HTMLDIR) realpath = path[1..-1] else realpath = File.join(@to, path) Util.mkdir(realpath) if File.directory?(fullpath) end end end
update()
click to toggle source
# File lib/zarchitect/assets.rb, line 10 def update Dir[ File.join(@from, '**', '*') ].reject do |fullpath| path = fullpath[(@from.length)..-1] if path.include?(HTMLDIR) realpath = path[1..-1] else realpath = File.join(@to, path) Util.mkdir(realpath) if File.directory?(fullpath) end next if File.directory?(fullpath) if File.exist?(realpath) if File.stat(fullpath).mtime > File.stat(realpath).mtime copy_file(fullpath, realpath) end else copy_file(fullpath, realpath) end end end