Thank you Wes, I will definitely have to take a look at that...it could be very helpful. You are correct in assuming there's no readline for Windows, however, so this may not get me where I want on my Windows machines. What does ruby use under Windows? I do see StdioInputMethod, so I thought I'd try running JRuby with IRB again.
It turns out the current killer is the lack of autoload functionality in JRuby, which is an unfortunate lacking. Perhaps it's time we got around to adding it...I don't believe it would be *too* difficult. Thanks again, I'll have a look at your eval.rb on my *nix machines. - Charlie On 2/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Here's a readline-enabled version of eval.rb that I've had lying around > for awhile. It's a modified version of eval.rb and doesn't require any > changes to jruby to run. It's not sophisticated at all; it's basically > eval.rb with readline's ability to do editing, history, etc. Since I > based the readline part on some java code, it has some java-isms in it > rather than doing things the ruby way. Any bugs should probably be > blamed on the original eval.rb. :) > > It's been tested on linux (I don't know if Win has a version of > libreadline-java). You need to have libreadline-java.jar on your > classpath and java also needs to be able to load libJavaReadline.so. So > this does not fulfill a pure java requirement, but it's been enough to > keep me from pulling my hair out. > > It handles both ruby exceptions and java ones. You can exit by hitting > C-d. > > The indenting is pretty unreliable (it's based on eval.rb) so I would > suggest setting it to 0. > > You can specify which readline library to load by editing the string at > the top of the file. You can use something other than GnuReadline > (Editline?) if that causes a licensing problem. > > If you put the file into lib/ruby/site_ruby, you can start it with a > shell script similar to this: > > #! /bin/sh > > export JAVA_HOME=/opt/java > export JRUBY_HOME=/opt/jruby/cvs/jruby > export READLINE=/usr/share/java/libreadline-java.jar > export CLASSPATH=$CLASSPATH:$READLINE:$JRUBY_HOME/lib/jruby.jar:. > > exec $JAVA_HOME/bin/java -classpath $CLASSPATH org.jruby.Main > -I$JRUBY_HOME/lib/ruby/site_ruby -reval_readline "$@" > > > > Wes > > On Thu, 9 Feb 2006, Charles O Nutter wrote: > > | It's become increasingly irritating that there's nothing equivalent to > | IRB that works with JRuby on the command-line. I'm personally tired of > | having a stack of test*.rb files around or using cumbersome -e strings > | to try out every little thing I need to test while working on JRuby. > | Something better is needed. > | > | Could Ruby's IRB be modified to work correctly with JRuby? I know it > | currently doesn't work because we don't have the terminal reading and > | manipulating capabilities necessary in Java, but could those > | requirements be ripped out? > | > | Is there an alternative to IRB that would work in JRuby? I'm not > | looking for anything fancy; just a basic interactive environment that > | I can run easily from the command-line. > | > | Could we just start working on our own simpler "jirb" so there's > | something roughly equivalent to IRB in the JRuby standard distro? > | How's this for a completely naive approach (that doesn't support > | multi-line constructs, naturally): > | > | STDOUT << '> ' > | > | while (x = > > -- > # Wes Nakamura <[EMAIL PROTECTED]> > > -- Charles Oliver Nutter @ headius.blogspot.com JRuby Developer @ jruby.sourceforge.net Application Architect @ www.ventera.com ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Jruby-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jruby-devel
