bundler icon indicating copy to clipboard operation
bundler copied to clipboard

Be able to alias a gem as a different gem.

Open byu opened this issue 15 years ago • 5 comments

To solve this problem:

json, json_pure and yajl-ruby all get downloaded and required through the resolution process.

I would like to specify that I'd like to use yajl while excluding json and json_pure.

byu avatar Nov 06 '09 20:11 byu

Can you post your Gemfile?

wycats avatar Nov 06 '09 20:11 wycats

The Gemfile and the output of a gem bundle http://gist.github.com/228322

More details about the env: Mac OS X 10.5 homebrew installed: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin9.8.0] gem 1.3.5

gem list in rubygems (went for almost bare rubygems system to focus on bundler): *** LOCAL GEMS ***

actionmailer (2.3.4) actionpack (2.3.4) activerecord (2.3.4) activeresource (2.3.4) activesupport (2.3.4) bundler (0.7.0) rack (1.0.1) rails (2.3.4) rake (0.8.7) rubygems-update (1.3.5)

Thanks

byu avatar Nov 06 '09 21:11 byu

The problem is that json and json_pure are actual dependencies of something. Ignoring them seems dangerous no?

wycats avatar Nov 06 '09 23:11 wycats

For this specific case, yajl-ruby has a JSON gem Compatibility API: require 'yajl/json_gem' (my posted Gemfile has mistakenly required :lib => 'yajl' instead). http://github.com/brianmario/yajl-ruby

And in general, I would conjecture that libraries would not notice a difference amongst differing implementations if they conform to an api. I would confirm this with series of unittests from the implementation library all the way up the stack (including the depending libraries) to my main application. To accomplish this, I'd like the power to swap implementation libraries in an out. :)

Thanks

byu avatar Nov 06 '09 23:11 byu

I've run into this where I wanted to use a specific version of sinatra, and one of the gems I depend on (cehoffman-sinatra-respond_to) depends on sinatra-sinatra, which gets required, and ends up being the wrong version.

I end up having to run a post-process to delete sinatra-sinatra to make the correct version of sinatra load.

eric avatar Nov 09 '09 20:11 eric