Gemfile and gemspecs

521 views
Skip to first unread message

jnicklas

unread,
Nov 5, 2010, 6:45:04 AM11/5/10
to ruby-bundler
Hi Bundlerites,

in my gem development activities, I sometimes need to depend on the
"edge" version of a gem in development, just so I can add new features
in a dependency and have them work in the main gem right away.
Basically I want this:

gemspec:

s.add_runtime_dependency("xpath", ["~> 0.1.2"])

Gemfile:

gem 'xpath', '~> 0.1.2', :git => 'git://github.com/jnicklas/
xpath.git'
gemspec

However, this results in the following error:

You cannot specify the same gem twice coming from different
sources. You specified that xpath (~> 0.1.2) should come from
git://github.com/jnicklas/xpath.git (at master) and ~/Projects/
capybara

That's pretty annoying. Would it be possible to allow dependencies
from the Gemfile to override dependencies from the gemspec? That would
be totally awesome. Currrently, there's no really defined workflow, so
we have to rely on stupid hacks like commenting out stuff from the
gemspec until we're ready to release, which we could potentially miss,
so it's less than ideal.

/Jonas

Yehuda Katz

unread,
Nov 5, 2010, 11:38:41 AM11/5/10
to ruby-bundler
The reason that this happens is purely to protect people from themselves (people were misguidedly putting different versions of the same gem in different groups, misunderstanding the purpose of groups).

However, I have definitely encountered the issue you're talking about, and would definitely be in favor of allowing gems from #gemspec to be overridden by gems in the Gemfile without throwing the error. Keep in mind, though, that you need to make sure that your released version of the gem happens after the edge dependency has ben released as well.

The way #gemspec works is simple... maybe the DSL could remember which gems came from the #gemspec and allow them to be overridden (but only once?). Interested in working on a patch?

Yehuda Katz
Architect | Strobe
(ph) 718.877.1325



--
You received this message because you are subscribed to the Google Groups "ruby-bundler" group.
To post to this group, send email to ruby-b...@googlegroups.com.
To unsubscribe from this group, send email to ruby-bundler...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruby-bundler?hl=en.


Jonas Nicklas

unread,
Nov 5, 2010, 1:26:19 PM11/5/10
to ruby-b...@googlegroups.com
I know nothing of how bundler works, so if any of you guys want to
provide a patch, then I'd appreciate it a lot, if not then I'll dig
into the source and see if I can come up with something.

/Jonas

Reply all
Reply to author
Forward
0 new messages