On Thu, 22 Sep 2005, Damphyr wrote:

> Well I assume you do that for yourself locally. What do you do when
> distributing something that uses alib?  When having application A and
> application B use alib do you distribute one copy of the alib files with
> each app or do you require someone to install alib?  I am reluctant to
> require installation of a "private" library be it tar or gem. I prefer using
> a rakefile to grab the appropriate files and bundle them together with the
> app (which adds a reusable rake task definition to the lib :) ).  So my box
> has the library installed complete with versioning and the app gets a copy
> to be used from '.'.  One major drawback of this approach is when drastic
> changes in the "private" library break the applications - releasing bugfixes
> for the app requires updating to the current version of the lib.  You use
> versioning in the library, for the moment I use my source control system to
> keep the versions aligned.  I guess what I am formulating is the desire to
> handle my snippets like a separate project internally, but distribute them
> as integral pieces of each application.

all issues i've considered.  some observations:

   - making a library for public consumption generally makes you think harder
     and make better choices regarding backward compatibility.  this is a good
     thing.

   - inlining a lib everywhere violate dry is such a massive way it's not
     funny.  i used to do this and then ended up with 17 micro versions that
     all needed fixing when a serious bug was found.  this is bad.  evil in
     fact.

there's no good answer i guess.  the former (maintaining a library) just seems
less bad.  i often walk the middle and include a copy of my lib in a depends/
subdir of a release, that way at least it's easy to find.  another approach i
sometimes take is

   begin
     require LIBDIR + 'alib-0.0.0'
   rescue LoadError
     begin
       require 'alib-0.0.0'
     rescue LoadError
       require 'alib'
     end
   end

so, try the local lib, installed lib of the correct version. then whatever
you'll give me.

i guess there is no perfect answer.

cheers.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze.  --Nagarjuna
===============================================================================