Class: Jake::Package
Instance Attribute Summary
Attributes inherited from Buildable
Instance Method Summary collapse
-
#code(name) ⇒ Object
Returns the result of building the source template and minifying the output using the given named set of PackR settings.
-
#files ⇒ Object
Returns a list of paths to all the files used to build this package.
-
#source ⇒ Object
Returns the full uncompressed source code of this package, before ERB processing.
Methods inherited from Buildable
#build_needed?, #build_path, #directory, #header, #initialize, #meta, #packer_settings, #parent, #write!
Constructor Details
This class inherits a constructor from Jake::Buildable
Instance Method Details
#code(name) ⇒ Object
Returns the result of building the source template and minifying the output using the given named set of PackR settings.
23 24 25 26 27 28 |
# File 'lib/jake/package.rb', line 23 def code(name) return @code[name] if @code[name] settings = packer_settings(name) output = Jake.erb(source).result(@build.helper.scope) @code[name] = settings ? Packr.pack(output, settings) : output end |
#files ⇒ Object
Returns a list of paths to all the files used to build this package.
5 6 7 8 9 10 11 |
# File 'lib/jake/package.rb', line 5 def files base = parent ? parent.files : [] base + @config[:files].map do |path| path = Jake.path( directory, path) File.file?(path) ? path : "#{ path }.js" end end |
#source ⇒ Object
Returns the full uncompressed source code of this package, before ERB processing. ERB output will be build-dependent; this method simply builds the raw template for further processing by other methods.
17 18 19 |
# File 'lib/jake/package.rb', line 17 def source @source ||= files.map { |path| Jake.read(path) }.join("\n\n\n") end |