class Praxis::BootloaderStages::WarnUnloadedFiles

Attributes

enabled[RW]

Public Instance Methods

execute() click to toggle source
# File lib/praxis/bootloader_stages/warn_unloaded_files.rb, line 16
def execute
  return unless self.class.enabled

  return if application.file_layout[:app] == []

  base = application.file_layout[:app].base
  return unless base.exist?

  file_enum = base.find.to_a
  files = file_enum.select do |file|
    path = file.relative_path_from(base)
    path.extname == '.rb'
  end

  missing = Set.new(files) - application.loaded_files
  return unless missing.any?

  msg = "The following application files under #{base} were not loaded:\n"
  missing.each do |file|
    path = file.relative_path_from(base)
    msg << " * #{path}\n"
  end
  warn msg
end