使用ruby-debug和jruby-1.5.0

时间:2010-06-09 20:43:05

标签: jruby ruby-debug

Release notes说默认安装ruby-debug。我正在使用rvm。在我的rails应用程序中,我认为像script/server --debugger这样简单的东西就足够了,但它抱怨没有安装ruby-debug gem,建议使用gem install ruby-debug,这当然不起作用(构建本机无论如何,这与文档相反。

只是想知道是否有人在jruby 1.5中使用内置的ruby-debug以及在调试模式下运行jruby时需要做什么。

这是我的输出:

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'

2 个答案:

答案 0 :(得分:2)

嗯,它似乎对我有用。

~/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)

鉴于以下_test_2.html部分:

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

你是怎么得到JRuby的?

答案 1 :(得分:1)

我对RVM + JRuby组合有同样的问题。有关解决方法,请参阅我的帖子:http://wordsanddeeds.posterous.com/debugging-with-rvm-jruby