I’m using SQLite on my dev box and MySQL in production. I’m also
running an old mysql adapter gem in production that worked around
problems with the MySQL adapter and Ruby 1.9.1. That gem was hosted on
github and hasn’t been moved anywhere, so it’s only available locally
on my production machine.
No problem, I think, I’ll just set up my Gemfile with:
group :production do
gem “hectoregm-mysql-ruby”, “2.8.1”
Works fine in production, but back in development, I get this error:
resolver.rb:163:in `resolve’: Could not find gem ‘hectoregm-mysql-ruby
(>= 0, runtime)’ in any of the sources. (Bundler::GemNotFound)
Doesn’t shock me that Bundler can’t find this gem, but why is it
looking for it? I’m in development.
I realize there are a dozen ways to work around this, but I’m more
interested in understanding what specifying an environment in Bundler
does. My first guess was that it should, say, specify which gems are
required in which environment, which would mean the absence of a gem
required only in production would not throw an exception when you try
to launch your app in development. But now it looks like I’m wrong. Or
am I just doing something wrong?