Module: Thoth::Plugin
- Defined in:
- lib/thoth/plugin.rb,
lib/thoth/plugin/thoth_tags.rb,
lib/thoth/plugin/thoth_flickr.rb,
lib/thoth/plugin/thoth_twitter.rb,
lib/thoth/plugin/thoth_pinboard.rb,
lib/thoth/plugin/thoth_delicious.rb
Overview
Namespace for Thoth plugins. See wiki.github.com/pagojo/rethoth/creating-plugins for more info on creating and using plugins.
Defined Under Namespace
Modules: Delicious, Flickr, Pinboard, Tags, Twitter
Class Method Summary collapse
- .const_missing(name) ⇒ Object
-
.load(name) ⇒ Object
Attempts to load the specified plugin, first from the project’s
/plugindirectory, then from Thoth’s and then as a gem.
Class Method Details
.const_missing(name) ⇒ Object
36 37 38 39 |
# File 'lib/thoth/plugin.rb', line 36 def self.const_missing(name) self.load(name) self.const_get(name) end |
.load(name) ⇒ Object
Attempts to load the specified plugin, first from the project’s /plugin directory, then from Thoth’s and then as a gem.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/thoth/plugin.rb', line 43 def self.load(name) plugin = "thoth_#{name.to_s.downcase.gsub(/^thoth_/, '')}" files = Dir["{#{HOME_DIR}/plugin,#{LIB_DIR}/plugin," << "#{$:.join(',')}}/#{plugin}.rb"] # First try to load a local copy of the plugin, then try the gem. unless (files.any? && require(files.first)) || require(plugin) raise LoadError, "Thoth::Plugin::#{name} not found" end Ramaze::Log.info "Loaded plugin: #{plugin}" true end |