--- a/core/moduleapi.lua Wed Mar 14 23:44:24 2012 +0000
+++ b/core/moduleapi.lua Thu Mar 15 02:52:31 2012 +0000
@@ -292,4 +292,18 @@
end
end
+function api:provides(name, item)
+ if not item then item = self.environment; end
+ if not item.name then
+ local item_name = module.name;
+ -- Strip a provider prefix to find the item name
+ -- (e.g. "auth_foo" -> "foo" for an auth provider)
+ if item_name:find(name.."_", 1, true) == 1 then
+ item_name = item_name:sub(#name+2);
+ end
+ item.name = item_name;
+ end
+ self:add_item(name, item);
+end
+
return api;