Method: FPM::Package::Docker#split

Defined in:
lib/fpm/package/docker.rb

#split(name, map) ⇒ Object

Loads all files from a docker container into multiple paths defined by map param.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fpm/package/docker.rb', line 36

def split( name, map )
  changes = changes(name)
  changes.remove_modified_leaves!(changes_to_remove) do | kind, ml |
    if kind == DELETED
      logger.warn("Found a deleted file. You can't delete files as part of a package.", name: ml)
    elsif !keep_modified_files
      logger.warn("Found a modified file. You can't modify files in a package.", name: ml)
    end
  end
  fmap = {}
  changes.leaves.each do | change |
    map.each do | match, to |
      if File.fnmatch?(match, change)
        fmap[change] = File.join(to, change)
        break
      end
    end
  end
  directories = changes.smallest_superset
  directories.each do |chg|
    client.copy(name, chg, fmap, chown: false)
  end
  return nil
end