• Anonymous
  • Login
  • Register
Ruby in XPages - Release: Beta 1.1

Release Name Beta 1.1 Released on Apr 26, 2012
License Apache License Released by Jesse Gallagher
Status Released Downloads 45
Cleared
Yes


Download(s)

rubyinxpages-beta1.1.zip


Description

Note: Beta 1.1 is the same code as Beta 1 - the only difference is the addition of a NOTICE file.

 


Features
 
  • 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
 
 
Installation
  • Install JRuby 1.6+ on the server. The most straightforward way to do this in lieu of an Eclipse Update Site package is to download jruby-complete.jar and place it in the server's jvm/lib/ext folder, then restart HTTP
  • I'm not sure if it's necessary, but if you run into security problems, it may be required to grant the JVM additional permissions: http://www-01.ibm.com/support/docview.wss?uid=swg21279509
  • In the application where you want to use Ruby bindings, copy in the provided Java classes as Java design elements (or otherwise add them to the project's build path)
  • Modify the application's faces-config.xml to add frostillicus.ScriptingViewHandler as a view handler (see faces-config-example.xml)
  • Start using "#{ruby: ... }" bindings! I suggest starting with something simple, like <xp:text value="#{ruby:Time.now.year}"/> for troubleshooting purposes


Requirements
R 8.5.3


A release in the state 'released' can be seen and downloaded by everyone.

'Not released' releases can only be seen by project owners and project contributors.

'Disabled' releases can be seen by everyone but the actual files can not be downloaded.
A Catalog Release is for projects that are production ready and that are end-user "install friendly".

If you already have an existing project and feel that it is ready to be included in the OpenNTF Apache or GPL Catalogs you will need to send a mail to IP-Manager at openntf.org.

Learn more about the catalog.