My organization has a number of in-house gems that are used in automated testing, but are not required for a production deployment. I am trying to use Bundler and so in my Gemfile I've wrapped those gems in:
group :test, :development do
gem 'dashboard_summary'
end
However, when I run:
$ bundle install --without staging development test
I still get
Could not find gem 'dashboard_summary (>= 0) ruby' in the gems available on this machine.
I'm trying to understand why Bundler isn't ignoring that gem when I've told it to.
This is expected behaviour. From the docs:
While the
--without
option will skip installing the gems in the specified groups, it will still download those gems and use them to resolve the dependencies of every gem in your Gemfile(5).
Whilst an up to date Gemfile.lock
might suggest that the dependencies don’t need to be resolved again, it looks like all gems are downloaded even in this case.
You didn't define any group that includes staging, development and test. Your group only had test and development.
Bundler is trying to ignore a group which has all three name in it, so you can add staging to
group :test, :development, :staging do
gem 'dashboard_summary'
end
or you can use
$ bundle install --without test development
I'm not sure why you have staging
in there? but this should work
bundle install --without test development
You could also set the config environment variable documented in BUNDLE_WITHOUT
in bundle config.
You could use
gem 'dashboard_summary', require: false
This would not load the gem on startup and you would have to require it when you wanted to use the gem. This may help if you need to keep dashboard_summary
in your Gemfile because of dependencies, but save the time it takes to load and not get the error you are getting now. It's at least something to try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With