Module: Nesta::Plugin

Defined in:
lib/nesta/plugin.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loadedObject

Returns the value of attribute loaded



4
5
6
# File 'lib/nesta/plugin.rb', line 4

def loaded
  @loaded
end

Class Method Details

.initialize_pluginsObject



15
16
17
# File 'lib/nesta/plugin.rb', line 15

def self.initialize_plugins
  self.loaded.each { |name| require "#{name}/init" }
end

.load_local_pluginsObject



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.expand_path('../plugins/*', File.dirname(__FILE__)))
  plugins.each { |path| require_local_plugin(path) }
end

.register(path) ⇒ Object



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