The point of Ruby-in-XPages is to extend an XPage application's value/method binding capabilities to allow for Ruby code via "#{ruby: ... }" bindings. To accomplish this, it hooks into the JSF runtime to register JRuby (available at jruby.org) as a handler for that prefix.

 

<strong>Features</strong></div>
  • Works with both #-style and $-style bindings and for both value bindings and method bindings (e.g. beforePageLoad)
  • Allows for Ruby "Script Libraries". For now, these are accomplished by creating a "ruby" folder inside the database's WEB-INF folder (via Package Explorer) and putting Ruby scripts in there. Then, they can be references on a page like a normal library but with "text/ruby" or "text/x-ruby" as the type: <xp:script src="/somelibrary.rb" type="text/ruby" clientSide="false"/>
  • Can access local variables as readily as in Server JavaScript, such as "session", "database", and repeat-local variables
  • The included file "domino.rb" contains some extensions for the Domino product objects in Ruby, allowing for Ruby-style looping in collection classes (e.g. docs.each { |doc| ... }) and hash-style access to a document's item values (e.g. doc["Form"]). It is meant to be added to the project as a "Script Library" as described above
  • Though currently commented out, there is some extremely-basic support for arbitrary other scripting languages. If you uncomment the applicable/* */ block in frostillicus/ScriptingViewHandler.java, it will register all available JSR-223-compliant languages with binding names based on the language name provided by the language package (such as "#{Groovy: ... }" or "#{scheme: ... }"). Note that other languages have had essentially no testing, Jython is known to be problematic, and there is no automatic variable resolution. See http://frostillic.us/f.nsf/posts/F660516EC59A25FC852579E5007D5F9C for a casual overview

 

<strong>Caveats</strong></div>
  • This has not been extensively tested! While I personally am using it to develop my blog, that is a far cry from "real" production use
&nbsp;

<strong>Requirements</strong></div>

&nbsp;
  • Having only developed this in Domino 8.5.3, I can't say whether or not it requires that version
  • JRuby 1.6+
  • A willingness to put up with beta software crashing HTTP and a familiarity with Designer's Package Explorer view
  • Though not required, it may be useful to install Ruby syntax highlighting in Designer: http://frostillic.us/f.nsf/posts/9596C553131169E4852579DA00737040

 

Development is currently included as part of a blog project on GitHub: https://github.com/jesse-gallagher/frostillic.us-Blog