lib/linner.rb in linner-0.7.2 vs lib/linner.rb in linner-0.7.3

- old
+ new

@@ -60,26 +60,28 @@ # revision sprite assets sprite_assets.flatten.each do |dest| name = File.basename(dest).sub /[^.]+\z/, "png" dest = File.join env.sprites["path"], name asset = Asset.new(File.join env.public_folder, dest) - hash[dest] = env.revision["prefix"] + asset.relative_digest_path + prefix = env.revision["prefix"] || "" + hash[dest] = prefix + asset.relative_digest_path asset.revision! (concat_assets + copy_assets).flatten.each do |file| path = File.join env.public_folder, file next unless Asset.new(path).stylesheet? - puts = File.read(path).gsub(File.join(env.sprites["path"], File.basename(dest)), File.join(env.revision["prefix"], env.sprites["path"], File.basename(asset.relative_digest_path))) + puts = File.read(path).gsub(File.join(env.sprites["path"], File.basename(dest)), File.join(prefix, env.sprites["path"], File.basename(asset.relative_digest_path))) File.open(path, "w") { |file| file << puts } end end # revision concat template and copy assets (concat_assets + template_assets + copy_assets).flatten.each do |dest| asset = Asset.new(File.join env.public_folder, dest) + prefix = env.revision["prefix"] || "" next unless asset.revable? - hash[dest] = env.revision["prefix"] + asset.relative_digest_path + hash[dest] = prefix + asset.relative_digest_path asset.revision! end hash end @@ -110,11 +112,11 @@ end env.groups.each do |config| copy(config) if config["copy"] concat(config) if config["concat"] end - revision if compile? and env.revision and env.revision["files"] + revision if compile? and env.revision end private def concat(config) config["concat"].each_with_index do |pair, index| @@ -162,11 +164,12 @@ end end def revision dump_manifest - env.revision["files"].flatten.each do |rev| + files = env.revision["files"] || [] + files.flatten.each do |rev| file = File.join env.public_folder, rev.to_s next if not File.exist?(file) replace_attributes file end end @@ -225,10 +228,11 @@ end File.open(file, "w") {|f| f.write doc} end def dump_manifest - File.open(File.join(env.public_folder, env.revision["manifest"]), "w") do |f| + manifest_file = env.revision["manifest"] || "manifest.yml" + File.open(File.join(env.public_folder, manifest_file), "w") do |f| YAML.dump(manifest, f) end end end