Class: Jake::Package
Instance Attribute Summary
Attributes inherited from Buildable
#name
Instance Method Summary
collapse
Methods inherited from Buildable
#build_needed?, #build_path, #directory, #initialize, #packer_settings, #parent, #write!
Instance Method Details
#code(name) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/jake/package.rb', line 16
def code(name)
return @code[name] if @code[name]
settings = packer_settings(name)
output = ERB.new(source).result(@build.helper.scope)
@code[name] = settings ? Packr.pack(output, settings) : output
end
|
#files ⇒ Object
4
5
6
7
8
9
10
|
# File 'lib/jake/package.rb', line 4
def files
base = parent ? parent.files : []
base + @config[:files].map do |path|
path = "#{ directory }/#{ path }"
File.file?(path) ? path : "#{ path }.js"
end
end
|
23
24
25
26
|
# File 'lib/jake/package.rb', line 23
def
reqs = @config[:requires] || []
[super, *reqs.map { |r| "// @require #{r}" }].join("\n")
end
|
#source ⇒ Object
12
13
14
|
# File 'lib/jake/package.rb', line 12
def source
@source ||= files.map { |path| Jake.read(path) }.join("\n\n\n")
end
|