Module: Nesta::Plugin
- Defined in:
- lib/nesta/plugin.rb
Class Attribute Summary (collapse)
-
+ (Object) loaded
Returns the value of attribute loaded.
Class Method Summary (collapse)
- + (Object) initialize_plugins
- + (Object) load_local_plugins
- + (Object) register(path)
- + (Object) require_local_plugin(path)
Class Attribute Details
+ (Object) loaded
Returns the value of attribute loaded
4 5 6 |
# File 'lib/nesta/plugin.rb', line 4 def loaded @loaded end |
Class Method Details
+ (Object) initialize_plugins
15 16 17 |
# File 'lib/nesta/plugin.rb', line 15 def self.initialize_plugins self.loaded.each { |name| require "#{name}/init" } end |
+ (Object) load_local_plugins
19 20 21 22 23 24 |
# File 'lib/nesta/plugin.rb', line 19 def self.load_local_plugins # This approach is deprecated; plugins should now be distributed # as gems. See http://nestacms.com/docs/plugins/writing-plugins plugins = Dir.glob(File.('../plugins/*', File.dirname(__FILE__))) plugins.each { |path| require_local_plugin(path) } end |
+ (Object) register(path)
8 9 10 11 12 13 |
# File 'lib/nesta/plugin.rb', line 8 def self.register(path) name = File.basename(path, '.rb') prefix = 'nesta-plugin-' name.start_with?(prefix) || raise("Plugin names must match '#{prefix}*'") self.loaded << name end |
+ (Object) require_local_plugin(path)
26 27 28 29 30 31 32 |
# File 'lib/nesta/plugin.rb', line 26 def self.require_local_plugin(path) Nesta.deprecated( 'loading plugins from ./plugins', "convert #{path} to a gem") require File.join(path, 'lib', File.basename(path)) rescue LoadError => e $stderr.write("Couldn't load plugins/#{File.basename(path)}: #{e}\n") end |