lib/octopress-ink/plugins.rb in octopress-ink-1.0.0.alpha.17 vs lib/octopress-ink/plugins.rb in octopress-ink-1.0.0.alpha.18
- old
+ new
@@ -21,10 +21,29 @@
def self.plugins
[@theme].concat(@plugins).concat(@local_plugins).compact
end
+ def self.config(site)
+ if @config
+ @config
+ else
+ @config = {}
+ @config['plugins'] = {}
+ @config['theme'] = @theme.configs(site)
+
+
+ plugins.each do |p|
+ unless p == @theme
+ @config['plugins'][p.name] = p.configs(site)
+ end
+ end
+
+ @config
+ end
+ end
+
def self.include(name, file, site)
p = plugin(name)
p.include(file, site)
end
@@ -45,11 +64,15 @@
plugins.each do |p|
p.layouts.clone.each { |layout| layout.register(site) }
end
end
- def self.custom_dir(site)
- site.config['custom'] || CUSTOM_DIR
+ def self.custom_dir(config)
+ if config['octopress'] and config['octopress']['custom']
+ config['octopress']['custom']
+ else
+ CUSTOM_DIR
+ end
end
def self.fingerprint(paths)
paths = [paths] unless paths.is_a? Array
Digest::MD5.hexdigest(paths.clone.map! { |path| "#{File.mtime(path).to_i}" }.join)