Class: Pakman::Copier

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging
Defined in:
lib/pakman/copier.rb

Instance Method Summary collapse

Constructor Details

#initialize(old_logger_do_not_use = nil) ⇒ Copier

todo/fix: remove logger from c’tor use logutils instead



11
12
13
14
15
# File 'lib/pakman/copier.rb', line 11

def initialize( old_logger_do_not_use=nil )
  if old_logger_do_not_use != nil
       puts "*** depreciated API call [Pakman::Copier.initialize] - do NOT pass in logger; no longer required/needed; logger arg will get removed"
  end
end

Instance Method Details

#copy_pak(manifestsrc, pakpath) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/pakman/copier.rb', line 18

def copy_pak( manifestsrc, pakpath )

  start = Time.now

  pakname = Pakman.pakname_from_file( manifestsrc )

  puts "Copying template pack '#{pakname}'"

  ## todo: after depreciate change back to just load_file
  manifest = Manifest.load_file_v2( manifestsrc )

  manifest.each do |entry|
    dest   = entry[0]
    source = entry[1]

    # get full (absolute) path and make sure path exists
    destfull = File.expand_path( dest, pakpath )
    destpath = File.dirname( destfull )
    FileUtils.makedirs( destpath ) unless File.directory?( destpath )

    logger.debug "destfull=>#{destfull}<"
    logger.debug "destpath=>#{destpath}<"
    
    puts "  Copying to #{dest} from #{source}..."
    FileUtils.copy( source, destfull )
  end
  
  puts "Done (in #{Time.now-start} s)."
end