* “running jruby scripts from ant – WWWOW”
I have lots of ant build files, many times i use ant even for tasks apart from building like portable scripting sort of tasks.
Now, if rather than sending those ant files into recycle bin, if i add ruby/jruby power into ant rather than replacing it, then i will be in the best of both worlds.
This straight forward task took me , sometime to figure out, as there was no clear directions nowhere on how to configure it.
2. Install ant 1.7.0 by following method
cp apache-ant-1.7.0-bin.zip /opt
cd /opt
unzip apache-ant-1.7.0-bin.zip
ln -s apache-ant-1.7.0 ant
export ANT_HOME=/opt/ant
export PATH=$ANT_HOME/bin
3. copy $JRUBY_HOME/lib/bsf.jar to $ANT_HOME/lib
4. type the following file hello-from-jruby.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<project name=”ashishPrj”>
<property environment=”env”/>
<script language=”ruby” manager=”bsf”>
<classpath>
<fileset dir=”${env.JRUBY_HOME}/lib” includes=”*.jar” />
</classpath>
print ‘hello world’
</script>
</project>
5. Now, run as
ant -f hello-from-jruby.xml
The output will be something like:
ashish@singularity:~/jrubyprg# ant -f hello-from-jruby.xml
Buildfile: hello-from-jruby.xml
hello world
BUILD SUCCESSFUL
Total time: 2 seconds
now, enjoy power of ant’s XML tags, java, jruby ALL IN ONE
We will take up some more complex scripts in next article.
happy jrubying
*” installing – JRuby on Rails (jRoR) “
install jruby on Linux and then install rails on jruby by the following procedure. I installed it on Slackware Linux 11.0.
INSTALLING JRUBY
download jruby-bin-1.0.zip from jruby.org
copy it to the desired directory, say /opt
cd /opt
unzip jruby-bin-1.0.zip
ln -s jruby-1.0 jruby
export JRUBY_HOME=/opt/jruby
export PATH=$JRUBY_HOME/bin:$PATH
jruby commands “jruby”, “jirb”,”jrubyc”
jruby-bin-1.0.zip comes bundled with gem and rake (the modified ones which search for jruby instead of ruby)
For testing, write a program hello.rb
print “Hello World”
Now run it as,
jruby hello.rb
INSTALLING RAILS ON JRUBY
TIP: do put $JRUBY_HOME/bin in $PATH earlier as specified, so that gem command from jruby will execute, not from ruby installation (if any) on your machine
gem install rails -y
currently it will install gems of rails-1.2.3, activesupport-1.4.2, activerecord-1.15.3, actionpack-1.13.3, actionmailer-1.3.3, actionwebservice-1.2.3
now, goto your application directory, say
mkdir ~/app
cd ~/app
now,if u give the following command:
root@singularity:~/app# rails blogapp
/opt/jruby/bin/rails: line 9: require: command not found
/opt/jruby/bin/rails: line 10: version: command not found
/opt/jruby/bin/rails: line 11: syntax error near unexpected token `(‘
/opt/jruby/bin/rails: line 11: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then’
To resolve there are two methods:
METHOD1:
HENCE, we gave the following command instead:
jruby $JRUBY_HOME/bin/rails blogapp
METHOD2: This method took me a some time to figure out because i was unable to gauge the crux of the problem initially, but finally it was actually very simple solution to a simple problem
open $JRUBY_HOME/bin/rails file in an editor
you will find the first line is mentioned as(say), #!/opt/jruby-1.0/bin/jruby
change it to #!/usr/bin/env jruby
Now, you can give the normal command:
rails blogapp
Now,
cd blogapp
now start the server by,
jruby script/server
now access the rails page at:
* http://localhost:3000
stay tuned for more articles on jruby specific features ( not in native ruby ) and rails
* “My Ubuntu wish list”
Here is my ubuntu wishlist :
1.1) Say i have installed from Ubuntu desktop CD and i do NOT have internet connection , BUT i have ubuntu-server CD and kubuntu CD. Now there should be easy and officially documented way to install ALL(say) from ubuntu server CD or kubuntu CD. Note: Add CDROM in synaptic never worked for me. This is the foremost requirement in my opinion that i have official ubuntu-other-editions CDs ( or just a customised AddON, which contains all the .debs , in which may be some debs are dependent on each other, but all the dependencies are all out in that CD or CD dumped on local file system), then i should be able to install WITHOUT INTERNET connection. In my opinion , this is very crucial to ubuntu’s success in countries like India.
“aptoncd” is not official and installed from default CD yet and though it takes backup of apt cached packages , but it does NOT do a good job of restoring it on other machine in a friendly way.
adding file:// and cdrom:// urls in /etc/apt/sources.list has never worked in satisfying way.
Do not mention installing apt-cache, apt-proxy etc. what we are targetting is installing ubuntu on a machine which is in Home (means no other machine in home, which means no network) and no internet. And mind it , out in eastern hemisphere, u are going to find more machines like this than having net. And also having intenet enabled machine, may mean i have dialup machine with per MB download charges, so i may not like to connect to internet for downloading some .deb which is already on a CD in front of me.
and do not mention doing “dkpg -i abc.deb” , because it can not handle package dependencies.
In short i just want to put Ubuntu server CD on a ubuntu desktop machine and then using GUI only , i want to install ALL packages from it or all the build-essential packages (C,C+, make etc). How to achieve it in user-freindly way?
1.2) Now that Sun’s implementation of Java is GPL, so integrate sun jdk/jre instead of others jdk/jre and java plugin for firefox working by default.
basically, no need of doing apt-get install sun-java6-jdk libgcj7-awt
1.3) integrate http://www.webilder.org (Webilder delivers stunning wallpapers to your Linux desktop, directly from Flickr and Webshots. You choose what keywords (tags) to watch for, and photos are automatically downloaded to your computer. Webilder can also change the wallpaper every few minutes.)
Some OTHER extra wishes:
2.1) integrate beryl (ok ok this is already going to be done in ubuntu 7.10 gutsy gibbon)
2.2) just see Mint (http://www.linuxmint.com) linux, which is based on ubuntu itself and integrate some good features from it. For example: Mint menu has search facility to search applications in the start menu
2.3) beagle desktop search engine (http://beagle-project.org/Main_Page). In my opinion , these days all the major OSes (Mac, Win) have gone for integrating the advance search features in the OS itself, not the .
What do u expect or wish from ubuntu (say, ubuntu desktop CD ) ? Tell me. May be Santa this year may bring it to u. ![]()
* “Quote of the Day: Part 18″
Remember:
people will forget what you said …
people will forget what you did …
but people will never forget how you made them feel …
* “Quote of the Day: Part 17″
“Great spirits have always encountered violent opposition from mediocre minds.” -Albert Einstein
Nerdiness percentile
Wanna Try it!
A friend forwarded this link to me atul’s nerdiness percentile
So, I went to nerdtests.com.This houmourus test calculates how nerdy one is compared to others. Here it is:
just fun.




