From: Josh Cheek Date: 2013-04-05T20:49:31+09:00 Subject: Re: Role of bundler in creating and installing a gem --047d7b3432fafe569604d99badcd Content-Type: text/plain; charset=ISO-8859-1 On Fri, Apr 5, 2013 at 6:39 AM, Jon Cairns wrote: > Hi fellow rubyists, > > I have a question about the role of bundler when creating a gem. I'm > familiar with bundler and the way that it handles dependencies in a > rails app, but I've run into a few snags with using it to manage > dependencies for gems that I've created. > > In a gemspec you can use `add_dependency` to include other gems as a > dependency for your gem. Random example: > > Gem::Specification.new do |gem| > #... > gem.add_dependency 'json' > end > > That means that installing my gem will also install json (if it doesn't > exist). > > $ gem install mygem > Successfully installed json-x.x.x > Successfully installed mygem-x.x.x > > However, creating a gem with `bundle new` seems to want you to specify > dependencies in the Gemfile. So, if I do that: > > I'm pretty sure `bundle new` isn't a thing. If it is for you, then maybe you have an older version. On mine, I would do `bundle gem mygem` and when I cat mygem/Gemfile it says source 'https://rubygems.org' # Specify your gem's dependencies in mygem.gemspec gemspec The gemspec is what tells it to look in mygem.gemspec for the dependencies list. -Josh --047d7b3432fafe569604d99badcd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Fri, Apr 5, 2013 at 6:39 AM, Jon Cairns <lists@ruby= -forum.com> wrote:
Hi fellow rubyists,

I have a question about the role of bundler when creating a gem. I'm familiar with bundler and the way that it handles dependencies in a
rails app, but I've run into a few snags with using it to manage
dependencies for gems that I've created.

In a gemspec you can use `add_dependency` to include other gems as a
dependency for your gem. Random example:

=A0 Gem::Specification.new do |gem|
=A0 =A0 #...
=A0 =A0 gem.add_dependency 'json'
=A0 end

That means that installing my gem will also install json (if it doesn't=
exist).

=A0 $ gem install mygem
=A0 Successfully installed json-x.x.x
=A0 Successfully installed mygem-x.x.x

However, creating a gem with `bundle new` seems to want you to specify
dependencies in the Gemfile. So, if I do that:


I'm pretty sure `bundle new`= isn't a thing. If it is for you, then maybe you have an older version.=

On mine, I would do `bundle gem mygem= ` and when I cat mygem/Gemfile it says

# Specify your gem's dep= endencies in mygem.gemspec
gemspec


The gemspec is what tells it to look in mygem.gemspec = for the dependencies list.

-Josh
=

--047d7b3432fafe569604d99badcd--