Some questions about serious Ruby development

I like Ruby. I like it more than Python. It's my PERL replacement. I
used to use PERL for automated file management but I have switched to Ruby
because it is awesome and PERL blows. To be fair, I thought PERL was
awesome at the time but it's old news, now...

    So, here I come, Ruby!

    I'm starting to think that I can use Ruby for some serious software
development. I think a hardcore application can be written in a careful
combination of Ruby and C++ (and some other stuff, too!). So, I did a bit
of looking around which has only caused me to develop some questions...

    Can anyone recommend a good IDE? Ah, the tired IDE question... I did a
search on groups.google on this subject and, yes, it is a common question.
However, every instance of it seems to have the same theme. Vi(m) is the
greatest text editor out there (I found Emacs too hard to learn). Syntax
highlighting is highly overrated and auto-completion is useless. What I
need from an IDE is a debugger! Even if it were as simple as the ability to
place breakpoints, step into and over lines of code, display evaluation
results (like what IRB does), and list variables in scope. It would also be
nice if it would let me evaluate methods of variables in scope, so I can try
to get the state of various objects. Seriously, I'm tired of printf
debugging (not that anyone uses printf in Ruby)...

    Can anyone recommend a good... I don't know the proper term for this
but... a GUI toolkit? A widget toolkit? Something that allows me to create
and manage windows and widgets to put in those windows. I'll need the
ability to create new (custom) widgets and it would be nice if it were cross
platform...

    Well, those are my questions, for now. I'll certainly be back if I have
any more and I will, of course, continue to lurk here as well as answer the
few questions I think I can answer competently! I'm really excited about
doing some serious Ruby development and I look forward to whatever
suggestions I get!
    Thank you for your help...

What I need from an IDE is a debugger! Even if it were as simple as the
ability to place breakpoints, step into and over lines of code, display
evaluation results (like what IRB does), and list variables in scope.

You don't say if you have Visual Studio. If so, you can try out our Ruby In
Steel IDE. This has breakpoints, watch variables, locals, autos, step
into/over, run to, evaluate in a command window, syntax error location plus
code colouring/collapsing, Rails development tools etc. Not yet IntelliSense
but we are working on that at the moment...

Download the latest here: http://www.sapphiresteel.com

best wishes
Huw Collingbourne

Just to take things in a whole different direction, are you using test driven development? I've found that TDD has eliminated a lot of my need for debugging. It's a little like that printf debugging except that the printf's become asserts and you don't have to throw them away. They stay useful.

That being said, Eclipse's RDT is supposed to handle debugging, but I haven't had much luck with it so far.
-Mat

···

On Jul 11, 2006, at 5:55 AM, Just Another Victim of the Ambient Morality wrote:

    Can anyone recommend a good IDE? Ah, the tired IDE question... I did a
search on groups.google on this subject and, yes, it is a common question.
However, every instance of it seems to have the same theme. Vi(m) is the
greatest text editor out there (I found Emacs too hard to learn). Syntax
highlighting is highly overrated and auto-completion is useless. What I
need from an IDE is a debugger! Even if it were as simple as the ability to
place breakpoints, step into and over lines of code, display evaluation
results (like what IRB does), and list variables in scope. It would also be
nice if it would let me evaluate methods of variables in scope, so I can try
to get the state of various objects. Seriously, I'm tired of printf
debugging (not that anyone uses printf in Ruby)...

Syntax highlighting is highly overrated and auto-completion is useless.

What I need from an IDE is a debugger! Even if it were as simple as the ability to
place breakpoints, step into and over lines of code, display evaluation
results (like what IRB does), and list variables in scope. It would also be
nice if it would let me evaluate methods of variables in scope, so I can try
to get the state of various objects. Seriously, I'm tired of printf
debugging (not that anyone uses printf in Ruby)...

Two suggestions, check out the breakpoint gem -- it is pretty much
what you say you want from a debugger. If what you really want is a
full IDE with a good integrated debugger, then you should check out
ArachnoEdit (ruby-ide.com). It is a commercial product, still in beta
that seems to get developed in a series of sprints. It has a custom
version of Ruby with a C extension for much faster debugging/stepping.

    Can anyone recommend a good... I don't know the proper term for this
but... a GUI toolkit?

Check the archive, we _just_ had this discussion: FXRuby, QtRuby,
wxRuby seem to be the primary choices.

