[ANN] Utility Belt: nifty gem mostly for IRB

G

Giles Bowkett

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 Bowkett

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

thefed

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!
 
B

Bob Hutchison

Hi,

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
 
G

Giles Bowkett

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

Hi,



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


--
Giles Bowkett

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

Giles Bowkett

(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)

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




--
Giles Bowkett

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


--
Giles Bowkett

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

Bob Hutchison

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
 
G

Giles Bowkett

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



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.

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 Bowkett

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

Bob Hutchison

Hi,

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
 
T

Tim Connor

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/2...om-irb-a-tweak-for-giles-new-gem-utility_belt
http://www.timocracy.com/articles/2...t-tweak-2-passing-a-string-directly-to-pastie
 
T

Tim Connor

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.
 
G

Giles Bowkett

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, (e-mail address removed). 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 Bowkett

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

Tim Connor

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. :p I
did track down your email, here in fact, but then saw that you already
posted a thread, so decided not to ping you. :D
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. :D Clean away.
Please do, (e-mail address removed).
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. :D
 
G

Giles Bowkett

Anyway, I've already got too many contributions to handle them all
Yeah it was a quick hack to get it working, since I wasn't sure you
were taking contributions yet. :D Clean away.

Roger that. :)
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.
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. :D

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. :)

--
Giles Bowkett

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top