[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Utility Belt: nifty gem mostly for IRB

Giles Bowkett

12/12/2007 12:29:00 AM

http://utilitybelt.ruby...

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.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

15 Answers

fedzor

12/12/2007 3:44:00 AM

0

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!


On Dec 11, 2007, at 7:29 PM, Giles Bowkett wrote:

> http://utilitybelt.ruby...
>
> 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.bl...
> Blog: http://gilesbowkett.bl...
> Portfolio: http://www.gilesg...
> Tumblelog: http://giles....
>


Jay Levitt

12/12/2007 1:30:00 PM

0

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

> http://utilitybelt.ruby...

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


--
Jay Levitt |
Boston, MA | My character doesn't like it when they
Faster: jay at jay dot fm | cry or shout or hit.
http://... | - Kristoffer

Bob Hutchison

12/12/2007 2:26:00 PM

0

Hi,

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

> http://utilitybelt.ruby...
>
> 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 Hutchison -- tumblelog at http://www.recurs...
Recursive Design Inc. -- weblog at http://www.recursiv...
http://www.rec... -- works on http://www.raconteur.info/cms-for-static-con...



Giles Bowkett

12/12/2007 3:55:00 PM

0

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 Hutchison <hutch@recursive.ca> wrote:
> Hi,
>
> On 11-Dec-07, at 7:29 PM, Giles Bowkett wrote:
>
> > http://utilitybelt.ruby...
> >
> > 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 Hutchison -- tumblelog at http://www.recurs...
> Recursive Design Inc. -- weblog at http://www.recursiv...
> http://www.rec... -- works on http://www.raconteur.info/cms-for-static-con...
>
>
>
>


--
Giles Bowkett

Podcast: http://hollywoodgrit.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

Giles Bowkett

12/12/2007 3:58:00 PM

0

(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 Bowkett <gilesb@gmail.com> wrote:
> 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 Hutchison <hutch@recursive.ca> wrote:
> > Hi,
> >
> > On 11-Dec-07, at 7:29 PM, Giles Bowkett wrote:
> >
> > > http://utilitybelt.ruby...
> > >
> > > 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 Hutchison -- tumblelog at http://www.recurs...
> > Recursive Design Inc. -- weblog at http://www.recursiv...
> > http://www.rec... -- works on http://www.raconteur.info/cms-for-static-con...
> >
> >
> >
> >
>
>
> --
> Giles Bowkett
>
> Podcast: http://hollywoodgrit.bl...
> Blog: http://gilesbowkett.bl...
> Portfolio: http://www.gilesg...
> Tumblelog: http://giles....
>


--
Giles Bowkett

Podcast: http://hollywoodgrit.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

Bob Hutchison

12/12/2007 4:10:00 PM

0

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 Hutchison -- tumblelog at http://www.recurs...
Recursive Design Inc. -- weblog at http://www.recursiv...
http://www.rec... -- works on http://www.raconteur.info/cms-for-static-con...




Giles Bowkett

12/12/2007 6:03:00 PM

0

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

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.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

Bob Hutchison

12/12/2007 6:55:00 PM

0

Hi,

On 12-Dec-07, at 1:03 PM, Giles Bowkett 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 Hutchison -- tumblelog at http://www.recurs...
Recursive Design Inc. -- weblog at http://www.recursiv...
http://www.rec... -- works on http://www.raconteur.info/cms-for-static-con...




Tim Connor

12/12/2007 7:54:00 PM

0

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-ut...
http://www.timocracy.com/articles/2007/12/11/utility_belt-tweak-2-passing-a-string-directly...

Tim Connor

12/12/2007 7:56:00 PM

0

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.