public class RubyPlugin extends PluginImpl
When this plugin initializes, it will instantiate a Jenkins::Plugin object which acts as the gateway for Ruby to interact with the java side.
When the RubyPlugin is loaded, it will discover, load and provide a mechanism for extensions written in Ruby that it contains to register themselves.
These Extensions are presented to Jenkins via the RubyExtensionFinder
Each plugin has its own JRuby environment
| Constructor and Description |
|---|
RubyPlugin() |
| Modifier and Type | Method and Description |
|---|---|
void |
addExtension(Object extension)
Registers an extension with the default ordiinal.
|
void |
addExtension(Object extension,
double ordinal)
Registers an extension with this Ruby plugin so that it will be found later on
This method is generally called from inside Ruby, as objects that implement
extension points register themselves.
|
Object |
callMethod(Object object,
String methodName,
Object... args)
invokes a Ruby method on the specified object in the context of this plugin's
ScriptingContainer |
static RubyPlugin |
from(org.jruby.Ruby r)
Gets the plugin that owns the container.
|
Collection<hudson.ExtensionComponent> |
getExtensions() |
File |
getLibPath() |
File |
getModelsPath() |
Object |
getNativeRubyPlugin() |
String |
getResourceURI(String relativePathFormat,
Object... args) |
File |
getScriptDir()
Returns a directory that stores all the Ruby scripts.
|
org.jruby.embed.ScriptingContainer |
getScriptingContainer() |
org.kohsuke.stapler.lang.Klass<org.jruby.RubyModule> |
klassFor(org.jruby.RubyModule module) |
String |
loadBootScript()
Loads the models.rb
|
void |
rack(org.jruby.runtime.builtin.IRubyObject servletHandler)
Let a Rack application handle the current request.
|
void |
start()
Jenkins will call this method whenever the plugin is initialized
The plugin will in turn delegate to its instance of Jenkins::Plugin
which can take action on the Ruby side.
|
void |
stop()
Jenkins will call this method whenever the plugin is shut down
The plugin will in turn delegate to its instance of Jenkins::Plugin
which can take action on the Ruby side
|
public Object callMethod(Object object, String methodName, Object... args)
ScriptingContainerobject - JRuby object to use as invocantmethodName - the method to endargs - arguments to the methodpublic void addExtension(Object extension)
public void addExtension(Object extension, double ordinal)
extension - public Collection<hudson.ExtensionComponent> getExtensions()
RubyExtensionFinder to present extension points to Jenkinspublic String loadBootScript() throws IOException
IOExceptionpublic void start()
throws Exception
start in class hudson.PluginExceptionpublic static RubyPlugin from(org.jruby.Ruby r)
public org.kohsuke.stapler.lang.Klass<org.jruby.RubyModule> klassFor(org.jruby.RubyModule module)
public void stop()
throws Exception
stop in class hudson.PluginExceptionpublic File getScriptDir()
public File getLibPath()
public File getModelsPath()
public org.jruby.embed.ScriptingContainer getScriptingContainer()
public Object getNativeRubyPlugin()
public void rack(org.jruby.runtime.builtin.IRubyObject servletHandler)
servletHandler - Instance of Rack::Handler::Servlet which wraps the actual rack application and provides
the ruby part of the rack implementation.Copyright © 2004-2013. All Rights Reserved.