lib/octopress-ink/plugin.rb in octopress-ink-1.0.0.alpha.29 vs lib/octopress-ink/plugin.rb in octopress-ink-1.0.0.alpha.30

- old
+ new

@@ -5,39 +5,41 @@ :layouts, :includes, :stylesheets, :javascripts, :images, :sass, :fonts, :files def initialize(name, type) @layouts_dir = 'layouts' @files_dir = 'files' + @pages_dir = 'pages' @fonts_dir = 'fonts' @images_dir = 'images' @includes_dir = 'includes' @javascripts_dir = 'javascripts' @stylesheets_dir = 'stylesheets' + @plugins_dir = 'plugins' @config_file = 'config.yml' @name = name @type = type @layouts = [] @includes = [] @stylesheets = [] @javascripts = [] @images = [] - @root_files = [] @sass = [] @fonts = [] @files = [] + @pages = [] add_assets add_layouts + add_pages add_includes add_config + require_plugins end - def add_assets - - end + def add_assets; end def add_config - @configs = Assets::Config.new(self, @config_file) + @config_file = Assets::Config.new(self, @config_file) end def namespace if @type == 'local_plugin' '' @@ -56,10 +58,36 @@ def add_javascript(file) @javascripts << Assets::Javascript.new(self, @javascripts_dir, file) end + def add_pages + if @assets_path + base = File.join(@assets_path, @pages_dir) + entries = [] + if Dir.exists?(base) + Dir.chdir(base) { entries = Dir['**/*.*'] } + entries.each do |file| + @files << Assets::PageAsset.new(self, @pages_dir, file) + end + end + end + end + + def require_plugins + if @assets_path + base = File.join(@assets_path, @plugins_dir) + entries = [] + if Dir.exists?(base) + Dir.chdir(base) { entries = Dir['**/*.rb'] } + entries.each do |file| + require File.join base, file + end + end + end + end + def add_layouts if @assets_path base = File.join(@assets_path, @layouts_dir) entries = [] if Dir.exists?(base) @@ -153,11 +181,10 @@ def include(file) @includes.file file end - def configs - @config ||= @configs.read - @config + def config + @config ||= @config_file.read end end end