Without feature and multiple groups

85 views
Skip to first unread message

Pasha

unread,
Sep 4, 2010, 10:21:22 AM9/4/10
to ruby-bundler
Hello,

Here is a part of my Gemfile:

group :production do
gem 'memcache-client'
end

group :production, :heroku do
gem 'pg'
gem 'hassle', :git => 'git://github.com/koppen/hassle.git'
gem 'memcached-northscale', :require => 'memcached'
end

When i run "bundle install --without heroku" it just installs all gems
ignoring without feature.
But if i run "bundle install --without heroku production", gems in
heroku and production group will be skipped. But i just don't want
install heroku gems and still be able run production on my local
machine.

So the question is: is this a feature or a bug? If it's a feature -
where is the sense?

Thanks for advance.

Pasha

unread,
Sep 4, 2010, 10:22:12 AM9/4/10
to ruby-bundler
If i will change my Gemfile to this:

group :production do
gem 'memcache-client'
end

group :heroku do
gem 'pg'
gem 'hassle', :git => 'git://github.com/koppen/hassle.git'
gem 'memcached-northscale', :require => 'memcached'
end

This case heroku group will be not included on heroku server.

Andre Arko

unread,
Sep 4, 2010, 3:45:58 PM9/4/10
to ruby-b...@googlegroups.com
On Sep 4, 2010, at 7:22 AM, Pasha wrote:
> This case heroku group will be not included on heroku server.

Yep, that's how it works. If you put a gem in two groups (production AND heroku) and you only skip one of them (heroku), you will still get every gem that is in production. Naturally.

— Andre

Pasha

unread,
Sep 4, 2010, 11:45:50 PM9/4/10
to ruby-bundler
Yep! But now it's not working this way!

If i put a gem in two groups (production AND heroku) and run "bundle
install --without heroku" it will install _all_ gems and just ignore
this option. But it should skip all gems which belongs to skipped
group. Isn't it? So... looks like a bug?
> -- Andre

Andre Arko

unread,
Sep 5, 2010, 1:20:20 PM9/5/10
to ruby-b...@googlegroups.com
On Sep 4, 2010, at 8:45 PM, Pasha wrote:
> If i put a gem in two groups (production AND heroku) and run "bundle
> install --without heroku" it will install _all_ gems and just ignore
> this option. But it should skip all gems which belongs to skipped
> group. Isn't it? So... looks like a bug?

No, that's not what you're doing. This puts the 'pg' gem in BOTH production and heroku groups:

group :production, :heroku do
gem 'pg'

end

If you then run `bundle install --without heroku`, it will of course install pg, because you are asking bundler to install the production group (which pg is also in).

— Andre

Pasha

unread,
Sep 5, 2010, 5:52:27 PM9/5/10
to ruby-bundler
Yep. You are right. But how this behavior can be used? Can you provide
any real situation example in which this behavior solves the problem?
> -- Andre
Reply all
Reply to author
Forward
0 new messages