Module: RapperLite::Build

Included in:
Engine
Defined in:
lib/rapper_lite/build.rb

Instance Method Summary collapse

Instance Method Details

#build_package(type, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rapper_lite/build.rb', line 6

def build_package( type, name )
  source_paths = self.file_paths( type, name )
  destination_file = self.destination_path( type, name )
  tempfiles = []
  
  source_paths.map! do |source_path|
    tempfile, path = self.process( source_path )
    # Keep reference so GC doesn't unlink file
    tempfiles << tempfile if tempfile
    path
  end
  
  # Join files and compress if needed
  self.join_files( source_paths, destination_file )
  self.compress( destination_file ) if self.compress?( type )
  
  # Cleanup
  tempfiles.each{ |tempfile| tempfile.unlink }
end