I am not sure if this is an Instant Rails problem or something else. But I am working with Patrick Lenz's Building Your Own Ruby on Rails Web Applications book where in Chapter 11 he shows how to use the BreakPoint functionality within an RoR application. The book demonstrates this functionality by setting a breakpoint in one of the Controller methods as follows:
def new @story = Story.new(params[:story]) @story.user = @current_user if request.post? and @story.save breakpoint @story.tag_with params[:tags] if params[:tags] flash[:notice] = 'Story submission succeeded' redirect_to :action => 'index' end end
Now, the new action corresponds with a new story being submitted. As the author instructs, I opened the web browser and try to submit a story. The browswer is supposed to hang and I should be able to invoke the breakpoint client by using the following command:
ruby script/breakpointer
But, the browswer displays the following information instead of hanging:
RuntimeError in StoryController#new
Breakpoints are not currently working with Ruby 1.8.5 RAILS_ROOT: ./script/../config/..
The breakpoint is indeed, on line 12 of the story_controller.rb file.
This puzzles me! How are people using InstantRails (I am using InstantRails-1.5-win.zip). I also checked on the Ruby download website which shows that the current version of Ruby is 1.8.5. Does it mean that breakpoint functionality is not available in Ruby 1.8.5? Or this particular release that I am working with does not have it?
Either way, please advise on how to go about solving this problem.
On 3/22/07, Bharat Ruparel <rails-mailing-l...@andreas-s.net> wrote:
> I am not sure if this is an Instant Rails problem or something else. > But I am working with Patrick Lenz's Building Your Own Ruby on Rails Web > Applications book where in Chapter 11 he shows how to use the BreakPoint > functionality within an RoR application. The book demonstrates this > functionality by setting a breakpoint in one of the Controller methods > as follows:
> I am not sure if this is an Instant Rails problem or something else. > But I am working with Patrick Lenz's Building Your Own Ruby on Rails Web > Applications book where in Chapter 11 he shows how to use the BreakPoint > functionality within an RoR application. The book demonstrates this > functionality by setting a breakpoint in one of the Controller methods > as follows:
> def new > @story = Story.new(params[:story]) > @story.user = @current_user > if request.post? and @story.save > breakpoint > @story.tag_with params[:tags] if params[:tags] > flash[:notice] = 'Story submission succeeded' > redirect_to :action => 'index' > end > end
> Now, the new action corresponds with a new story being submitted. As > the author instructs, I opened the web browser and try to submit a > story. The browswer is supposed to hang and I should be able to invoke > the breakpoint client by using the following command:
> ruby script/breakpointer
> But, the browswer displays the following information instead of hanging:
> RuntimeError in StoryController#new
> Breakpoints are not currently working with Ruby 1.8.5 > RAILS_ROOT: ./script/../config/..
> The breakpoint is indeed, on line 12 of the story_controller.rb file.
> This puzzles me! How are people using InstantRails (I am using > InstantRails-1.5-win.zip). I also checked on the Ruby download website > which shows that the current version of Ruby is 1.8.5. Does it mean > that breakpoint functionality is not available in Ruby 1.8.5? Or this > particular release that I am working with does not have it?
> Either way, please advise on how to go about solving this problem.
Thank you both gentlemen. Steve, I am trying to install ruby-debug in InstantRails Windows environment, but cannot get past the first base! I downloaded the latest Windows specific build from RubyForge. The file is named ruby-debug-base-0.8.1-mswin32.gem.
I installed this gem using the following command:
gem install c:\ruby-debug-base-0.8.1-mswin32.gem from the InstantRails command window. Then I put the following line at the end of the development.rb file which is under config\environments directory.
require 'ruby-debug'
I saved the file and tried to start webrick by running the following command:
ruby script/server webrick
I get the following stacktrace and the server quits:
C:\InstantRails\rails_apps\shovell-debug-02>ruby script/server webrick => Booting WEBrick... C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/commands/server s/webrick.rb:11: warning: already initialized constant OPTIONS C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:i n `gem_original_require': no such file to loa d -- ruby-debug (MissingSourceFile) from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:i n `require' from ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:496:in `require' from ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:343:in `new_constants_i n' from ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:496:in `require' from ./script/../config/../config/environments/development.rb:22:in `load_environment' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:204:in `load_environment' from ./script/../config/../vendor/rails/activesupport/lib/active_support/core_ex t/kernel/reporting.rb:11:in `sil ence_warnings' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:201:in `load_environment' ... 14 levels... from ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:496:in `require' from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:39 from script/server:3:in `require' from script/server:3
Does anyone else has had success installing ruby-debug in Windows environment? The installation could not be simpler! I can see the ruby-debug gem installed and gem command lists it as a locally installed gem. What can be wrong? Bharat
I typically put the require statement at the top of the file under test, but in any case, I cranked this whole thing up in Parallels on my Mac and repro'ed your error. Here's how to fix it:
# top of file require 'rubygems' # not sure this is necessary require 'ruby-debug' Debugger.start
Then someplace else in your program, put:
debugger
and you'll have a breakpoint. I'd be curious to understand why this is necessary.
> Thank you both gentlemen. > Steve, I am trying to install ruby-debug in InstantRails Windows > environment, but cannot get past the first base! I downloaded the > latest Windows specific build from RubyForge. The file is named > ruby-debug-base-0.8.1-mswin32.gem.
> I installed this gem using the following command:
> gem install c:\ruby-debug-base-0.8.1-mswin32.gem from the InstantRails > command window. Then I put the following line at the end of the > development.rb file which is under config\environments directory.
> require 'ruby-debug'
> I saved the file and tried to start webrick by running the following > command:
> ruby script/server webrick
> I get the following stacktrace and the server quits:
> C:\InstantRails\rails_apps\shovell-debug-02>ruby script/server webrick > => Booting WEBrick... > C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/commands/server s/webrick.rb:11: > warning: already initialized > constant OPTIONS > C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:i n > `gem_original_require': no such file to loa > d -- ruby-debug (MissingSourceFile) > from > C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:i n > `require' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:496:in > `require' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:343:in > `new_constants_i > n' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:496:in > `require' > from > ./script/../config/../config/environments/development.rb:22:in > `load_environment' > from > ./script/../config/../vendor/rails/railties/lib/initializer.rb:204:in > `load_environment' > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/core_ex t/kernel/reporting.rb:11:in > `sil > ence_warnings' > from > ./script/../config/../vendor/rails/railties/lib/initializer.rb:201:in > `load_environment' > ... 14 levels... > from > ./script/../config/../vendor/rails/activesupport/lib/active_support/depende ncies.rb:496:in > `require' > from > ./script/../config/../vendor/rails/railties/lib/commands/server.rb:39 > from script/server:3:in `require' > from script/server:3
> Does anyone else has had success installing ruby-debug in Windows > environment? The installation could not be simpler! I can see the > ruby-debug gem installed and gem command lists it as a locally installed > gem. What can be wrong? > Bharat
Success! Thank you Steve for your patience. Here is/was the problem. I was using the downloaded code from author's site without much thinking, that was the root cause. Since Rails 1.2 was not officially released when the author created his code, he had packaged various 1.2 rails components and installed them in the vendors subdirectory of his example code. This is the same approach taken by Agile Web.. 2nd Edition. Now, this code base was at release 1.2.1 and it overrode the InstantRails more recent 1.2.2 code base. Also, when I installed ruby-debug, it would go to the Instant Rail's gem lib directory under the "ruby" folder. This mismatch of rails versions and misplacement of the gems was creating this problem. I went back to ground zero. Created the sample app from scratch. Copied author's code folder by folder taking care not to copy-over any rails 1.2.2 specific code, installed ruby-debug using gem install command, put a breakpoint as directed in the link that you posted for ruby-debug tutorial, and things are working just fine now! Again, appreciate your help and patience. Regards, Bharat p.s. In your experience, how well has ruby-debug worked compared to script/breakpointer?
I do must of my debugging using logs. On the rare occasion when I need to examine something in a debugger, ruby-debug is far superior. Typically, what I would be looking at with a debugger are code paths and data state changes, neither of which breakpointer helps out with much.
> Success! > Thank you Steve for your patience. Here is/was the problem. I was > using the downloaded code from author's site without much thinking, that > was the root cause. > Since Rails 1.2 was not officially released when the author created his > code, he had packaged various 1.2 rails components and installed them in > the vendors subdirectory of his example code. This is the same approach > taken by Agile Web.. 2nd Edition. Now, this code base was at release > 1.2.1 and it overrode the InstantRails more recent 1.2.2 code base. > Also, when I installed ruby-debug, it would go to the Instant Rail's gem > lib directory under the "ruby" folder. This mismatch of rails versions > and misplacement of the gems was creating this problem. > I went back to ground zero. Created the sample app from scratch. > Copied author's code folder by folder taking care not to copy-over any > rails 1.2.2 specific code, installed ruby-debug using gem install > command, put a breakpoint as directed in the link that you posted for > ruby-debug tutorial, and things are working just fine now! > Again, appreciate your help and patience. > Regards, > Bharat > p.s. In your experience, how well has ruby-debug worked compared to > script/breakpointer?
Hello Jon, Here is what I did to debug the story_controller.rb file in the aforementioned book: I first installed the ruby-debug gem by executing the gem install command.
Next, as Steve outlines above, I put the following three statements at the top of the file.
# top of the story_controller.rb file require 'rubygems' # not sure this is necessary require 'ruby-debug' Debugger.start
Then I put the debugger statement where I wanted the program to stop. In my case it was in the new method right after the save statement.
Next, I fired up my browser(IE) and posted a new story. You should notice the browswer to hang. At this point, do not expect a command window to pop-up. Instead, look at the command window from which you started the web server. I am using webrick by executing the command: ruby script/server webrick I will try it with Mongrel as well later and report my findings.
Look for the ruby debug prompt in the command window from where you started the web server. Try to issue a simple "list" command to see if the debugger indeed lists the source. If it works then try to display the values of instance variables, or params hash using either "p" or "pp" commands. For example, in my case I did the following:
p @story or pp @story
to print the params hash, do a similar command, i.e.
p params or pp params
The debugger is very unix/linux like in which no news is good news. I primarily develop in linux, but there are times when I have to be in Windows environment and therefore, I was looking to see if ruby and RoR development is viable in it. I think that the InstantRails team has done a fabulous job and made ruby and RoR on Windows machine an almost usable alternative.
Let me know if this helps. Credit goes to Steve though.
Thank you. Out of curiosity, may I ask what the issue was that caused you to break out the debugger? I've always been a fan of debuggers -- that is, until I began Rails programming. The combination of tests and the logger has been adequate for over 90% of my debugging needs.
> Hello Jon, > Here is what I did to debug the story_controller.rb file in the > aforementioned book: > I first installed the ruby-debug gem by executing the gem install > command.
> Next, as Steve outlines above, I put the following three statements at > the top of the file.
> # top of the story_controller.rb file > require 'rubygems' # not sure this is necessary > require 'ruby-debug' > Debugger.start
> Then I put the debugger statement where I wanted the program to stop. > In my case it was in the new method right after the save statement.
> Next, I fired up my browser(IE) and posted a new story. You should > notice the browswer to hang. At this point, do not expect a command > window to pop-up. Instead, look at the command window from which you > started the web server. I am using webrick by executing the command: > ruby script/server webrick > I will try it with Mongrel as well later and report my findings.
> Look for the ruby debug prompt in the command window from where you > started the web server. Try to issue a simple "list" command to see if > the debugger indeed lists the source. If it works then try to display > the values of instance variables, or params hash using either "p" or > "pp" commands. For example, in my case I did the following:
> p @story > or > pp @story
> to print the params hash, do a similar command, i.e.
> p params > or > pp params
> The debugger is very unix/linux like in which no news is good news. I > primarily develop in linux, but there are times when I have to be in > Windows environment and therefore, I was looking to see if ruby and RoR > development is viable in it. I think that the InstantRails team has > done a fabulous job and made ruby and RoR on Windows machine an almost > usable alternative.
> Let me know if this helps. Credit goes to Steve though.
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of s.ross Sent: Sunday, March 25, 2007 11:26 AM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
Any errors or just a quiet failure?
Also are you doing:
ruby script\server webrick
to get your app running?
To be honest, I don't develop on Windows, so my test was on a hand-built Ruby/MySQL/Rails install, not instant rails.
--steve
JESii wrote:
> Steve... I'm also on InstantRails/Windows and tried the suggestions in > this thread... Two things:
> 1. I had to add: require 'ruby-debug-base' to get this to work > 2. my 'debugger' command doesn't make anything happen.
> I tried it with and without the require 'rubygems' and that didn't > make any difference.
> Any thoughts as to what I'm doing wrong?
> Thanks...jon
>> # top of file >> require 'rubygems' # not sure this is necessary >> require 'ruby-debug' >> Debugger.start
>> Then someplace else in your program, put:
>> debugger
>> and you'll have a breakpoint. I'd be curious to understand why this is >> necessary.
Jon, If you describe the steps that you are taking in more detail and more importantly, what do you see when you do what, may be I can help you pinpoint the problem. I do not understand "quiet failure". Steve, I was merely, trying to explore all available options on Ruby on Rails. I am just starting out with Ruby and RoR and try to explore various things. I am still trying to get my head around writing more effective tests and Patrick's book has been invaluable on that topic. It is a mental shift though. I am glad that you brought up logs. Do you know an effective way of viewing "formatted" log in Windows environment? In linux, the less command does a great job of showing formatted entries. I have not been able to replicate it in the Windows environment. I do not want to use Cygwin since I have a dual boot machine and I can boot into Linux if I want to. Regards, Bharat
Bharat... Thanks very much for getting back to me... here's what is happening.
1. I followed the instructions you and Steve discussed. It failed for me, but I got it to work by requiring 'ruby-debug-base' instead. 2. The require 'rubygems' is not necessary; I tried it both ways. 3. No browser hang - it just goes about its normal behavior and nothing in the mongrel window.
I definitely agree with the assessment about InstantRails. I do have some issues with it, but they are relatively minor at this point. I wish I could say the same thing about RadRails which I do use, but which is completely broken for updates. At least what I have seems to be holding together moderately well.
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Bharat Ruparel Sent: Sunday, March 25, 2007 11:56 AM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
Hello Jon, Here is what I did to debug the story_controller.rb file in the aforementioned book: I first installed the ruby-debug gem by executing the gem install command.
Next, as Steve outlines above, I put the following three statements at the top of the file.
# top of the story_controller.rb file require 'rubygems' # not sure this is necessary require 'ruby-debug' Debugger.start
Then I put the debugger statement where I wanted the program to stop. In my case it was in the new method right after the save statement.
Next, I fired up my browser(IE) and posted a new story. You should notice the browswer to hang. At this point, do not expect a command window to pop-up. Instead, look at the command window from which you started the web server. I am using webrick by executing the command: ruby script/server webrick I will try it with Mongrel as well later and report my findings.
Look for the ruby debug prompt in the command window from where you started the web server. Try to issue a simple "list" command to see if the debugger indeed lists the source. If it works then try to display the values of instance variables, or params hash using either "p" or "pp" commands. For example, in my case I did the following:
p @story or pp @story
to print the params hash, do a similar command, i.e.
p params or pp params
The debugger is very unix/linux like in which no news is good news. I primarily develop in linux, but there are times when I have to be in Windows environment and therefore, I was looking to see if ruby and RoR development is viable in it. I think that the InstantRails team has done a fabulous job and made ruby and RoR on Windows machine an almost usable alternative.
Let me know if this helps. Credit goes to Steve though.
yeah, cygwin would have been my recommendation. Really, all you are looking for is something with tail capabilities that understands terminal escape sequences. I prefer to keep environments similar, where possible, so cygwin makes sense. That way, whether I'm on Windows or *nix, ls works, tail works, and so on.
Many Windows editors sense external modifications to files, but seldom do they put you at the end of the file automagically. Alternatively, just write a simple "tail" utility in C or Ruby (not very DRY :).
> Jon, > If you describe the steps that you are taking in more detail and more > importantly, what do you see when you do what, may be I can help you > pinpoint the problem. I do not understand "quiet failure". > Steve, > I was merely, trying to explore all available options on Ruby on Rails. > I am just starting out with Ruby and RoR and try to explore various > things. I am still trying to get my head around writing more effective > tests and Patrick's book has been invaluable on that topic. It is a > mental shift though. > I am glad that you brought up logs. Do you know an effective way of > viewing "formatted" log in Windows environment? In linux, the less > command does a great job of showing formatted entries. I have not been > able to replicate it in the Windows environment. I do not want to use > Cygwin since I have a dual boot machine and I can boot into Linux if I > want to. > Regards, > Bharat
Bharat... "quiet failure" just means that nothing happened: no error messages, no browser hang, no information in the server log.
BTW, I have read the Lenz book as well, along with two other books I am working on: "Ruby for Rails" (David Black) and "Agile Web Development with Rails" (Thomas & Hanssen) - both very good.
Re "formatted log viewing" - I don't know if this is what you mean, but I use vim (Vi Improved - www.vim.org). They have several really nice plugins for ruby/rails. If you're a vim person (I've used it for many years), then you'll love this software, and it's free and very well supported.
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Bharat Ruparel Sent: Sunday, March 25, 2007 12:21 PM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
Jon, If you describe the steps that you are taking in more detail and more importantly, what do you see when you do what, may be I can help you pinpoint the problem. I do not understand "quiet failure". Steve, I was merely, trying to explore all available options on Ruby on Rails. I am just starting out with Ruby and RoR and try to explore various things. I am still trying to get my head around writing more effective tests and Patrick's book has been invaluable on that topic. It is a mental shift though. I am glad that you brought up logs. Do you know an effective way of viewing "formatted" log in Windows environment? In linux, the less command does a great job of showing formatted entries. I have not been able to replicate it in the Windows environment. I do not want to use Cygwin since I have a dual boot machine and I can boot into Linux if I want to. Regards, Bharat
I was having problems getting the right syntax to get the logger to work for me (wanted to look at some session variables)... I finally figured out what I was doing wrong and so now my logger stuff is working. At this point, I figured I'd just try to get the debugger working for whenever I might need it in the future. Actually not needed right this moment.
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of s.ross Sent: Sunday, March 25, 2007 12:01 PM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
Thank you. Out of curiosity, may I ask what the issue was that caused you to break out the debugger? I've always been a fan of debuggers -- that is, until I began Rails programming. The combination of tests and the logger has been adequate for over 90% of my debugging needs.
--steve
Joshua Muheim-2 wrote:
> Hello Jon, > Here is what I did to debug the story_controller.rb file in the > aforementioned book: > I first installed the ruby-debug gem by executing the gem install > command.
> Next, as Steve outlines above, I put the following three statements at > the top of the file.
> # top of the story_controller.rb file > require 'rubygems' # not sure this is necessary > require 'ruby-debug' > Debugger.start
> Then I put the debugger statement where I wanted the program to stop. > In my case it was in the new method right after the save statement.
> Next, I fired up my browser(IE) and posted a new story. You should > notice the browswer to hang. At this point, do not expect a command > window to pop-up. Instead, look at the command window from which you > started the web server. I am using webrick by executing the command: > ruby script/server webrick > I will try it with Mongrel as well later and report my findings.
> Look for the ruby debug prompt in the command window from where you > started the web server. Try to issue a simple "list" command to see if > the debugger indeed lists the source. If it works then try to display > the values of instance variables, or params hash using either "p" or > "pp" commands. For example, in my case I did the following:
> p @story > or > pp @story
> to print the params hash, do a similar command, i.e.
> p params > or > pp params
> The debugger is very unix/linux like in which no news is good news. I > primarily develop in linux, but there are times when I have to be in > Windows environment and therefore, I was looking to see if ruby and RoR > development is viable in it. I think that the InstantRails team has > done a fabulous job and made ruby and RoR on Windows machine an almost > usable alternative.
> Let me know if this helps. Credit goes to Steve though.
FYI... I've got MKS toolkit, which is very nice; having used that for quite some time, it's a little hard to switch over to cygwin: I keep getting bitten by cygwin's c-drive references.
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of s.ross Sent: Sunday, March 25, 2007 12:29 PM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
yeah, cygwin would have been my recommendation. Really, all you are looking for is something with tail capabilities that understands terminal escape sequences. I prefer to keep environments similar, where possible, so cygwin makes sense. That way, whether I'm on Windows or *nix, ls works, tail works, and so on.
Many Windows editors sense external modifications to files, but seldom do they put you at the end of the file automagically. Alternatively, just write a simple "tail" utility in C or Ruby (not very DRY :).
--steve
Joshua Muheim-2 wrote:
> Jon, > If you describe the steps that you are taking in more detail and more > importantly, what do you see when you do what, may be I can help you > pinpoint the problem. I do not understand "quiet failure". > Steve, > I was merely, trying to explore all available options on Ruby on Rails. > I am just starting out with Ruby and RoR and try to explore various > things. I am still trying to get my head around writing more effective > tests and Patrick's book has been invaluable on that topic. It is a > mental shift though. > I am glad that you brought up logs. Do you know an effective way of > viewing "formatted" log in Windows environment? In linux, the less > command does a great job of showing formatted entries. I have not been > able to replicate it in the Windows environment. I do not want to use > Cygwin since I have a dual boot machine and I can boot into Linux if I > want to. > Regards, > Bharat
Bharat Ruparel wrote: > I am glad that you brought up logs. Do you know an effective way of > viewing "formatted" log in Windows environment? In linux, the less > command does a great job of showing formatted entries. I have not been > able to replicate it in the Windows environment. I do not want to use > Cygwin since I have a dual boot machine and I can boot into Linux if I > want to.
Well, it's no substitute for a good command-line shell, but RadRails has a "tail" function for log files. Just right-click on the log file in the file navigator and choose "Tail". Also, if you run mongrel (or webrick) from within RadRails, it puts the mongrel output to a console. So, stdout (puts) goes to the mongrel output and rails logging (logger) goes to the console tailing the development.log.
Thanks Jon and Ben. Jon, I use vim in linux and GVIM and CREAM in Windows environment. Do you know an easy way of turning formatting on in these editors? I am not very familiar with them in Windows. In Linux "less" works great for me so I don't bother. Here is how it looks like in my GVIM or CREAM environment in Windows:
Sorry, apparently I've missed this thread. The installation procedure of ruby-debug on Windows should be the same as on any other platform. The only difference is that you have to select mswin32 version of ruby-debug-base:
C:\>gem in ruby-debug Bulk updating Gem source index for: http://gems.rubyforge.org Select which gem to install for your platform (i386-mswin32) 1. ruby-debug 0.8.1 (ruby) 2. ruby-debug 0.8 (ruby) 3. ruby-debug 0.7.5 (mswin32) 4. ruby-debug 0.7.5 (ruby) 5. Skip this gem 6. Cancel installation
> 1
Install required dependency ruby-debug-base? [Yn] y Select which gem to install for your platform (i386-mswin32) 1. ruby-debug-base 0.8.1 (mswin32) 2. ruby-debug-base 0.8.1 (ruby) 3. Skip this gem 4. Cancel installation
> 1
Successfully installed ruby-debug-0.8.1 Successfully installed ruby-debug-base-0.8.1-mswin32 Installing ri documentation for ruby-debug-0.8.1... Installing ri documentation for ruby-debug-base-0.8.1-mswin32... Installing RDoc documentation for ruby-debug-0.8.1... Installing RDoc documentation for ruby-debug-base-0.8.1-mswin32...
The easiest way of debugging your Rails application is to run it with rdebug script:
C:\rails-app>rdebug ./script/server
It should work with webrick or mongrel. If you use rdebug script you don't have to require ruby-debug in your environment.rb file and to start the debugger with Debugger.start method. Of course, you still have to set your breakpoints either explicitly using debugger's 'break' command or via Kernel#debugger method.
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Kent Sibilev Sent: Sunday, March 25, 2007 9:43 PM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
Sorry, apparently I've missed this thread. The installation procedure of ruby-debug on Windows should be the same as on any other platform. The only difference is that you have to select mswin32 version of ruby-debug-base:
C:\>gem in ruby-debug Bulk updating Gem source index for: http://gems.rubyforge.org Select which gem to install for your platform (i386-mswin32) 1. ruby-debug 0.8.1 (ruby) 2. ruby-debug 0.8 (ruby) 3. ruby-debug 0.7.5 (mswin32) 4. ruby-debug 0.7.5 (ruby) 5. Skip this gem 6. Cancel installation > 1 Install required dependency ruby-debug-base? [Yn] y Select which gem to install for your platform (i386-mswin32) 1. ruby-debug-base 0.8.1 (mswin32) 2. ruby-debug-base 0.8.1 (ruby) 3. Skip this gem 4. Cancel installation > 1 Successfully installed ruby-debug-0.8.1 Successfully installed ruby-debug-base-0.8.1-mswin32 Installing ri documentation for ruby-debug-0.8.1... Installing ri documentation for ruby-debug-base-0.8.1-mswin32... Installing RDoc documentation for ruby-debug-0.8.1... Installing RDoc documentation for ruby-debug-base-0.8.1-mswin32...
The easiest way of debugging your Rails application is to run it with rdebug script:
C:\rails-app>rdebug ./script/server
It should work with webrick or mongrel. If you use rdebug script you don't have to require ruby-debug in your environment.rb file and to start the debugger with Debugger.start method. Of course, you still have to set your breakpoints either explicitly using debugger's 'break' command or via Kernel#debugger method.
Bharat... There is a ruby/rails plugin for vim that does it for me, as I recall. I tried getting to the vim.org site, and it seems to be having problems. The plugin that I use is by Tim Pope, and you can reach him at "tim - AT - pope.info" He was very helpful when I was setting it up. It's a VERY extensive plugin, and worked right out of the box for me.
Here's a dump of my log; it doesn't show the coloring and highlighting that my gvim gives me, so it's much nicer than it looks here. (E.g., the "DEPRECATION WARNING" is highlighted in red...)
Cheers...jon
Processing AssetController#index (for 10.0.0.152 at 2007-03-25 12:18:26) [GET] Session ID: 4cfdd7473a144e83709d3cd9463289f3 Parameters: {"action"=>"index", "controller"=>"asset"} Redirected to http://edp18:3010/asset/list Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://edp18/asset] DEPRECATION WARNING: model is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details. (called from C:/Dev/INSTAN~1/rails_apps/AssetList/config/../app/controllers/application. r b:11) DEPRECATION WARNING: depend_on is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details. (called from model_without_deprecation at C:/Dev/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_co n troller/deprecated_dependencies.rb:13) User Columns (0.015000) SHOW FIELDS FROM users
Processing AssetController#list (for 10.0.0.152 at 2007-03-25 12:18:27) [GET] Session ID: 4cfdd7473a144e83709d3cd9463289f3 Parameters: {"action"=>"list", "controller"=>"asset"} Asset Columns (0.000000) SHOW FIELDS FROM assets Rendering layoutfalsetemplateajax_scaffold/list.rhtml within layouts/asset Rendering ajax_scaffold/list.rhtml Start rendering component ({:action=>"table", :params=>{"action"=>"list", "controller"=>"asset"}, :controller=>"/asset"}):
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Bharat Ruparel Sent: Sunday, March 25, 2007 1:40 PM To: rubyonrails-talk@googlegroups.com Subject: [Rails] Re: Break Point not working in Ruby 1.8.5?
Thanks Jon and Ben. Jon, I use vim in linux and GVIM and CREAM in Windows environment. Do you know an easy way of turning formatting on in these editors? I am not very familiar with them in Windows. In Linux "less" works great for me so I don't bother. Here is how it looks like in my GVIM or CREAM environment in Windows: