Utility Belt: nifty gem mostly for IRB

http://utilitybelt.rubyforge.org/

Features!

*  Interactively edit IRB code in your preferred text editor
* Read from and write to OS X clipboard
* Post your code to Pastie with one command (OS X only)
* Kick-ass Unix-style history buffer
* Write command history to file or vi
* Grep classes and methods for strings
* Verbosity controls for regular IRB and Rails console
* Finder shortcuts for Rails console
* Upload shortcut for Amazon S3
* Command-line Amazon S3 upload script
* Command-line Google shortcut (OS X only)
* Auto-indentation
* _ special variable (like Unix shell var !!)
* Extremely basic themes for Wirble syntax coloring
* Pascal/JavaScript-style "with" statement
* String#to_proc
* Grammatically-correct is_an? method - no more "is_a? Array" 

statements
* One-character exit command

Go go gadget gem!

gem install utility_belt


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

On Tue, 11 Dec 2007 19:29:25 -0500, Giles B. wrote:

http://utilitybelt.rubyforge.org/

Wow… what a great looking gem. Nice work!!

Majorly Impressed! I have no clue what I am going to use this for,
but am using it right now.

It’s like Ruby - everyone thinks python is good enough and then they
try Ruby.

Now nothing is good enough!

Hi,

On 11-Dec-07, at 7:29 PM, Giles B. wrote:

http://utilitybelt.rubyforge.org/

Features!

  • Grep classes and methods for strings

Very nice!

A small problem with the grep_classes(“num”) functionality: the method
blank? isn’t defined on Strings in my default setup, and so an
exception is thrown. I added this to the top of the language_greps.rb
file

class String
def blank?
instance_method(:blank?) rescue def blank?
self !~ /\S/
end
end
end

Cheers,
Bob


Bob H. – tumblelog at
http://www.recursive.ca/so/
Recursive Design Inc. – weblog at
http://www.recursive.ca/hutch
http://www.recursive.ca/ – works on
http://www.raconteur.info/cms-for-static-content/home/

Yow! Thanks for the props everyone and thanks especially for the fix
Bob. I must have been using ActiveSupport or something there.

On 12/12/07, Bob H. [email protected] wrote:

Very nice!
end


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

Hi,

There’s a little nonsense going on in the fix I provided… I posted
an experiment I think.

class String
def blank?
instance_method(:blank?) rescue def blank?
self !~ /\S/
end
end
end

class String
instance_method(:blank?) rescue def blank?
self !~ /\S/
end
end

Is what I’m actually using.

There are other ways to do it, as you point out in another posting.

Sorry about that,
Bob


Bob H. – tumblelog at
http://www.recursive.ca/so/
Recursive Design Inc. – weblog at
http://www.recursive.ca/hutch
http://www.recursive.ca/ – works on
http://www.raconteur.info/cms-for-static-content/home/

(Although actually I’m going to modify the fix - depending on a rescue
to define a method isn’t really the way to do it. It’s going to look
more like:

def blank?
xyz
end unless method_defined? :blank)

On 12/12/07, Giles B. [email protected] wrote:

Features!
class String


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

Awesome work Giles. I kept meaning to get around to some of those
myself, after watching somebody type “mate” in their irb and making me
jealous. Now I don’t have to maintain a complicated .irbc across
machines, I can just install utility_belt.

I made a couple tweaks on my local copy, if you are interested.
Letting the editor commands accept a string has two really nice use-
cases: dumping the results of "" when you get spammed by output, and
passing in a method_binding.to_ruby if you are using ruby2ruby (lets
you edit and thus redefine said method). Both cases (
and #to_ruby)
apply to pastie too:

http://www.timocracy.com/articles/2007/12/11/textmateing-a-string-from-irb-a-tweak-for-giles-new-gem-utility_belt
http://www.timocracy.com/articles/2007/12/11/utility_belt-tweak-2-passing-a-string-directly-to-pastie

My crappy fcgi’ed Typo install is slow sometimes. If it dies let me
know and I can just send you a patch, or submit it here, or elsewhere
if you want to open up the rubyforge ticketing or something.

Hi,

On 12-Dec-07, at 1:03 PM, Giles B. wrote:

some kind of Utility Belt forum or mailing list will exist soon, btw.

I’ll join up.

Utility Belt is really working out well. I really like the vi
integration.

Cheers,
Bob


Bob H. – tumblelog at
http://www.recursive.ca/so/
Recursive Design Inc. – weblog at
http://www.recursive.ca/hutch
http://www.recursive.ca/ – works on
http://www.raconteur.info/cms-for-static-content/home/

end
There are other ways to do it, as you point out in another posting.
No problem, I found that, I ended up doing it like this:

  2 class String
  3   unless public_method_defined? :blank?
  4     def blank?
  5       self !~ /\S/
  6     end
  7   end
  8 end

(obviously the line numbers aren’t really in there, it’s just a paste
from vi)

some kind of Utility Belt forum or mailing list will exist soon, btw.


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

On Dec 12, 5:48 pm, Giles B. [email protected] wrote:

That’s right god damn it. I lurk up here in my castle dining on the
flesh of infants and cavorting with my harem of she-demons, and to
hell with anyone too weak to cross the moat or survive a battle with
the deep crow in Power Dome A.
This is what happens when you twiddle the comments_enabled? bit every
other month and kvetch about both that and turning email off. :stuck_out_tongue: I
did track down your email, here in fact, but then saw that you already
posted a thread, so decided not to ping you. :smiley:

Anyway, I’ve already got too many contributions to handle them all
tonight, so I obviously have to set up some kind of community organizy
thing, and I will, but meantime, you should realize, I actually
mention needing this feature in the documentation, somewhere. I think.
Point is it’s definitely useful and I will merge it in real
soonish-like. I’ll change it slightly though because the original code
passes around edit’s args too much so that needs to be tidied up
somewhere.

Yeah it was a quick hack to get it working, since I wasn’t sure you
were taking contributions yet. :smiley: Clean away.

My crappy fcgi’ed Typo install is slow sometimes. If it dies let me
know and I can just send you a patch, or submit it here, or elsewhere
if you want to open up the rubyforge ticketing or something.

Please do, [email protected]
I’ll shoot it over tomorrow - it’s on my work machine. In patch
format, I assume? Or you just want the files?

I’ll look at the ticketing. I initially
closed down everything on RF because it all looked so noisy and messy,
but I’ve been unable to restore forums, so I’ll probably have to set
up Lighthouse or something. I don’t know yet.

Yeah, most of the *Forges are visual and cognitive overload for me,
personally. That’s a large part of why I’ve used google code for one-
offs. A Lighthouse gets my +1 though. :smiley:

were taking contributions yet. :smiley: Clean away.
Roger that. :slight_smile:

My crappy fcgi’ed Typo install is slow sometimes. If it dies let me
know and I can just send you a patch, or submit it here, or elsewhere
if you want to open up the rubyforge ticketing or something.

Please do, [email protected]
I’ll shoot it over tomorrow - it’s on my work machine. In patch
format, I assume? Or you just want the files?

Patch/diff is best, anything I can read is cool though.

I’ll look at the ticketing. I initially
closed down everything on RF because it all looked so noisy and messy,
but I’ve been unable to restore forums, so I’ll probably have to set
up Lighthouse or something. I don’t know yet.

Yeah, most of the *Forges are visual and cognitive overload for me,
personally. That’s a large part of why I’ve used google code for one-
offs. A Lighthouse gets my +1 though. :smiley:

Google Code, that’s worth a look. Not for this project, it’s what gems
were made for, but I have another thing which fits that whole one-off
profile pretty nicely.

RubyForge is all about the old-school flavor. :slight_smile:


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

From the blog:

Giles isn’t known for making himself easy to get a hold of

That’s right god damn it. I lurk up here in my castle dining on the
flesh of infants and cavorting with my harem of she-demons, and to
hell with anyone too weak to cross the moat or survive a battle with
the deep crow in Power Dome A.

Anyway, I’ve already got too many contributions to handle them all
tonight, so I obviously have to set up some kind of community organizy
thing, and I will, but meantime, you should realize, I actually
mention needing this feature in the documentation, somewhere. I think.
Point is it’s definitely useful and I will merge it in real
soonish-like. I’ll change it slightly though because the original code
passes around edit’s args too much so that needs to be tidied up
somewhere.

My crappy fcgi’ed Typo install is slow sometimes. If it dies let me
know and I can just send you a patch, or submit it here, or elsewhere
if you want to open up the rubyforge ticketing or something.

Please do, [email protected] I’ll look at the ticketing. I initially
closed down everything on RF because it all looked so noisy and messy,
but I’ve been unable to restore forums, so I’ll probably have to set
up Lighthouse or something. I don’t know yet.


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

For those reading this later, Giles created a mailing list at:
http://rubyforge.org/mailman/listinfo/utilitybelt-tinkering

On 12/13/07, Tim C. [email protected] wrote:

For those reading this later, Giles created a mailing list at:
http://rubyforge.org/mailman/listinfo/utilitybelt-tinkering

Yes! I did. Thank you!


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs