def self.plugin(name, mod)
name = name.to_sym
return false if EXTENSIONS.has_key?(name)
methods = Capistrano::Configuration.public_instance_methods +
Capistrano::Configuration.protected_instance_methods +
Capistrano::Configuration.private_instance_methods
if methods.include?(name.to_s)
raise Capistrano::Error, "registering a plugin named `#{name}' would shadow a method on Capistrano::Configuration with the same name"
end
Capistrano::Configuration.class_eval "def \#{name}\n@__\#{name}_proxy ||= Capistrano::ExtensionProxy.new(self, Capistrano::EXTENSIONS[\#{name.inspect}])\nend\n", __FILE__, __LINE__+1
EXTENSIONS[name] = mod
return true
end