Class: Jake::Bundle

Inherits:
Buildable show all
Defined in:
lib/jake/bundle.rb

Instance Attribute Summary

Attributes inherited from Buildable

#name

Instance Method Summary collapse

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(build_name) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jake/bundle.rb', line 13

def code(build_name)
  return @code[build_name] if @code[build_name]
  
  packer = packer_settings(build_name)
  joiner = (packer[:minify] == false) ? "\n" : ""
  
  code = @config[:files].map { |pkg| @build.package(pkg).code(build_name, false) }.join(joiner)
  if head = header
    code = head + code
  end
  
  @code[build_name] = code
end

#filesObject



4
5
6
7
# File 'lib/jake/bundle.rb', line 4

def files
  base = parent ? parent.files : []
  base + @config[:files].map { |pkg| @build.package(pkg).files }.flatten
end

#sourceObject



9
10
11
# File 'lib/jake/bundle.rb', line 9

def source
  @source ||= @config[:files].map { |pkg| @build.package(pkg).source }.join("\n")
end