views:

202

answers:

2

Release notes say that ruby-debug is installed by default. I'm using rvm. In my rails app I figured something as simple as script/server --debugger would suffice, but it complains that the ruby-debug gem isn't installed, suggests using gem install ruby-debug, which of course doesn't work (building native extensions) and is contrary to the docs anyway.

Just wondering if anyone's had any luck using the built in ruby-debug in jruby 1.5 and what one needs to do in order run jruby in debug mode.

Here's my output:

brad-robertsons-macbook-pro:trunk bradrobertson$ which ruby
/Users/bradrobertson/.rvm/rubies/jruby-1.5.1/bin/ruby
brad-robertsons-macbook-pro:trunk bradrobertson$ jruby --debug script/server --debugger
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
+1  A: 

Hmm, it appears to work for me.

~/projects/jruby/yogi/test ➔ jruby --debug script/server --debugger
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Debugger enabled
=> Call with -d to detach
=> Ctrl-C to shutdown server
app/views/test/_test2.html.erb:3
<% 6.times do -%>
(rdb:3) next
app/views/test/_test2.html.erb:3
<% 6.times do -%>
(rdb:3) step
app/views/test/_test2.html.erb:4
<%= render :partial => "test3.html.erb" %>
(rdb:3) step
/Users/headius/projects/jruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/output_safety.rb:34
result = concat_without_safety(other_or_fixnum)

Given the following _test_2.html partial:

<div >
    <% debugger -%>
    <% 6.times do -%>
        <%= render :partial => "test3.html.erb" %>
    <% end -%>
</div>

How did you get JRuby?

Charles Oliver Nutter
RVM: added in my output above
brad
I'm not sure what RVM is doing differently here, but the standard JRuby distribution should ship with ruby-debug and work just fine. Perhaps take it up with RVM folks?
Charles Oliver Nutter
will do, thanks for the help.
brad
A: 

I have the same problems with the RVM + JRuby combination. See my post on this for a work-around: http://wordsanddeeds.posterous.com/debugging-with-rvm-jruby

Jason Rogers