def resource(gem_name, path)
            if not loaded? gem_name
                raise PluginNotLoaded.new("Plugin #{gem_name} not loaded when getting resource #{path}")
            end

            file = File.join(@gems[gem_name], "resources", path)

            if File.exist? file
                return file
            else
                return nil
            end
        end
def resource(gem_name, path)
            if not loaded? gem_name
                raise PluginNotLoaded.new("Plugin #{gem_name} not loaded when getting resource #{path}")
            end

            file = File.join(@gems[gem_name], "resources", path)

            if File.exist? file
                return file
            else
                return nil
            end
        end
GemPlugins can have a 'resources' directory which is packaged with them
 and can hold any data resources the plugin may need.  The main problem
 is that it's difficult to figure out where these resources are
 actually located on the file system.  The resource method tries to
 locate the real path for a given resource path.

 Let's say you have a 'resources/stylesheets/default.css' file in your
 gem distribution, then finding where this file really is involves:

   Manager.instance.resource("mygem", "/stylesheets/default.css")

 You either get back the full path to the resource or you get a nil
 if it doesn't exist.

 If you request a path for a GemPlugin that hasn't been loaded yet
 then it will throw an PluginNotLoaded exception.  The gem may be
 present on your system in this case, but you just haven't loaded
 it with Manager.instance.load properly.