class AppcachePathGenerator

Public Class Methods

new(source_dir) click to toggle source
# File lib/appcache_path_generator.rb, line 5
def initialize source_dir
  @source_dir = source_dir
end

Public Instance Methods

appcache_version() click to toggle source

might be better placed elsewhere

# File lib/appcache_path_generator.rb, line 20
def appcache_version

  md5 = Digest::MD5.new
  content = ''

  paths.each do |file|
    content << File.read(File.join(@source_dir, file))
  end

  md5.hexdigest content
end
paths() click to toggle source
# File lib/appcache_path_generator.rb, line 9
def paths
  resources = []
  # cd into dir so glob does not contain first path part prefix in paths
  # e.g. if dir is build/ glob would contain build/foo/bat, but we want foo/bat
  Dir.chdir(@source_dir) do
    resources = Dir["**/*"].reject { |i| File.directory? i }
  end
  resources.sort
end