Can I stop Bundler from adding RUBY VERSION to Gemfile.lock

前端 未结 3 1237
粉色の甜心
粉色の甜心 2021-01-17 11:21

Every time I run any gem command on the command line, Bundler insists on touching my Gemfile.lock file to add this line:

RUBY VERSION
   ruby 2.         


        
相关标签:
3条回答
  • 2021-01-17 11:49

    If you are using some sort of version control like Git you can add the Gemfile.lock to your .gitignore file.

    This way anytime you push up a new change you will not push up your Gemfile.lock. Especially since other developers do not need it - once they run bundle, bundle will create a new Gemfile.lock on completion.

    0 讨论(0)
  • 2021-01-17 11:52

    No, it can't be removed, at least in the version(s) of Bundler current as I write this.

    This block is added in the #to_lock method of Bundler::Definition. The only conditional it's wrapped in is if locked_ruby_version, and locked_ruby_version is a method which returns either the version defined in an existing lockfile (Gemfile.lock) or the system Ruby - Bundler tries very hard to avoid letting locked_ruby_version return a falsy value.

    0 讨论(0)
  • 2021-01-17 11:56

    I don't think so, but maybe it's okay:

    As of 2.1.0, Ruby no longer has multiple patch level releases for a given version. See accepted answer on How do version numbers work for MRI Ruby?

    2.2.2p95 is the only patch level of 2.2.2 that will ever be released. 'p95' just means that there have been 95 commits since 2.2.0.

    Since your whole team will be on 2.2.2 anyway, it shouldn't cause problems to leave this in your Gemfile.lock. (As long as everyone updates Bundler to the version that does this, anyway. Otherwise there'll still be conflicts as the ruby version is added and removed.)

    0 讨论(0)
提交回复
热议问题