netbeans debug rails 3.0

Posted by wxianfeng Sun, 31 May 2009 22:09:00 GMT

环境:ruby 1.9.2 + rails 3.0.3 + nb 6.9.1 + ubuntu 10.10

nb debug rails 3.0 还没有跟上,不可以debug rails 3.0项目了,网上也有很多人遇到,可能出现下面这个异常:

Uncaught exception: no such file to load -- script/rails

我有一个解决办法,把你要debug的项目path直接写进去,

需要用到的gem:

ruby-debug-base19 (0.11.24)
ruby-debug-ide (0.4.9)
linecache19 (0.5.11)

如果是debug test file 的话,还需要 test-unit

wxianfeng@ubuntu:~$ gem list ruby-

*** LOCAL GEMS ***

ruby-debug-base19 (0.11.24)
ruby-debug-ide (0.4.9)
wxianfeng@ubuntu:~$ gem list line

*** LOCAL GEMS ***

linecache19 (0.5.11)
wxianfeng@ubuntu:~$ gem list test

*** LOCAL GEMS ***

test-unit (2.1.2)

当前rvm环境;

wxianfeng@ubuntu:~$ rvm info

ruby-1.9.2-p0:

  system:
    uname:       "Linux ubuntu 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.1.0 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p0"
    date:         "2010-08-18"
    platform:     "i686-linux"
    patchlevel:   "2010-08-18 revision 29036"
    full_version: "ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]"

  homes:
    gem:          "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0"
    ruby:         "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0"

  binaries:
    ruby:         "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin/ruby"
    irb:          "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin/irb"
    gem:          "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin/gem"
    rake:         "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0/bin/rake"

  environment:
    PATH:         "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0/bin:/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0@global/bin:/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/bin:/home/wxianfeng/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/system/mysql/bin:/usr/local/system/jdk1.6.0_22/bin"
    GEM_HOME:     "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0"
    GEM_PATH:     "/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0:/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0@global"
    MY_RUBY_HOME: "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0"
    IRBRC:        "/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p0/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

注意把netbeans的 gem_home , gem_path 设置为 当前 rvm 对应的 gem_home , gem_path , 设置gem_path 时 nb 默认 .rvm 目录不显示,需要直接在 对话框中输入路径

最后修改

/home/wxianfeng/.rvm/gems/ruby-1.9.2-p0/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb

大概 110 行

      path = "/usr/local/system/projects/entos/ent_os/script/rails"
      bt = debug_load(path, options.stop, options.load_mode)
      #      bt = debug_load(Debugger::PROG_SCRIPT, options.stop, options.load_mode)

注释一行,添加两行

把你需要调试的项目 set as main project ,然后 debug main project !

ok~!

如果你需要debug 单个ruby 文件 , 那么 需要改回来 , 这里注意.

see:
http://forums.netbeans.org/topic31103.html

This entry was posted on Sun, 31 May 2009 22:09:00 GMT and Posted in . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.

Tags , ,


Trackbacks

Use the following link to trackback from your own site:
http://wxianfeng.com/trackbacks?article_id=125

Comments

  1. Avatar
    imfigo over {{count}} years ago:

    你好,然后出现Uncaught exception: superclass mismatch for class RemoteInterface 请问何解?
    ruby 1.9.2 + rails 3.1 + nb 7.0 + ubuntu 11.06

  2. Avatar
    wxianfeng over {{count}} years ago:

    @imfigo

    把下面的gem都装上

    >gem install ruby-debug19
    >gem install ruby-debug-base19
    >gem install ruby-debug-ide
    >gem install linecache19

  3. Avatar
    imfigo over {{count}} years ago:

    @wxianfeng
    以上gem事先就都装了。ruby-debug-ide19也装了。

Leave a comment