Contents
Ruby Ruby on Rails and the Growth of Ruby Virtual Machines for Ruby JRuby jMaki Ruby Development Using the NetBeans IDE Praise for JRuby From Ruby-on-Rails Creator Develop-and-Deploy Scenarios - Developing Ruby Applications on Solaris Express Developer Edition (SXDE) - Deploying on Solaris OS AMP - Deploying JRuby on the GlassFish Application Server - Java DB for JRuby Applications Why Run Rails on GlassFish? Opening the JVM to Other Languages
Although Ruby is sometimes described as a scripting language, its supporters characterize it as a general-purpose computer language with broad application. Ruby is free to use, copy, modify, and distribute -- and highly portable. Although it is most often developed on GNU/Linux or Mac OS X, Ruby works on many types of UNIX, Solaris OS, Microsoft Windows 95/98/Me/NT/2000/XP, and other operating systems. Ruby has recently released version 1.9.0. Ruby's features include the following:
RubyForge is a home for open-source Ruby projects. RubyGems, now part of the standard library from Ruby version 1.9.0, is a package manager for Ruby that provides a standard format for distributing Ruby programs and libraries. In March 2008, the TIOBE index, which measures the growth of programming languages, ranked Ruby 10th in worldwide popularity, accounting for roughly 2.6% of programmers. Much of Ruby's growth is tied to the popularity of the open-source Ruby-on-Rails framework, known as Rails, which is used for database-backed web applications based on the model-view-controller (MVC) design pattern. Ruby on Rails offers skeletal code frameworks to increase speed and ease of development for database web site creation and is popular among younger developers. The speed and agility of Rails has had a significant impact on web development. Rails works with web servers like GlassFish, Apache, Mongrel, and LightTPD, and databases such as MySQL, PostgreSQL, SQLite, Oracle, SQL Server, Java DB, and DB2.
The Rails framework fits well with what publisher Tim O'Reilly calls Web 2.0, which, however defined, refers to such proliferating interactive web sites as Flickr, YouTube, Facebook, MySpace, and others that are characterized by massive information entering the site from the edge of the network. Many future Web 2.0 sites are likely to use Rails, because rapid time to market and reliable maintenance are crucial to the success of Web 2.0. Rails excels in maintainability but can be slow with web applications that require computation. Ruby's official implementation, often referred to as Matz's Ruby Interpreter or MRI, after Matsumoto, is the most widely used. It is sometimes referred to as CRuby because it is written in C. Ruby's popularity has grown beyond its native runtime to VM-based runtimes, with the creation of several other implementations. These include JRuby, a port of Ruby to the Java platform; IronRuby an implementation for Microsoft's .NET framework; Ruby.NET, a compiler that translates Ruby source code into .NET intermediate code for third-party Microsoft platforms only; and Rubinius, an interpreter modeled after self-hosting Smalltalk virtual machines. YARV, which stands for Yet Another Ruby VM, is a new bytecode interpreter being developed for Ruby, designed to reduce execution time for Ruby programs. With Ruby's 1.9.1 release, due out soon, YARV will become the official Ruby interpreter.
Originally written by Jan Arne Peterson in 2001, JRuby was further developed by Thomas Enebo and Charles Nutter. Sun Microsystems hired the two developers in September 2006 as JRuby core developers -- evidence of Sun's commitment to JRuby development and openness to the expansion of Java technology for use with other languages.
Sun's strategy is tied to the assumption that deployment will follow adoption, and it derives from the belief that businesses will not deploy important applications or solutions without support. As Sun CEO Jonathan Schwartz puts it, "Mindshare gets market share."
In February 2008, the second release candidate of JRuby 1.1, JRuby 1.1 RC 2, was released.
"There are now a vast number of Java libraries accessible to Ruby developers," he writes. "JRuby may be a solution for developers who want to scale better or differently. The sandbox security of the JVM* allows developers to build robust Internet-based applications. Giving Ruby developers access to the Java APIs and the community of 6 million developers is a big plus." JRuby's features include the following:
JRuby on Rails, which is the original Ruby-on-Rails framework running on top of the Java platform, adds to Rails the power and functionality of Java libraries and application servers. Sun is actively working to make Rails applications into Java-platform apps, in the hopes of making JRuby on Rails central to future web development.
The NetBeans Ruby Project Type supports Ruby files, RSpec specification files, and YAML files. Projects can be executed using JRuby or any other native Ruby installation on one's system. The NetBeans IDE has Rake build tool integration and offers access to the Interactive Ruby Shell (IRB). The Ruby Source Code Editor indents, completes, and highlights Ruby code syntactically as well as semantically, parsing code live as the developer types, so it can match words and brackets, mark errors and occurrences, and display hints and RDoc. Common code snippets can be inserted from live templates with a few keystrokes. Refactoring and support for Test::Unit, Auto Test, and RSpec are well integrated. NetBeans Ruby on Rails Project Type supports Rake targets and database migrations, enabling users to generate Rails projects or generate code through the Rails code generator graphical wizard. The logical project view clearly separates controllers from models, views, and database migrations. Users can edit RHTML files and deploy projects directly to the integrated WEBrick and Mongrel web servers, jump quickly between a Rails action and its corresponding view, and warp to the browser for the URL most relevant to the file being edited. The Ruby and Rails Debugger lets developers single-step or run through Ruby code and RHTML files. Users can set breakpoints, look at local variables, navigate the call stack, and switch threads. Hovering the mouse over a variable in the Editor lets developers evaluate the expression and show it in a tooltip. The NetBeans IDE supports the Fast Debugger extension for Ruby and Rails programs, a pure Ruby debugger, and a JRuby debugger. The Ruby Gems Installation Manager extends Ruby installations using the integrated Ruby Gems packaging system, enabling users to add and manage freely available Ruby software libraries and to distribute their own packages. Arun Gupta, a technology evangelist for web services and web 2.0 applications at Sun, has explained how to swap the JRuby interpreter in the NetBeans IDE 6.0 with a C-based Ruby interpreter, and vice versa.
"JRuby on Rails is already in production at a fair number of companies. The Rails is just a WAR [Web ARchive file] argument is certainly making it easier for companies like ThoughtWorks to push Rails deep into the enterprise. Throw the 'integrate with your Java legacy' argument on top (where you can even go as far as work with EJBs!) and it's easy to see why The Enterprise is getting all giddy." Ruby has been most often developed on GNU/Linux, and works on many types of UNIX, Mac OS X, Microsoft Windows 95/98/Me/NT/2000/XP, DOS, BeOS, OS/2, and other operating systems. But Sun has now made it very easy to develop Ruby applications on the NetBeans IDE and the Solaris operating system. Here's how.
SXDE contains many enhancements not yet in the Solaris 10 OS. The SXDE release, created for the x86 platform, includes the latest tools, technologies, and platforms needed to create applications for Solaris OS, Java application platforms, and Web 2.0. Developers can download it, order a DVD kit, or get SXDE configured as a VMware virtual appliance for free. SXDE supports Ruby, Rails, JRuby, RubyGems, PostgreSQL, MySQL, Java DB, GlassFish application server, NetBeans IDE, and more, including top-tier support for a variety of popular open source databases such as PostgreSQL and MySQL.
JRuby is supported on Project GlassFish V2 through a JRuby on GlassFish module. This module makes it easier to deploy a Ruby-on-Rails application to a GlassFish application server, enabling Rails developers to take advantage of GlassFish. The JRuby 1.0.1 source bits in this module have been updated with the following Ruby gems:
Second, GlassFish enables pooling of DB connections, something missing on CRuby Rails. Third, developers can access any Java Naming and Directory Interface (JNDI) API resource from their Rails application, plus any Java Persistence API data source. Opening the JVM to Ruby and the advent of JRuby on Rails marks an advance in Java technology. It enables the faster creation of easily maintained and rich web sites in the Web 2.0 era. Of particular note is Sun's Da Vinci Machine project, which is extending the JVM with first-class architectural support for languages other than the Java language, with a focus on dynamic languages. The project will prototype a number of extensions to the JVM so that it can run other languages efficiently, with a performance level comparable to that of the Java language itself. Sun is aspiring to a multilanguage renaissance for the JVM architecture. Ruby's growing popularity, as well as its support on the JVM through JRuby, plus the tooling support of the NetBeans IDE and Solaris OS support in Cool Stack, results in a complete Ruby developer environment, from tools and databases to servers and runtimes, now available in Solaris Express Developer Edition (SXDE). As other dynamic languages and applications evolve, the flexibility, interoperability, and sheer power of the Java platform should enhance the power of the web for future generations.
_______ For More Information
|
Here's what you need to develop Ruby, JRuby, and Rails applications with NetBeans, Solaris, Cool Stack SAMP, GlassFish, MySQL, and more on our Ruby Developer Resource
Center.
| ||||||||||||||||||
|
| ||||||||||||