Permalink
Browse files

cache busting with md5, better readme

  • Loading branch information...
1 parent 78c03b4 commit 1ab6147b7d4d7b3fb4da0de4c12a8b9d8d4e59d4 @voloko committed Apr 4, 2010
Showing with 7 additions and 5 deletions.
  1. +1 −1 frameworks/uki
  2. +5 −3 lib/uki/project.rb
  3. +1 −1 uki.gemspec
Submodule uki updated from 3cb4b8 to 0cfee6
View
@@ -4,6 +4,7 @@
require 'pathname'
require 'uki/include_js'
require 'base64'
+require 'digest/md5'
class Uki::Project
attr_accessor :dest
@@ -30,8 +31,8 @@ def build target, options = {}
init_target target
containers = find_containers
cjs = extract_cjs(containers)
- build_containers containers, target, options
build_js cjs, target, options
+ build_containers containers, target, options
build_images target, options
end
@@ -134,8 +135,9 @@ def compile_js file
def build_containers containers, target, options
containers.each do |c|
- code = File.read(c).gsub(%r{=\s*["']?([^"' ]+.cjs)}) do |match|
- match.sub('.cjs', '.js')
+ code = File.read(c).gsub(%r{=\s*["']?(([^"' ]+).cjs)}) do |match|
+ md5 = Digest::MD5.file(File.join(target, "#{$2}.js")).hexdigest
+ match.sub('.cjs', ".js?#{md5}")
end
File.open(File.join(target, File.basename(c)), 'w') do |f|
f.write code
View
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Vladimir Kolesnikov"]
- s.date = %q{2010-04-04}
+ s.date = %q{2010-04-05}
s.default_executable = %q{uki}
s.description = %q{Project creation, dev server, testing, building for uki apps}
s.email = %q{voloko@gmail.com}

0 comments on commit 1ab6147

Please sign in to comment.