Add ruby gem environment dependent libraries

When people develop, we can not guarantee everyone's development tools can be unified version. For example ruby ​​version, cocoapods version. Therefore, we can add to the specified project a unified dependencies, so you can let developers use a version of each is the same.

1: First of all, look at the ruby ​​version of the management. We can put mac set to hidden folders visible. The next operation is more convenient. We know that hidden folders or files are based. "" Beginning. So we built a ".ruby-version" in a hidden file, write the version number in the file, such as: 2.6.3.

 

 After completed, if we re-cd to the project folder, and we do not have to write your version of ruby, the command line will prompt you to install. as follows

 

 If you have already installed well you fill in the ruby ​​version, cd directly to this folder, you can use the name "which ruby" to see your version of ruby, and ruby ​​installation directory

 

 This completes the installation of ruby. When you use the ruby ​​script later in this project, will be used by default you fill in the ruby ​​version, rather than the ruby ​​version provided by the system.

 

2: Use bundler installation management dependencies.

First, install bundler, command: "gem install bundler", the installation is successful, we have established "Gemfile" file in the root folder of the project, write its version dependencies within the Gemfile, as follows

 

 Then close the file, execute "bundle install " installation command, this step and rely on installation pod like. The installation is complete, we will ask to see two pieces in the project root folder, one is "Gemfile", one is "Gemfile.lock", similar to "Podfile" and "Podfile.lock"

After the project members project in check down when running bundle install, and then pull it again pod file pod install --repo-update, we will be able to use version-dependent development.

I hope to be helpful.

Guess you like

Origin www.cnblogs.com/chendingxin/p/11897380.html