Sha256: d704e20c155a74a7be60adb4f8408fe43dd56fdac95b9e160347709f71241f04
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
class PhenomenalRails::Loader class << self def autoload_paths(path,paths=[]) scan_dir(path) do |filepath, entry| if File.directory?(filepath) if (filepath.match(/.*\/controllers/) || filepath.match(/.*\/models/) || filepath.match(/.*\/helpers/)) paths.push(filepath) end autoload_paths(filepath,paths) end end paths end def prepare(loading=false) phen_defined_contexts.reverse.each do |context| if !context.forgotten && (!context.persistent || !Rails.configuration.cache_classes) while phen_context_active?(context) do phen_deactivate_context(context) end if !Rails.configuration.cache_classes phen_forget_context(context) end end end if !Rails.configuration.cache_classes || loading Phenomenal::Feature.middleware.clear_activition_conditions load_files(File.expand_path(PhenomenalRails::PATH,Rails.root)) end end private def scan_dir(path, &block) if Dir.exist? path Dir.entries(path).each do |entry| if entry!="." && entry !=".." filepath=File.join(path,entry) yield(filepath, entry) end end end end def load_files(path) scan_dir(path) do |filepath, entry| if File.file?(filepath) && entry.match(/.*\.rb/) load filepath elsif File.directory?(filepath) if !(filepath.match(/.*\/controllers/) || filepath.match(/.*\/models/) || filepath.match(/.*\/helpers/)) load_files(filepath) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phenomenal_rails-1.2.5 | lib/phenomenal_rails/loader.rb |
phenomenal_rails-1.2.4 | lib/phenomenal_rails/loader.rb |