lib/spontaneous/facet.rb in spontaneous-0.2.0.beta5 vs lib/spontaneous/facet.rb in spontaneous-0.2.0.beta6
- old
+ new
@@ -21,10 +21,20 @@
def root(*path)
return @root if path.empty?
File.join(@root, path)
end
+ def path(*args)
+ Pathname.new(@root).join(*args)
+ end
+
+ def path!(*args)
+ self.path(*args).tap do |path|
+ path.mkpath
+ end
+ end
+
def name
File.basename(root)
end
# used by publishing mechanism to place files into the appropriate subdirectories
@@ -49,14 +59,16 @@
paths.expanded(:config).each do |config_path|
Spontaneous::Site.config.load(config_path)
end
end
- def load_indexes!
+ # use Rails' alphabetical load order for initializers
+ def run_initializers
paths.expanded(:config).each do |config_path|
- index_file = config_path / "indexes.rb"
- Kernel.load(index_file) if File.exists?(index_file)
+ Dir["#{config_path / "initializers"}/*.rb"].sort.each do |initializer|
+ require initializer
+ end
end
end
def init!
end
@@ -79,16 +91,14 @@
[:lib, :schema]
end
def loaders
@loaders ||= \
- begin
- use_reloader = config.reload_classes
- {
- :schema => Spontaneous::SchemaLoader.new(schema_load_paths, use_reloader),
- :lib => Spontaneous::Loader.new(load_paths, use_reloader)
- }
- end
+ begin
+ use_reloader = config.reload_classes
+ {:schema => Spontaneous::SchemaLoader.new(schema_load_paths, use_reloader),
+ :lib => Spontaneous::Loader.new(load_paths, use_reloader) }
+ end
end
def load_paths
load_paths_for_category(:lib)
end