Best practice adding a version for each gem in a gemfile?

Should I add a version for each gem to my gemfile? Is this the best practice? Just recommended?

+5
source share
3 answers

I prefer that all my gems be tied to a specific version in production. Given that there may be newer versions that violate compatibility with other gems or devalue some APIs, you want to be 100% sure that you will not receive an unexpectedly broken application when deploying due to gemstone inconsistencies. Gems should only be updated locally during the development process, updating Gemfile entries and checking each new version for the rest of the code and libraries.

+5
source

, , , ( , - ). , :

# Bundle edge Rails instead:
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'arel',  :git => 'git://github.com/rails/arel.git'
gem "rack", :git => "git://github.com/rack/rack.git"
+2

I do not think that you should indicate the version of each gem, since the versions of the current working stones are already indicated in Gemfile.lock.

Also, if you do this, the team bundle updatewill be useless. You must use this command to update gems. if the tests pass and your application continues to work correctly, just submit a new oneGemfile.lock

+1
source

All Articles