Deprecating dependency declarations in gemspec

12 views
Skip to first unread message

opsb

unread,
Nov 10, 2010, 12:58:48 PM11/10/10
to ruby-bundler
Bundler is a massive step forward in getting everyone to declare their
dependencies consistently across projects. Gemspecs seem to be the
only place where you can't use bundler now. Are there any plans to
deprecate the existing dependency mechanism and use bundler instead?

Andre Arko

unread,
Nov 10, 2010, 8:40:17 PM11/10/10
to ruby-b...@googlegroups.com

I think you have it backwards. Bundler only works because every library has a gemspec. Bundler (and Gemfiles) are for _applications_ to declare their dependencies. Gemspecs are for _libraries_ to declare their dependencies.

Since Bundler is built on top of gemspecs, it is not possible to deprecate gemspecs and continue using Bundler.

— Andre

Alex Chaffee

unread,
Nov 14, 2010, 8:20:27 PM11/14/10
to ruby-b...@googlegroups.com

I think he meant something like, "When can we, as library developers,
use the nice, clean Gemfile format, with all its varied options, to
declare gem dependencies, instead of the clunky old gemspec format
which just allows two lists of gem dependencies and is redundant with
the Gemfile?"

And the answer to that is, you can't, but you can go the other
direction: there's a "gemspec" directive that you can put inside your
Gemfile that sucks in dependencies from the .gemspec file and puts
them in the :default and :development groups.

http://gembundler.com/man/gemfile.5.html#GEMSPEC-gemspec-

I agree with the OP that it would be nice if we could go the other
direction, and just use the Gemfile to declare all dependencies,
possibly with a command that would build or rebuild a .gemspec file
based on the Gemfile's default and development groups. I might even be
tempted to build that command if enough people think it's a good idea.

--
Alex Chaffee - al...@stinky.com - http://alexch.github.com
Stalk me: http://friendfeed.com/alexch | http://twitter.com/alexch |
http://alexch.tumblr.com

opsb

unread,
Nov 15, 2010, 7:34:12 AM11/15/10
to ruby-bundler
When I first saw the gemspec command in a Gemfile it struck me as
being the wrong way round. I thought, if bundler is supposed to be
responsible for dependencies shouldn't the gemspec have a command
'Gemfile' which imports the dependencies from the associated Gemfile.
Now we have the slightly awkward arrangment where you must use 2
different mechanisms for your library, development and test
dependencies.

Really what I was getting at was, why not change the gem install
command so that it can resolve dependencies from Gemfiles inside gems.
Both the Gemfile and gemspec dependencies could be supported. Looking
at it from another point of view, what's the advantage of Gemspecs
have their own dependency mechanism?
> Alex Chaffee - a...@stinky.com -http://alexch.github.com
Reply all
Reply to author
Forward
0 new messages