Class: Distil::CacheManifestProduct

Inherits:
Product
  • Object
show all
Defined in:
lib/distil/product/cache-manifest-product.rb

Instance Attribute Summary

Attributes inherited from Product

#assets, #files, #language, #libraries, #project, #variant

Instance Method Summary collapse

Methods inherited from Product

#clean, #filename, #gzip, #gzip_filename, #handles_file?, #include_file, #initialize, #minimise, #minimised_filename, #notice_comment, #output_path, #up_to_date?

Constructor Details

This class inherits a constructor from Distil::Product

Instance Method Details

#buildObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/distil/product/cache-manifest-product.rb', line 7

def build
  FileUtils.mkdir_p(File.dirname(output_path))
  File.open(output_path, "w") { |output|
    output.puts "CACHE MANIFEST"
    output.puts "# generated @ #{Time.new.rfc2822}"
    output.puts
    output.puts "# products"
    project.products.each { |p|
      next if (DEBUG_VARIANT == p.variant || self==p)
      if p.is_a?(HtmlProduct)
        p.files.each { |f|
          output.puts File.basename(f)
        }
      else
        output.puts project.relative_output_path_for(p.minimised_filename)
      end
    }
    output.puts
    output.puts "# assets"
    project.assets.each { |a|
      output.puts project.relative_output_path_for(a)
    }
    
    # Added a NETWORK catch all section
    output.puts
    output.puts "NETWORK:"
    output.puts "*"
  }
end