Method: Jsus::Container#required_files

Defined in:
lib/jsus/container.rb

#required_files(root = nil) ⇒ Array

Lists all the required files (dependencies and extensions) for the sources in the container. Consider it a projection from source files space onto filesystem space.

Optionally accepts a filesystem point to calculate relative paths from.

Parameters:

  • root (String) (defaults to: nil)

    root point from which the relative paths are calculated. When omitted, full paths are returned.

Returns:

  • (Array)

    ordered list of required files



93
94
95
96
97
98
99
100
101
# File 'lib/jsus/container.rb', line 93

def required_files(root = nil)
  sort!
  files = sources.map {|s| s.required_files }.flatten
  if root
    root = Pathname.new(File.expand_path(root))
    files = files.map {|f| Pathname.new(File.expand_path(f)).relative_path_from(root).to_s }
  end
  files
end