Changeset 6438
- Timestamp:
- 03/16/07 22:11:45 (1 year ago)
- Files:
-
- tools/capistrano/lib/capistrano/extensions.rb (modified) (4 diffs)
- tools/capistrano/test/extensions_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/capistrano/lib/capistrano/extensions.rb
r6436 r6438 1 1 module Capistrano 2 class ExtensionProxy 2 class ExtensionProxy #:nodoc: 3 3 def initialize(config, mod) 4 4 @config = config … … 11 11 end 12 12 13 # Holds the set of registered plugins, keyed by name (where the name is a 14 # symbol). 13 15 EXTENSIONS = {} 14 16 17 # Register the given module as a plugin with the given name. It will henceforth 18 # be available via a proxy object on Configuration instances, accessible by 19 # a method with the given name. 15 20 def self.plugin(name, mod) 21 name = name.to_sym 16 22 return false if EXTENSIONS.has_key?(name) 23 24 methods = Capistrano::Configuration.public_instance_methods + 25 Capistrano::Configuration.protected_instance_methods + 26 Capistrano::Configuration.private_instance_methods 27 28 if methods.include?(name.to_s) 29 raise Capistrano::Error, "registering a plugin named `#{name}' would shadow a method on Capistrano::Configuration with the same name" 30 end 17 31 18 32 Capistrano::Configuration.class_eval <<-STR, __FILE__, __LINE__+1 … … 26 40 end 27 41 42 # Unregister the plugin with the given name. 28 43 def self.remove_plugin(name) 44 name = name.to_sym 29 45 if EXTENSIONS.delete(name) 30 46 Capistrano::Configuration.send(:remove_method, name) … … 35 51 end 36 52 37 def self.configuration(*args) 53 def self.configuration(*args) #:nodoc: 38 54 warn "[DEPRECATION] Capistrano.configuration is deprecated. Use Capistrano::Configuration.instance instead" 39 55 Capistrano::Configuration.instance(*args)