Monday May 04, 2009
TOTD #81: How to configure "database.yml" to be used with both JRuby and MRI ?
In JRuby-on-Rails
tutorial at Rails
Conf 2009, Nick
Sieger shared a nice little tip on how to configure
"database.yml" to be usable with both JRuby and MRI:
| <% jdbc = defined?(JRUBY_VERSION) ? 'jdbc' : ''
%> development: adapter: <%= jdbc %>mysql encoding: utf8 reconnect: false database: myapp_development pool: 5 username: root password: socket: /tmp/mysql.sock # ... |
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Wednesday February 04, 2009
LOTD #16: Hotspot Flags, JRuby Version String, and JRuby/MRI Benchmark
This post shares 3 links that were recently published.
The first one is about the Favorite
Hotspot JVM Flags by Charlie.
See how you can use them for tweaking performance or investigating
runtime metrics.
The second one is about using JRuby
Version String. It explains the detailed meaning of the
version string printed by "jruby --version". If you read it carefully
then you know the date, hardware, platform, SVN revision and even state
of Charlie's local git-svn clone.
The third and the last one is about benchmark results between MRI and
JRuby with the following summary:
From my tests it appears
that MRI is faster in single threaded mode, but JRuby makes up for the
loss big time in the multi-threaded tests. It's also interesting to see
that the multi-threaded mode gives MRI(green threads) a performance
boost, but it's nowhere close to the boost that JRuby(native threads)
can squeeze out from using multiple threads.
Read Igor's
report for more results.
And while you are reading this entry, did you know that GlassFish
Gem 0.9.2 was recently
released ? Use it for running your Rails applications
seamlessly :)
All previous entries in this series are archived at LOTD.
Technorati: lotd
glassfish
v3 gem jruby ruby hotspot vm
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Saturday September 27, 2008
LOTD #9: Advantages of JRuby over MRI
Andreas blogged about why he likes
JRuby even though he dislikes Java.
JRuby is "It's just
Ruby" with more than 50,000 tests to ensure MRI compliance. The blog
highlights that there is no need to know Java, at all, to run JRuby.
Here are
some advantages that are described in the blog:
Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Thursday September 11, 2008
Kenai - High Throughput and Scalable Rails on GlassFish
![]() |
Kenai (pronounced 'keen-eye') is a fictional character from Disney's Brother Bear series. It's also a river, mountain range, national park, peninsula and a city in the southern coast of Alaska in the United States. But that's got nothing to do (as much as I know) with either Rails or GlassFish. |
![]() |
![]() |
But Project Kenai was announced last week. It's a developer hub with SCM, issue tracking, forums and similar stuff you need for hosting your open source projects. And it is a Rails application deployed on GlassFish v2. |
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Monday September 08, 2008
TOTD #44: JDBC Connection Pooling for Rails on GlassFish v3
TOTD
#9 explained how to configure JDBC connection pooling for
Rails application deployed on GlassFish v2. There are several
benefits of using using the JDBC connection pools:
| ~/samples/jruby >~/tools/jruby-1.1.3/bin/jruby -S
rails
jndi_rails2 -d mysql ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby script/generate scaffold runner miles:float minutes:integer ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S rake db:create ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S rake db:migrate |
| ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S gem install activerecord-jdbcmysql-adapter |
| ~/samples/jruby/jndi_rails2 >sudo cp ~/tools/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext |
| ~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish >java -Xmx512m -DJRUBY_HOME=/Users/arungupta/tools/jruby-1.1.3 -jar modules/glassfish-10.0-SNAPSHOT.jar |
| ~/samples/jruby/jndi_rails2 >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.DataSource --property "User=duke:Password=duke:URL=jdbc\:mysql\://localhost/jndi_rails2_production" jdbc/jndi_rails2_pool |
| ~/samples/jruby/jndi_rails2 >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin create-jdbc-resource --connectionpoolid jdbc/jndi_rails2_pool jdbc/jndi_rails2 |
| ~/samples/jruby >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin ping-connection-pool jdbc/jndi_rails2_pool |
|
development: adapter: jdbc jndi: jdbc/jndi_rails2 driver: com.mysql.jdbc.Driver |
| ~/samples/jruby >~/tools/glassfish/v3/b22/glassfishv3-prelude/glassfish/bin/asadmin deploy jndi_rails2 |
Posted by Arun Gupta in web2.0 | Comments[11]
|
|
|
|
|
Thursday August 28, 2008
Typo on GlassFish v3 - Ruby-on-Rails Blogging Engine
![]() |
Typo is an open-source Blogging Engine written using Ruby-on-Rails framework. It provides a lean engine that makes blogging easy. It's main attribtues are ease of use, usability, beauty and excellent support of web standards. |
| JRuby
limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Building native extensions. This could take a while... /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError) from /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/1.8/mkmf.rb:1:in `require' from extconf.rb:1 ERROR: Error installing typo: ERROR: Failed to build gem native extension. /Users/arungupta/tools/rails20/jruby-1.1.3/bin/jruby extconf.rb install typo Gem files will remain installed in /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out |
| ~/samples/jruby
>unzip
~/Downloads/typo-5.1.2.zip Archive: /Users/arungupta/Downloads/typo-5.1.2.zip creating: typo-5.1.2/ creating: typo-5.1.2/app/ creating: typo-5.1.2/app/apis/ . . . inflating: typo-5.1.2/vendor/uuidtools/lib/uuidtools.rb inflating: typo-5.1.2/vendor/uuidtools/rakefile inflating: typo-5.1.2/vendor/uuidtools/README |
| ~/samples/jruby >sudo mysqladmin create typo_dev |
| ~/samples/jruby/typo-5.1.2
>~/tools/rails20/jruby-1.1.3/bin/jruby
-S rake db:migrate (in /Users/arungupta/samples/jruby/typo-5.1.2) == 1 InitialSchema: migrating ================================================= -- create_table(:users) -> 0.0377s -- create_table(:articles) -> 0.0189s -- add_index(:articles, :permalink) -> 0.0094s -- create_table(:categories) -> 0.0069s . . . == 69 AddModulesToProfile: migrating ========================================== -- add_column(:profiles, :modules, :text) -> 0.0072s == 69 AddModulesToProfile: migrated (0.0454s) ================================= == 70 AddUsersToNonAdmins: migrating ========================================== == 70 AddUsersToNonAdmins: migrated (0.0488s) ================================= |
| ~/tools/glassfish/v3/8-24
>unzip
~/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip Archive: /Users/arungupta/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip creating: glassfish/ creating: glassfish/docs/ creating: glassfish/docs/css/ creating: glassfish/docs/graphics/ . . . inflating: glassfish/lib/templates/login.conf inflating: glassfish/lib/templates/profile.properties inflating: glassfish/lib/templates/server.policy |
| ~/tools/glassfish/v3/8-24/glassfish
>java
-DJRUBY_HOME=/Users/arungupta/tools/rails20/jruby-1.1.3 -jar
modules/glassfish-10.0-SNAPSHOT.jar Aug 26, 2008 5:56:10 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on Apache Felix OSGi platform Welcome to Felix. ================= Aug 26, 2008 5:56:11 PM HK2Main start INFO: contextRootDir = /Users/arungupta/tools/glassfish/v3/8-24/glassfish/modules Aug 26, 2008 5:56:11 PM OSGiFactoryImpl initialize . . . INFO: APIClassLoader = Class Loader for Bundle [GlassFish-Application-Common-Module [66] ] Aug 26, 2008 5:56:13 PM CommonClassLoaderManager Skipping creation of CommonClassLoader as there are no libraries available INFO: urls = [] Aug 26, 2008 5:56:13 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 2176 ms |
| ~/samples/jruby >~/tools/glassfish/v3/8-24/glassfish/bin/asadmin
deploy typo-5.1.2 Command deploy executed successfully. |







Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
Tuesday August 26, 2008
LOTD #6: Rails Deployment on GlassFish in 4 steps and 15 minutes
Charlie describes,
in 4 easy steps, how to deploy any Rails
application on GlassFish:

The main steps are:
Step 1: The App Server
Step 2: Package your App
Step 3: Deploy your application
Step 4: Tweaking (Optional)
And it should only take 15 minutes on GlassFish v2!
The conclusion of the blog is:
Hopefully
this walkthrough clears up some confusion around JRuby on Rails
deployment to an app server. It's really a simple process, despite the
not-so-simple history surrounding Enterprise Application Servers, and
GlassFish almost makes it fun :)
The next version, GlassFish
v3, allows Rails application to be deployed natively, i.e. no
packaging is required. You create a Rails application and run it - just
the way you are used to! Read all about it here.
All previous entries in this series are archived at LOTD.
Technorati: lotd
rubyonrails
jruby ruby glassfish
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Thursday August 21, 2008
LOTD #4: Rails running on GlassFish @ LinkedIn
Light Engineering team (BumperSticker
fame)
at LinkedIn has
chosen GlassFish
for running their Rails
application. One of the developers on the
team reports:
Using Warbler, we
successfully wrapped our Rails applications into WAR files and deployed
on Glassfish (we’ll probably write a more detailed tutorial of this at
a future date). A WAR file is completely self contained application
that can be deployed simply by copying to an autodeploy directory. No
more Apache/Nginx reverse proxy, no more Capistrano, no more installing
gems on a production container, no more of any of that madness. This
was a huge win, and we broke out the champagne bottles.
Read the complete entry at:
JDBC
Connection Pooling for Rails on GlassFish
Stay tuned for more details!
NetBeans
development and GlassFish
deployment already provide an ideal
environment for Rails deployment. You can read about
successful deployments of Rails and GlassFish here.
All previous entries in this series are archived at LOTD.
Technorati: lotd
rubyonrails
jruby ruby netbeans
glassfish
stories
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Tuesday August 19, 2008
LOTD #3: Rails 2.2 going multi-threaded
Rails 2.2 is
slated to become
multi-threaded. What does it mean for
JRuby users ? Charles Nutter explains it:
Q/A:
What Thread-Safe Rails Means
One of the key points from the blog is:
Rails deployments on
JRuby will use 1/Nth the amount of memory they use
now, where N is the number of thread-unsafe Rails instances currently
required to handle concurrent requests. Even compared to green-threaded
implementations running thread-safe Rails, it willl likely use 1/Mth
the memory where M is the number of cores, since it can parallelize
happily across cores with only "one" instance.
NetBeans
development and GlassFish
deployment already provide an ideal
environment for Rails deployment.
All previous entries in this series are archived at LOTD.
Technorati: lotd
rubyonrails
jruby ruby netbeans
glassfish
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Tuesday August 05, 2008
JRuby on GlassFish v2 - screencast from community
Here is a (year old) community contributed video showing how to deploy
a Ruby-on-Rails
application on GlassFish v2
application server:
The presenter is not speaking and typing really fast, I wish there was
a slower playback available :)
Anyway, thanks to Angsuman for the tip!
Screencast
#Web9 shows how to deploy a Rails application as WAR in
GlassFish v2. Some other relevant entries are:
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Monday July 21, 2008
JRuby 1.1.3 released - Getting Started with GlassFish
JRuby 1.1.3 was released
last week - download
here. The highlights are:
| ~/testbed/jruby-1.1.3
>./bin/jruby -S
gem install rails glassfish --no-ri --no-rdoc JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed activesupport-2.1.0 Successfully installed activerecord-2.1.0 Successfully installed actionpack-2.1.0 Successfully installed actionmailer-2.1.0 Successfully installed activeresource-2.1.0 Successfully installed rails-2.1.0 Successfully installed glassfish-0.3.1-universal-java 7 gems installed |
| ~/testbed/jruby-1.1.3/samples/rails
>../../bin/jruby
-S rails helloworld -d mysql create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create db create doc . . . create log/server.log create log/production.log create log/development.log create log/test.log |
| ~/testbed/jruby-1.1.3/samples/rails
>../../bin/jruby
-S glassfish_rails helloworld Jul 21, 2008 8:32:03 AM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on HK2 platform Jul 21, 2008 8:32:03 AM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3000 Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_protocols_disabled Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_ciphers_disabled Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3131 Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3838 Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jul 21, 2008 8:32:05 AM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool INFO: Starting Rails instances Jul 21, 2008 8:32:09 AM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jul 21, 2008 8:32:10 AM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: JRuby and Rails instance instantiation took : 5623ms Jul 21, 2008 8:32:10 AM org.glassfish.scripting.rails.RailsDeployer load INFO: Loading application helloworld at / Jul 21, 2008 8:32:10 AM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 7046 ms |
| ~/testbed/jruby-1.1.3/samples/rails/helloworld
>../../../bin/jruby
script/generate scaffold runner distance:float minutes:integer JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/runners exists app/views/layouts/ exists test/functional/ exists test/unit/ exists public/stylesheets/ create app/views/runners/index.html.erb create app/views/runners/show.html.erb create app/views/runners/new.html.erb create app/views/runners/edit.html.erb create app/views/layouts/runners.html.erb create public/stylesheets/scaffold.css create app/controllers/runners_controller.rb create test/functional/runners_controller_test.rb create app/helpers/runners_helper.rb route map.resources :runners dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/runner.rb create test/unit/runner_test.rb create test/fixtures/runners.yml create db/migrate create db/migrate/20080721153737_create_runners.rb |
| ~/testbed/jruby-1.1.3/samples/rails/helloworld
>../../../bin/jruby
-S rake db:create (in /Users/arungupta/testbed/jruby-1.1.3/samples/rails/helloworld) ~/testbed/jruby-1.1.3/samples/rails/helloworld >../../../bin/jruby -S rake db:migrate (in /Users/arungupta/testbed/jruby-1.1.3/samples/rails/helloworld) == 20080721154435 CreateRunners: migrating ==================================== -- create_table(:runners) -> 0.0097s == 20080721154435 CreateRunners: migrated (0.0104s) =========================== |


| ~/testbed/glassfish/v3/snapshot/glassfish
>java
-DJRUBY_HOME=/Users/arungupta/testbed/jruby-1.1.3 -jar
modules/glassfish-10.0-SNAPSHOT.jar Jul 21, 2008 9:40:41 AM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on Apache Felix OSGi platform Jul 21, 2008 9:40:41 AM com.sun.enterprise.glassfish.bootstrap.ASMainOSGi getSharedRepos INFO: /Users/arungupta/testbed/glassfish/v3/snapshot/glassfish/domains/domain1/lib does not exist Welcome to Felix. ================= . . . INFO: Started bundle org.glassfish.common.container-common [91] Jul 21, 2008 9:47:13 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jul 21, 2008 9:47:13 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.deployment.deployment-common [71] Jul 21, 2008 9:47:13 AM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 1507 ms |
| ~/testbed/jruby-1.1.3/samples/rails
>~/testbed/glassfish/v3/snapshot/glassfish/bin/asadmin
deploy helloworld Command deploy executed successfully. |
| Jul
21, 2008 9:47:49 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.web.war-util [65] Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.persistence.jpa-connector [25] Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.scripting.gf-jruby-connector [13] Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.core.security [22] Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.web.gf-web-connector [86] Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass INFO: Started bundle org.glassfish.connectors.gf-connectors-connector [53] Jul 21, 2008 9:47:49 AM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool INFO: Starting Rails instances Jul 21, 2008 9:48:01 AM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jul 21, 2008 9:48:02 AM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: JRuby and Rails instance instantiation took : 12852ms Jul 21, 2008 9:48:02 AM org.glassfish.scripting.rails.RailsDeployer load INFO: Loading application helloworld at /helloworld Jul 21, 2008 9:48:02 AM com.sun.enterprise.v3.deployment.DeployCommand execute INFO: Deployment of helloworld done is 13326 ms |

Posted by Arun Gupta in web2.0 | Comments[9]
|
|
|
|
|
Friday July 11, 2008
Single Sign On using Sun Access Manager and JRuby
A couple of emails to achieve Single Sign On using Sun Access Manager
in a Rails app - that's pretty cool! A brief summary of the solution is:
Warbler builds a war
file out of your Rails app using jruby-rack. Drop your .jar libraries
in the rails lib dir. Muck with your web.xml so you can make it use a
filter. Drop the .war file on your server. Done. A little method called
servlet_request is now magically available to you. Call
servlet_request.getUserPrincipal : it's populated. It's not magic- it's
JRuby!
Read complete details here.
And guess what, this is deployed on GlassFish
:)
The blog summarizes the power of Java and agility of JRuby/Rails:
Anyway, that's why JRuby
is even more awesome. Let them write Java- I'll call it if I need it.
Technorati: rubyonrails
jruby ruby glassfish
accessmanager
singlesignon
sso stories
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Monday July 07, 2008
GlassFish + JRuby + JRuby-Rack + Warbler = Blog Deployment Platform
Nick decided to walk the talk and upgraded his blog deployment platform from Mongrel to JRuby/GlassFish.

Read more details.
Yet another successful deployment of JRuby-on-Rails on GlassFish. Read other similar stories.
Technorati: rubyonrails jruby ruby glassfish stories
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Wednesday July 02, 2008
TOTD #37: SQLite3 with Ruby-on-Rails on GlassFish Gem
![]() |
The default database for Rails 2.0.x application is SQLite3. This database is bundled with Mac OSX Leopard and so makes it really easy to get started with Ruby-on-Rails. But it requires couple of additional steps if you are using JRuby. |
| ~/samples/jruby
>~/testbed/jruby-1.1.2/bin/jruby -S rails runner create create app/controllers create app/helpers create app/models create app/views/layouts . . . create log/server.log create log/production.log create log/development.log create log/test.log |
| # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 timeout: 5000 |
| ~/samples/jruby/runner
>~/testbed/jruby-1.1.2/bin/jruby
-S gem install activerecord-jdbcsqlite3-adapter JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed activerecord-jdbc-adapter-0.8.2 Successfully installed jdbc-sqlite3-3.5.8 Successfully installed activerecord-jdbcsqlite3-adapter-0.8.2 3 gems installed Installing ri documentation for activerecord-jdbc-adapter-0.8.2... Installing ri documentation for jdbc-sqlite3-3.5.8... Installing ri documentation for activerecord-jdbcsqlite3-adapter-0.8.2... Installing RDoc documentation for activerecord-jdbc-adapter-0.8.2... Installing RDoc documentation for jdbc-sqlite3-3.5.8... Installing RDoc documentation for activerecord-jdbcsqlite3-adapter-0.8.2... |
| development: adapter: jdbcsqlite3 database: db/development.sqlite3 timeout: 5000 |
| ~/samples/jruby/runner
>~/testbed/jruby-1.1.2/bin/jruby
script/generate scaffold run distance:float minutes:integer JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/runs exists app/views/layouts/ exists test/functional/ exists test/unit/ exists public/stylesheets/ create app/views/runs/index.html.erb create app/views/runs/show.html.erb create app/views/runs/new.html.erb create app/views/runs/edit.html.erb create app/views/layouts/runs.html.erb create public/stylesheets/scaffold.css create app/controllers/runs_controller.rb create test/functional/runs_controller_test.rb create app/helpers/runs_helper.rb route map.resources :runs dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/run.rb create test/unit/run_test.rb create test/fixtures/runs.yml create db/migrate create db/migrate/20080630211244_create_runs.rb |
| ~/samples/jruby/runner
>~/testbed/jruby-1.1.2/bin/jruby
-S rake db:migrate (in /Users/arungupta/samples/jruby/runner) == 20080630205502 CreateRuns: migrating ======================================= -- create_table(:runs) -> 0.0410s -> 0 rows == 20080630205502 CreateRuns: migrated (0.0420s) ============================== |
| development: adapter: jdbcsqlite3 database: runner/db/development.sqlite3 timeout: 5000 |
| ~/samples/jruby
>~/testbed/jruby-1.1.2/bin/jruby
-S glassfish_rails runner Jun 30, 2008 1:52:08 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on HK2 platform Jun 30, 2008 1:52:08 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3000 Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_protocols_disabled Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_ciphers_disabled Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3131 Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3838 Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jun 30, 2008 1:52:09 PM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool INFO: Starting Rails instances Jun 30, 2008 1:52:16 PM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jun 30, 2008 1:52:17 PM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: JRuby and Rails instance instantiation took : 7998ms Jun 30, 2008 1:52:17 PM org.glassfish.scripting.rails.RailsDeployer load INFO: Loading application runner at / Jun 30, 2008 1:52:17 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 9430 ms |

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.
Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Tuesday July 01, 2008
TOTD# 36: Writing First Test for a Rails Application
I've created a Rails "Hello World" app numerous
times. But I decided to write a simple using the testing
framework provided by Rails. This blog explains my experience of
writing such a test.
| ~/samples/jruby/test
>~/testbed/jruby-1.1.2/bin/jruby
-S rails helloworld
create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers . . . create log/production.log create log/development.log create log/test.log |
| ~/samples/jruby/test/helloworld >~/testbed/jruby-1.1.2/bin/jruby script/generate controller home index |
| JRuby
limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:278:in `load_missing_constant': uninitialized constant ActiveRecord (NameError) from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:479:in `const_missing' from /Users/arungupta/samples/jruby/test/helloworld/config/initializers/new_rails_defaults.rb:5:in `/Users/arungupta/samples/jruby/test/helloworld/config/initializers/new_rails_defaults.rb' from /Users/arungupta/samples/jruby/test/helloworld/config/initializers/new_rails_defaults.rb:502:in `load' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:475:in `load_application_initializers' ... 8 levels... from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/generate.rb:27:in `require' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from script/generate:3 |
| if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full class name (including module namespace) in STI type column. ActiveRecord::Base.store_full_sti_class = true end |
| ~/samples/jruby/test/helloworld
>~/testbed/jruby-1.1.2/bin/jruby
script/generate controller home index JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/controllers/ exists app/helpers/ create app/views/home exists test/functional/ create app/controllers/home_controller.rb create test/functional/home_controller_test.rb create app/helpers/home_helper.rb create app/views/home/index.html.erb |
| ~/workspaces/glassfish-scripting/rails/v3/src/test/rails
>~/testbed/jruby-1.1.2/bin/jruby
-S glassfish_rails helloworld Jun 27, 2008 2:46:18 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on HK2 platform Jun 27, 2008 2:46:18 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Jun 27, 2008 2:46:18 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3000 Jun 27, 2008 2:46:18 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_protocols_disabled Jun 27, 2008 2:46:18 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_ciphers_disabled Jun 27, 2008 2:46:19 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3131 Jun 27, 2008 2:46:19 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3838 Jun 27, 2008 2:46:19 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jun 27, 2008 2:46:19 PM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool INFO: Starting Rails instances Jun 27, 2008 2:46:24 PM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jun 27, 2008 2:46:24 PM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: JRuby and Rails instance instantiation took : 5169ms Jun 27, 2008 2:46:24 PM org.glassfish.scripting.rails.RailsDeployer load INFO: Loading application helloworld at / Jun 27, 2008 2:46:24 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 6419 ms Jun 27, 2008 2:46:28 PM com.sun.grizzly.jruby.RailsAdapter$Logger log INFO: |
| require 'home_controller' class HomeControllerTest < ActionController::TestCase def test_index get :index assert_response :success end end |
| ~/workspaces/glassfish-scripting/rails/v3/src/test/rails/helloworld
>~/testbed/jruby-1.1.2/bin/jruby
-S rake test (in /Users/arungupta/workspaces/glassfish-scripting/rails/v3/src/test/rails/helloworld) /Users/arungupta/testbed/jruby-1.1.2/bin/jruby -Ilib:test "/Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" /Users/arungupta/testbed/jruby-1.1.2/bin/jruby -Ilib:test "/Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/functional/home_controller_test.rb" JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Loaded suite /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader Started . Finished in 0.308 seconds. 1 tests, 1 assertions, 0 failures, 0 errors /Users/arungupta/testbed/jruby-1.1.2/bin/jruby -Ilib:test "/Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" |
Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.
Technorati: rubyonrails jruby ruby glassfish totdPosted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Today's Page Hits: 2057
Total # blog entries: 994
| « November 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | 2 | 4 | 6 | 7 | ||
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | |||||
| Today | ||||||