- Gemfile是指定需要使用的哪些gem及其版本的地方涩哟;
The Gemfile is where you specify which gems you want to use, and lets you specify which versions. - Gemfile.lock文件是Bundler記錄已經(jīng)安裝了的版本的地方吱肌。通過(guò)這樣的方式吼鳞,當(dāng)相同庫(kù)/項(xiàng)目在另外一臺(tái)機(jī)器上部署的時(shí)候氢橙,運(yùn)行
bundle install
將會(huì)查看Gemfile.lock,然后安裝同樣的版本匈仗,而不是使用Gemfile以及安裝最新的版本瓢剿。(在不同的機(jī)器上運(yùn)行不同版本會(huì)導(dǎo)致測(cè)試的失敗……)你不需要直接地更改Gemfile.lock.
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.lock and install the exact same versions, rather than just using the Gemfile and installing the most recent versions. (Running different versions on different machines could lead to broken tests, etc.) You shouldn't ever have to directly edit the lock file.
Check out Bundler's Purpose and Rationale, specifically the Checking Your Code into Version Control section.