12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/middleman-core/core_extensions/external_helpers.rb', line 12
def after_configuration
helpers_path = File.join(app.root, app.config[:helpers_dir])
return unless File.exist?(helpers_path)
glob = File.join(helpers_path, app.config[:helpers_filename_glob])
::Middleman::Util.glob_directory(glob).each do |filename|
module_name = app.config[:helpers_filename_to_module_name_proc].call(filename)
next unless module_name
require filename
next unless Object.const_defined?(module_name.to_sym)
app.template_context_class.send :include, Object.const_get(module_name.to_sym)
end
end
|