Tuesday, February 4, 2014

Thursday, October 10, 2013

running jruby in jmx console

If you want to play with the MBeans and their properties but prefer ruby

jconsole -J-Djava.class.path=$JDK_HOME/lib/jconsole.jar:$JDK_HOME/lib/tools.jar:/Users/konurur/.rvm/rubies/jruby-1.6.2/lib/jruby.jar -J-Dcom.sun.demo.jconsole.console.language=jruby  -pluginpath $JDK_HOME/demo/scripting/jconsole-plugin/jconsole-plugin.jar 

Wednesday, March 27, 2013

Jruby on rails multiple datasources on jboss with warble


inside warble.rb
  config.webxml.jndi = ["jdbc/DS1", "jdbc/DS2","jdbc/DS3","jdbc/DS4"]

inside jboss-web-xml

 <resource-ref>
        <res-ref-name>jdbc/DS1</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>DS1</jndi-name>
    </resource-ref>

 <resource-ref>
        <res-ref-name>jdbc/DS2</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>DS2</jndi-name>
    </resource-ref>

 <resource-ref>
        <res-ref-name>jdbc/DS3</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>DS3</jndi-name>
    </resource-ref>

 <resource-ref>
        <res-ref-name>jdbc/DS4</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>DS4</jndi-name>
   </resource-ref>

inside web.xml.erb


 <% if webxml.jndi then webxml.jndi.each do |jndi| %>
      <resource-ref>
        <res-ref-name><%= jndi %></res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
    <% end; end %>


Wednesday, February 29, 2012

Cucumber Rspec Example

After trying to wrap my head around Behavior Driven Development and getting sick of the text book example from Pragmatic Bookshelf's The Rspec Book.

I thought I should really develop something so trivial and part of my life to really understand the BDD philosophy and methodology.

So I gave a shot at the best thing I do in my life, making tea for my wife, I am pretty sure she loves my Tea because she doesn't have to do it in the early morning.

so heres how the feature file looks like

# Home Maker Morning Chores
# language: en
@good_morning @make_tea
Feature: Home Maker Prepares Tea
  In order to start a morning
  As a Home Maker of The Home
  I want to prepare Tea

  @make_tea
  Scenario: Making Tea for 2 with Tea Bags
    Given Tea Maker
    When making 2 cups of tea
    Then add 1 cup milk
    And  add 1 Cup Water
    And add 2 spoons Sugar
    And add 4 tea bags
    Then print tea making steps
    

and the code is here

Wednesday, November 30, 2011

script console for jruby rails

inside your rails root directory

<system java path>/java -client  -Xbootclasspath/a:<path to jruby jar>/jruby-complete-1.6.2.jar   -Djruby.shell=/bin/sh org.jruby.Main script/console

useful for investigating stuff on production boxes if jruby is not installed on commandline.