watchr icon indicating copy to clipboard operation
watchr copied to clipboard

watchr doesn't handle ruby-debug well?

Open imajes opened this issue 14 years ago • 4 comments

what's the right way to handle going into debugger with watchr? is there anything that could be written up to make this clearer?

imajes avatar Oct 04 '11 22:10 imajes

Seems to work fine for me. Here's a simplified watchr file we use:

def run(file)
  if File.exist?(file)
    puts("Running #{file}")
    system("rspec #{file}")
  else
    $stderr.puts "Could not find #{file}"
  end
end

watch("^lib/(.*)\.rb")                        { |m| run("spec/lib/#{m[1]}_spec.rb") }

As long as we have ruby-debug loaded up correctly, everything works as expected. We're using watchr 0.7.

ajsharp avatar Oct 04 '11 23:10 ajsharp

So, rspec breaks out into debug as you would expect in the watchr terminal?

What does 'set it up right' entail?

Sent from my iPhone

On Oct 4, 2011, at 19:01, Alex [email protected] wrote:

Seems to work fine for me. Here's a simplified watchr file we use:

def run(file)
 if File.exist?(file)
   puts("Running #{file}")
   system("rspec #{file}")
 else
   $stderr.puts "Could not find #{file}"
 end
end

watch("^lib/(.*)\.rb")                        { |m| run("spec/lib/#{m[1]}_spec.rb") }

As long as we have ruby-debug loaded up correctly, everything works as expected. We're using watchr 0.7.

Reply to this email directly or view it on GitHub: https://github.com/mynyml/watchr/issues/34#issuecomment-2292549

imajes avatar Oct 04 '11 23:10 imajes

So, rspec breaks out into debug as you would expect in the watchr terminal?

Yep.

What does 'set it up right' entail?

I just mean to make sure to require 'ruby-debug' somewhere either in the spec file or in spec_helper.

What problems are you having with it?

ajsharp avatar Oct 04 '11 23:10 ajsharp

I had a problem with using ruby debugger and it was related to this script: https://gist.github.com/276317. There are variations of this one floating around, but the way it executes the commands won't allow you to drop into a debugger. I changed the run() method to system() and it works great.

Do you all have a recommended watchr script that emulates the functionality of autotest? That may be worth having an official copy!

tomrossi7 avatar Sep 05 '12 18:09 tomrossi7