The role of the Gemfile.lock file in the Rails framework

3715 단어 BundleRailsgemfile
The power of Rails is reflected everywhere in its framework. Gemfile.lock is used to record the dependent Gem package in Application, and record the version of the dependent Gem package in detail. When the application environment changes, we can use Bundle update to update the relevant dependencies, or keep the Gemfile.lock unchanged.
When we want the referenced packages in the Application to remain the same, just keep Gemfile.lock unchanged. This way, even when we migrate the Application to another environment, we can keep the code and its functionality consistent. And when we develop C++ or Java applications, it is not so convenient, especially package references seem to be out of control.
The following is an excerpt of the English description of Gemfile.lock:

  
  
  
  
  1. THE GEMFILE.LOCK 
  2.  
  3. When you run bundle install, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called Gemfile.lock. 
  4.  
  5. Bundler uses this file in all subsequent calls to bundle install, which guarantees that you always use the same exact code, even as your application moves across machines. 
  6.  
  7. Because of the way dependency resolution works, even a seemingly small change (for instance, an update to a point-release of a dependency of a gem in your Gemfile(5)) can result in radically different gems being needed to satisfy all dependencies. 
  8.  
  9. As a result, you SHOULD check your Gemfile.lock into version control. If you do not, every machine that checks out your repository (including your production server) will resolve all dependencies again, which will result in different versions of third-party code being used if any of the gems in the Gemfile(5) or any of their dependencies have been updated. 

좋은 웹페이지 즐겨찾기