[holy ruby programmers batman!] Adding a configuration file to Utility Belt
avdi at avdi.org
Sun Dec 23 13:18:18 EST 2007
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.
> .) Right now, Utility Belt requires everything in utility_belt.rb,
> including libraries that are only needed for certain parts of Utility
> Belt (e.g. the platform gem is only used in Mac Clipboard, Amazon
> Upload Shortcut and Pastie). I think it would be better if each part
> requires all the files it needs, and utility_belt.rb only requires the
> parts themselves (plus rubygems + wirble, of course).
> 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
More information about the Utilitybelt-tinkering