Class Mack::Portlet::Unpacker
In: lib/mack/portlets/unpacker.rb
Parent: Mack::Utils::RegistryMap

Methods

Public Instance methods

[Source]

    # File lib/mack/portlets/unpacker.rb, line 28
28:       def initial_state
29:         {}
30:       end

[Source]

    # File lib/mack/portlets/unpacker.rb, line 5
 5:       def unpack(key, force = false)
 6:         m = self.registered_items[key.to_sym]
 7:         if m
 8:           m.call((force || false))
 9:         else
10:           Mack.search_path(key.to_sym, false).each do |path|
11:             Dir.glob(File.join(path, '**/*')).each do |f|
12:               f = File.expand_path(f)
13:               dest = f.gsub(path, Mack::Paths.send(key))
14:               FileUtils.mkdir_p(File.dirname(dest))
15:               if File.file?(f)
16:                 cp = File.exists?(dest) ? force : true
17:                 if cp
18:                   FileUtils.cp(f, f.gsub(path, Mack::Paths.send(key)), :verbose => true) if cp
19:                 else
20:                   puts "Skipping: #{dest}"
21:                 end
22:               end
23:             end
24:           end
25:         end
26:       end

[Validate]