A gem plugin to warn you when you accidentally install files with names that collide accidentally
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION

README.rdoc

gem_file_conflict_checker

This is a rubygems plugin that warns warn you when you accidentally install gems that have filenames that collide and hence are unstable.

Background:

Currently with rubygems (1.3.5), if you install two gems that have same-named files, like

gem1/lib/a.rb

gem2/lib/a.rb

Then do a

require 'rubygems' require 'a'

There is no guarantee of which a it is going to load.

This can cause some really bizarre errors when, for example, in the middle of requiring gem1 gem, that gem does a

require 'a'

which ends up requiring a *from a totally different, unexpected, other gem*, like gem2.

This can lead to unrelated looking errors, like

'undefined method `sexp_type' for class `Sexp' (NameError)'

or 'undefined constants Sane::OS'

which really aren't helpful to deciphering the root cause (that you have conflicting gems installed).

What this gem does

This gem creates a rubygems post_install hook that sanity checks your gems, looking for any files that could possibly conflict. If there is a conflict, it outputs a warning message to the screen about it.

ex:

E:>gem install require_all warning: gem_conflict_plugin: conflicts detected! (they may be expected) your rubygems have one or more gems with conflicting lib/* filenames…

"require_all" was found redundantly in the libs of these gems: rdp-require_all (lib/require_all.rb), require_all (lib/require_all.rb)

In this example two gems were installed with conflicting (competing) filenames–require_all.rb was found in rdp-require_all and require_all.

The post install hook warned me of the problem, and I promptly uninstalled the one I didn't want so that there would be no confusion.

Usage/Installation

$ gem install gem_file_conflict_checker $ gem install gem_file_conflict_checker # install it twice so that it will run its post install hooks and warn you of any conflicts. Any gem install after this point will also warn you.

This is especially useful for those of us who are using various versions of gems and forking them and installing our own versions, etc., to sanity check which gems are installed. It is hoped that a future version of rubygems will alleviate this problem, and patches have been proposed [1].

Enjoy.

-r

Feedback welcome: github.com/rdp/gem_file_conflict_checker

refs:

1

rubyforge.org/tracker/index.php?func=detail&aid=27318&group_id=126&atid=578

www.ruby-forum.com/topic/190217