Is the order in which you list your gems important? Are these two blocks equivalent?
gem 'carrierwave' gem 'rmagick'
And
gem 'rmagick' gem 'carrierwave'
Ordering in the Gemfile does not matter as far as I know.
The Gem Development guide says that the Gemfile. lock file "should always be checked into version control." However, this is NOT true for Gems. For Applications, like your Rails apps, Sinatra apps, etc., it is true. The same does not go for Gems.
The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile. lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.
A Gemfile is a file we create which is used for describing gem dependencies for Ruby programs. A gem is a collection of Ruby code that we can extract into a “collection” which we can call later. It lets you specify which gems you want to use, and which versions of these gems to use.
When you use Bundle.require
(which Rails does), Gems are required in the order they appear in the Gemfile. In wasn’t always like this, but has been this way for a while.
Since Carrierwave requires RMagick explicitly when it is needed, I don’t think it should matter in your case; but strictly speaking the two blocks are not equivalent.
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