lib/octopress-ink.rb in octopress-ink-1.0.0.alpha.31 vs lib/octopress-ink.rb in octopress-ink-1.0.0.alpha.32

- old
+ new

@@ -1,54 +1,109 @@ require 'jekyll' require 'sass' require 'digest/md5' +require 'pry-debugger' require 'octopress-ink/version' require 'octopress-ink/generators/plugin_assets' require 'octopress-ink/jekyll/hooks' require 'octopress-ink/version' require 'octopress-ink/helpers/titlecase' module Octopress - autoload :Helpers, 'octopress-ink/helpers' - autoload :Filters, 'octopress-ink/filters' - autoload :Assets, 'octopress-ink/assets' - autoload :Page, 'octopress-ink/jekyll/page' - autoload :StaticFile, 'octopress-ink/jekyll/static_file' - autoload :StaticFileContent, 'octopress-ink/jekyll/static_file_content' - autoload :Plugins, 'octopress-ink/plugins' - autoload :Plugin, 'octopress-ink/plugin' - autoload :Tags, 'octopress-ink/tags' - autoload :StylesheetsPlugin, 'octopress-ink/plugins/stylesheets' + module Ink + autoload :Helpers, 'octopress-ink/helpers' + autoload :Filters, 'octopress-ink/filters' + autoload :Assets, 'octopress-ink/assets' + autoload :Page, 'octopress-ink/jekyll/page' + autoload :StaticFile, 'octopress-ink/jekyll/static_file' + autoload :StaticFileContent, 'octopress-ink/jekyll/static_file_content' + autoload :Plugins, 'octopress-ink/plugins' + autoload :Plugin, 'octopress-ink/plugin' + autoload :Tags, 'octopress-ink/tags' + autoload :StylesheetsPlugin, 'octopress-ink/plugins/stylesheets' - def self.register_plugin(plugin, name, type='plugin') - Plugins.register_plugin(plugin, name, type) - end + if defined? Octopress::Command + require 'octopress-ink/commands/helpers' + require 'octopress-ink/commands' + end - def self.version - version = "Jekyll v#{Jekyll::VERSION}, " - if defined? Octopress::VERSION - version << "Octopress v#{Octopress::VERSION} " + def self.register_plugin(plugin, name, type='plugin') + Plugins.register_plugin(plugin, name, type) end - version << "Octopress Ink v#{Octopress::Ink::VERSION}" - end + def self.version + version = "Jekyll v#{Jekyll::VERSION}, " + if defined? Octopress::VERSION + version << "Octopress v#{Octopress::VERSION} " + end + version << "Octopress Ink v#{Octopress::Ink::VERSION}" + end + + def self.site + log_level = Jekyll.logger.log_level + Jekyll.logger.log_level = Jekyll::Stevenson::WARN + @site ||= Jekyll::Site.new(Jekyll.configuration({})) + Jekyll.logger.log_level = log_level + @site + end + + def self.plugins + return @plugins if @plugins + s = site #spin up Jekyll to load all plugins + @plugins = Plugins + @plugins.site = s + @plugins + end + + def self.plugin(name) + begin + plugins.plugin(name) + rescue + return false + end + end + + def self.plugin_info(name, options) + if p = plugin(name) + p.info(options) + end + end + + def self.info + message = "Octopress Ink - v#{VERSION}\n" + if plugins.size > 0 + message += "Plugins:\n" + plugins.each do |plugin| + name = plugin.name + name += ' (theme)' if plugin.type == 'theme' + message += "- #{name} ".ljust(30) + message += "v#{plugin.version} - " if plugin.version + message += plugin.description if plugin.description + message += "\n" + end + else + message += "Plugins: none" + end + puts message + end + end end -Liquid::Template.register_filter Octopress::Filters +Liquid::Template.register_filter Octopress::Ink::Filters -Liquid::Template.register_tag('include', Octopress::Tags::IncludeTag) -Liquid::Template.register_tag('assign', Octopress::Tags::AssignTag) -Liquid::Template.register_tag('capture', Octopress::Tags::CaptureTag) -Liquid::Template.register_tag('return', Octopress::Tags::ReturnTag) -Liquid::Template.register_tag('filter', Octopress::Tags::FilterTag) -Liquid::Template.register_tag('render', Octopress::Tags::RenderTag) -Liquid::Template.register_tag('octopress_js', Octopress::Tags::JavascriptTag) -Liquid::Template.register_tag('octopress_css', Octopress::Tags::StylesheetTag) -Liquid::Template.register_tag('content_for', Octopress::Tags::ContentForTag) -Liquid::Template.register_tag('yield', Octopress::Tags::YieldTag) -Liquid::Template.register_tag('wrap', Octopress::Tags::WrapTag) -Liquid::Template.register_tag('abort', Octopress::Tags::AbortTag) -Liquid::Template.register_tag('_', Octopress::Tags::LineCommentTag) +Liquid::Template.register_tag('include', Octopress::Ink::Tags::IncludeTag) +Liquid::Template.register_tag('assign', Octopress::Ink::Tags::AssignTag) +Liquid::Template.register_tag('capture', Octopress::Ink::Tags::CaptureTag) +Liquid::Template.register_tag('return', Octopress::Ink::Tags::ReturnTag) +Liquid::Template.register_tag('filter', Octopress::Ink::Tags::FilterTag) +Liquid::Template.register_tag('render', Octopress::Ink::Tags::RenderTag) +Liquid::Template.register_tag('octopress_js', Octopress::Ink::Tags::JavascriptTag) +Liquid::Template.register_tag('octopress_css', Octopress::Ink::Tags::StylesheetTag) +Liquid::Template.register_tag('content_for', Octopress::Ink::Tags::ContentForTag) +Liquid::Template.register_tag('yield', Octopress::Ink::Tags::YieldTag) +Liquid::Template.register_tag('wrap', Octopress::Ink::Tags::WrapTag) +Liquid::Template.register_tag('abort', Octopress::Ink::Tags::AbortTag) +Liquid::Template.register_tag('_', Octopress::Ink::Tags::LineCommentTag) -Octopress.register_plugin(Octopress::StylesheetsPlugin, 'user stylesheets', 'local_plugin') +Octopress::Ink.register_plugin(Octopress::Ink::StylesheetsPlugin, 'user stylesheets', 'local_plugin')