pth

···

On 7/11/06, Just Another Victim of the Ambient Morality <ihatespam@rogers.com> wrote:

"Just Another Victim of the Ambient Morality" <ihatespam@rogers.com> writes:

What I
need from an IDE is a debugger!

ArachnoRuby dot.

Have a nice day
Friedrich

···

--
Please remove just-for-news- to reply via e-mail.

Just Another Victim of the Ambient Morality wrote:

display evaluation results (like what IRB does)

I use the following method to do that:

<ruby>

def describe code
  # takes a string to be eval'ed and prints it along with showing the
return value
  sep = ' => '
  begin
    result = eval(code)
    puts code + sep + result.inspect
    return result
  rescue Exception => e
    puts code + sep + e.to_s
    return nil
  end
end

</ruby>

I then can issue the following to get a nice printout, and also get the
returned value of the statement. Example:

<ruby> my_array = describe "Range.new(1, 5).to_a" </ruby>

Would output "Range.new(1, 5).to_a => [1, 2, 3, 4, 5]" and also assign
my_array properly.

Just Another Victim of the Ambient Morality wrote:

    Can anyone recommend a good IDE?

Check out xmp for vim for code evaluation and annotation:
http://eigenclass.org/hiki.rb?Enhanced+xmp+code+evaluation+and+annotation

And the breakpoint library (ask Google where it is).

    Can anyone recommend a good... I don't know the proper term for this
but... a GUI toolkit?

If you've used TK with Perl, you can use your existing TK knowledge
with Ruby, too.

Cheers,
Dave

John wrote:

def describe code
  # takes a string to be eval'ed and prints it along

> # with showing the return value

  sep = ' => '
  begin
    result = eval(code)
    puts code + sep + result.inspect
    return result
  rescue Exception => e
    puts code + sep + e.to_s
    return nil
  end
end

Hi John,

You can write than method even more terse:

   def describe code
     sep = ' => '
     result = eval(code)
     puts code + sep + result.inspect
     return result
   rescue Exception => e
     puts code + sep + e.to_s
     # puts already returns nil
   end

Cheers,
Daniel

For those of you that use TextMate, this is now bundled with the editor as the Execute and Update ‘# =>’ Markers command in the Ruby bundle menu.

James Edward Gray II

···

On Jul 11, 2006, at 9:20 PM, dave.burt@gmail.com wrote:

Just Another Victim of the Ambient Morality wrote:

    Can anyone recommend a good IDE?

Check out xmp for vim for code evaluation and annotation:
http://eigenclass.org/hiki.rb?Enhanced+xmp+code+evaluation+and+annotation

Daniel Schierbeck wrote:

John wrote:

def describe code
  # takes a string to be eval'ed and prints it along

> # with showing the return value

  sep = ' => '
  begin
    result = eval(code)
    puts code + sep + result.inspect
    return result
  rescue Exception => e
    puts code + sep + e.to_s
    return nil
  end
end

Hi John,

You can write than method even more terse:

  def describe code
    sep = ' => '
    result = eval(code)
    puts code + sep + result.inspect
    return result
  rescue Exception => e
    puts code + sep + e.to_s
    # puts already returns nil
  end

or perhaps even

   def describe code
     out = eval(code).inspect
   rescue Exception => e
     out = e.to_s; nil
   ensure
     puts code + " => " + out
   end

Cheers,
Daniel

def describe code
   require 'xmp'
   xmp code
end

I cheated though

···

On Jul 11, 2006, at 2:45 PM, Daniel Schierbeck wrote:

Daniel Schierbeck wrote:

John wrote:

def describe code
  # takes a string to be eval'ed and prints it along

> # with showing the return value

  sep = ' => '
  begin
    result = eval(code)
    puts code + sep + result.inspect
    return result
  rescue Exception => e
    puts code + sep + e.to_s
    return nil
  end
end

Hi John,
You can write than method even more terse:
  def describe code
    sep = ' => '
    result = eval(code)
    puts code + sep + result.inspect
    return result
  rescue Exception => e
    puts code + sep + e.to_s
    # puts already returns nil
  end

or perhaps even

  def describe code
    out = eval(code).inspect
  rescue Exception => e
    out = e.to_s; nil
  ensure
    puts code + " => " + out
  end

Cheers,
Daniel