Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »




Ruby on Rails applications allow plugins to extend the Sonar webapp with a complete MVC stack : controllers, helpers, models and views. Contrary to widgets, it does not require to declare a Java component. Ruby sources just have to be stored in the plugin directory : /src/main/resources/org/sonar/ror/<plugin key>. This directory must also contain an empty file named init.rb.

Example for an application provided by the plugin with key 'foo' :

  • src/
    • main/
      • resources/
        • org/
          • sonar/
            • ror/
              • foo/
                • init.rb
                • app/
                  • controllers/
                    • first_foo_controller.rb
                    • second_foo_controller.rb
                  • helpers/
                    • first_foo_helper.rb
                  • views/
                    • first_foo/
                      • index.html.erb
                    • second_foo/
                      • index.html.erb
                      • _foo_partial.html.erb

Development Mode


Static Files

Plugins can provide static files like images, CSS or JS files. They have to be copied in src/main/resources/static and then can by accessible from the public URL :

The URL can be generated from widgets or applications with the Ruby helper function :

Note that the plugin key is logged during the maven build :


Static files are not deployed on the fly when the development mode is enabled. The plugin has to be built and re-installed after changes.

  • No labels