lib/linner/asset.rb in linner-0.3.2 vs lib/linner/asset.rb in linner-0.4.0
- old
+ new
@@ -1,5 +1,7 @@
+require "digest"
+
module Linner
class Asset
attr_accessor :path, :content
@@ -10,9 +12,23 @@
end
end
def mtime
@mtime
+ end
+
+ def extname
+ File.extname @path
+ end
+
+ def digest
+ Digest::MD5.hexdigest content
+ end
+
+ def revision!
+ revision = @path.chomp(extname) << "-#{digest}" << extname
+ File.rename @path, revision
+ revision.gsub /#{Linner.env.public_folder}/, ""
end
def content
return @content if @content
source = begin