Skip to content

Instantly share code, notes, and snippets.

@Marahin
Created June 18, 2016 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marahin/6d5d8bf0e7dde4f5703df6e4e11b7240 to your computer and use it in GitHub Desktop.
Save Marahin/6d5d8bf0e7dde4f5703df6e4e11b7240 to your computer and use it in GitHub Desktop.
loaded = Array.new
Dir[File.dirname(__FILE__) + '/engines/*.rb'].each do |engine_file|
begin
ret = require_relative './engines/' + File.basename( engine_file )
rescue NameError => e
say "<%= color('Failed to process " + File.basename(engine_file) + ", error:', BOLD, UNDERLINE, :red) %>"
say e
rescue LoadError => e
say "<%= color('Failed to load " + File.basename(engine_file) + ", error:', BOLD, UNDERLINE, :red) %>"
else
loaded << File.basename( engine_file ) if ret
end
end
say 'Loaded modules: ' + loaded.join(', ') + '.' if loaded.any?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment