Sha256: 50c6814d003ee417201505f1a9d3e6172d755c6bb3373d1e640d296514c6a4e3
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
module Nesta module Plugin class << self attr_accessor :loaded end self.loaded ||= [] 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 def self.initialize_plugins self.loaded.each { |name| require "#{name}/init" } end 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 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 private_class_method :require_local_plugin end end
Version data entries
6 entries across 6 versions & 1 rubygems