Patrick Gundlach wrote:
I'd like to ask you for your recommendations. I
develop (privately) a set of libraries which are used in several
projects. Some of these I also want to share with others (i.e.
distribute). When developing I use a directory structure such as
lib/ <--- libraries here
test/ <--- tests
Now, when using the library from another project I either need to
1) put the above lib directory in $:, the search path
2) copy the needed libs to the project
3) install the library in a system wide/private directory structure
and set the environment variable RUBYLIB.
Of course I would always like to use the newest version of a lib.
What do you guys recommend? Symlinks?
Depends on your needs. But #1 and #3 aren't portable. #2 is the right
choice hwne you don;t want to have you lib dependent on the
installation of another lib. In those cases I put the code in:
lib/vendor/, although I've seen other use lib/support/.
The 4th option, which is the typical general approach --the one for whn
it's okay to have an external dependency, is to install the library to
the a standard location. The $LOAD_PATH is already set to search these
locations depending on you Ruby installation. For instance, on Debian
the location is /usr/local/lib/site_ruby/1.8/. But really you don't
have to worry about that yourself if you just use an install script,
most noteably setup.rb (http://i.loveruby.net/en/projects/setup/), or
use the ruby-specific package manager, RubyGems.