[holy ruby programmers batman!] Adding a configuration file to Utility Belt

Markus Prinz markus.prinz at qsig.org
Sun Dec 23 13:54:10 EST 2007

On 23.12.2007, at 19:18, Avdi Grimm wrote:

> On Dec 23, 2007 1:04 PM, Markus Prinz <markus.prinz at qsig.org> wrote:
>> I've been working on adding support for a ~/.utility_belt-file, which
>> should allow you to ignore (that is, not 'require') certain parts of
>> Utility Belt. Right now the implementation for that is very, very
>> crude (I wouldn't recommend including it into Utility Belt just yet,
>> and there are no specs for it anyway).
> Personally I'm not sure I'd want another config file apart from my
> .irbrc.  I think I'd be happy with a little more modularization
> (including some of the changes you mention below), leading to the
> ability to include either some or all of the functionality by varying
> what is required in .irbrc.  That and maybe a well-defined protocol
> for setting configuration options within .irbrc.

Hm, this gives me an idea: Given an .irbrc that looks like this:

require 'utility_belt'
UtilityBelt.equip(:all, :except =>  
[:amazon_upload_shortcut, :hash_math])

We could use irb's IRB.conf[:IRB_RC] facility to then check wether a  
configuration has been set, and act accordingly.

I'll try implementing that and report back.

>> Also, does anyone have an idea on how one might spec this? The only
>> thing I came up with is to spoof ENV['HOME'] to a temp directory, and
>> create a .utility_belt there.
> My usual method for speccing something like this is to write the
> configuration engine so that it accepts configuration in the form of
> strings.  Then do all of the specs using strings.  Finally, write a
> very thin loader (shouldn't require more than 1-3 lines of code) and
> either spec it by stubbing out File/Kernel calls or just test it
> manually.

Good idea. I'll try that.

regards, Markus

More information about the Utilitybelt-tinkering mailing list