Method: Lyp::DependencyResolver#process_include_command

Defined in:
lib/lyp/resolver.rb

#process_include_command(ref, dir, leaf, opts, location) ⇒ Object



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/lyp/resolver.rb', line 207

def process_include_command(ref, dir, leaf, opts, location)
  # a package would normally use a plain \pinclude or \pincludeOnce
  # command to include package files, e.g. \pinclude "inc/init.ly".
  #
  # But a package can also qualify the file reference with the package
  # name, in order to be able to load files after the package has already
  # been loaded, e.g. \pinclude "mypack:inc/init.ly"
  if ref =~ /^([^\:]+)\:(.+)$/
    # ignore null package (used for testing purposes only)
    return if $1 == 'null'
    ref = $2
  end
  qualified_path = File.expand_path(ref, dir)

  unless File.file?(qualified_path)
    error("Invalid include file specified in %s", location)
  end

  queue_file_for_processing(qualified_path, leaf)
end