Sha256: 8570a483b374dab061d3e52c2ae4bd0091406d6349371682028f36b4372645d5
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
module Lono::Builder::Context::Loaders module LoadFiles # Load custom helper methods from project def load_files(dir) paths = Dir.glob("#{dir}/**/*.rb") paths.sort_by! { |p| p.size } # so namespaces are loaded first paths.each do |path| # helpers = blueprint or project extensions filename = path.sub(%r{.*/helpers/},'').sub('.rb','') module_name = filename.camelize # Prepend a period so require works LONO_ROOT is set to a relative path without a period. # # Example: LONO_ROOT=tmp/lono_project first_char = path[0..0] path = "./#{path}" unless %w[. /].include?(first_char) require path self.class.send :include, module_name.constantize end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lono-8.0.0.pre.rc2 | lib/lono/builder/context/loaders/load_files.rb |