watchr doesn't handle ruby-debug well? #34

Open
imajes opened this Issue Oct 4, 2011 · 4 comments

Comments

Projects
None yet
3 participants

imajes commented Oct 4, 2011

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

ajsharp commented Oct 4, 2011

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.

imajes commented Oct 4, 2011

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 Sharpreply@reply.github.com 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:
#34 (comment)

ajsharp commented Oct 4, 2011

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?

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment