dan-klasson dan-klasson - 1 year ago 62
Ruby Question

Bundler ignoring 'without' group

I'm trying to include gems from my local instead of the gemserver on development. My Gemfile looks like this:

group :development do
gem "appy_core", path: "../engines/core"

group :production do
gem "appy_core", ''

is set to:

BUNDLE_WITHOUT: production

Yet when I run
I get:

[!] There was an error parsing `Gemfile`: You cannot specify the same gem twice with different version requirements.
You specified: appy_core (>= 0) and appy_core (= Bundler cannot continue.

bundle install --without production
produces the same result.

Answer Source

The only solution I came up with / am aware of:

in Gemfile:

gem 'appy_core', 
    git: 'git://github.com/.......',
    branch: '' # put the name of the branch that corresponds

in local environment’s shell:

$ bundle config local.appy_core /path/to/engines/core

Now do whatever you want in the local branch, commit it locally and enjoy.

Hack that works

Since Gemfile is plain ruby, one might use ruby features there:

somewhere in permanent shell settings:

alias bundle="USE_DEV_VERSION=1 bundle"

in Gemfile:

  gem "appy_core", path: "../engines/core"
  gem "appy_core", ''

Now bundle install will use dev version locally and the standard gem outside of the “patched” environment.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download