2010-04-23 22:20:37 +00:00
|
|
|
module Fog
|
|
|
|
module Deprecation
|
|
|
|
|
|
|
|
def deprecate(older, newer)
|
|
|
|
class_eval <<-EOS, __FILE__, __LINE__
|
2010-04-25 18:26:48 +00:00
|
|
|
def #{older}(*args)
|
2010-05-03 21:11:11 +00:00
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] #{self} => ##{older} is deprecated, use ##{newer} instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
2010-05-04 21:31:42 +00:00
|
|
|
send(:#{newer}, *args)
|
2010-04-23 22:20:37 +00:00
|
|
|
end
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|