org.sonar.api.web
Class AbstractRubyTemplate

java.lang.Object
  extended by org.sonar.api.web.AbstractRubyTemplate
Direct Known Subclasses:
AbstractDashboardWidget

public abstract class AbstractRubyTemplate
extends java.lang.Object

It's useful in development environment to see browser rendering in real time while editing the template. To do that, just return an absolute path in the method getTemplatePath() :

 
   protected String getTemplatePath() {
    return "/tmp/sample_dashboard_widget.erb";
   }
 
 
Build and deploy the plugin in /extensions/plugins. The file /tmp/sample_dashboard_widget.erb will be reloaded on each request.


In production environment, you have to return the classloader path, for example "/org/sonar/myplugin/sample_dashboard_widget.erb".

Since:
1.11

Constructor Summary
AbstractRubyTemplate()
           
 
Method Summary
 java.lang.String getTemplate()
           
protected abstract  java.lang.String getTemplatePath()
          the path of the template.
protected  java.lang.String loadTemplateFromCache()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRubyTemplate

public AbstractRubyTemplate()
Method Detail

getTemplate

public java.lang.String getTemplate()

loadTemplateFromCache

protected java.lang.String loadTemplateFromCache()

getTemplatePath

protected abstract java.lang.String getTemplatePath()
the path of the template. In production environment, it's the classloader path (for example "/org/sonar/my_template.erb"). In dev mode, it's useful to return an absolute path (for example C:/temp/my_template.erb). In such a case the result is not cached.



Copyright © 2009-2010 SonarSource. All Rights Reserved.