class Bundler::Definition

def lock(file)

def lock(file)
  contents = to_lock
  # Convert to \r\n if the existing lock has them
  # i.e., Windows with `git config core.autocrlf=true`
  contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
  return if @lockfile_contents == contents
  if Bundler.settings[:frozen]
    Bundler.ui.error "Cannot write a changed lockfile while frozen."
    return
  end
  File.open(file, 'wb'){|f| f.puts(contents) }
rescue Errno::EACCES
  raise Bundler::InstallError,
    "There was an error while trying to write to Gemfile.lock. It is likely that \n" \
    "you need to allow write permissions for the file at path: \n" \
    "#{File.expand_path(file)}"
end