class Bundler::LockfileParser

def initialize(lockfile)

def initialize(lockfile)
  @platforms    = []
  @sources      = []
  @dependencies = []
  @state        = :source
  @specs        = {}
  @rubygems_aggregate = Source::Rubygems.new
  if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
    raise LockfileError, "Your Gemfile.lock contains merge conflicts.\n" \
      "Run `git checkout HEAD -- Gemfile.lock` first to get a clean lock."
  end
  lockfile.split(/(?:\r?\n)+/).each do |line|
    if line == DEPENDENCIES
      @state = :dependency
    elsif line == PLATFORMS
      @state = :platform
    elsif line == BUNDLED
      @state = :bundled_with
    else
      send("parse_#{@state}", line)
    end
  end
  @sources << @rubygems_aggregate
  @specs = @specs.values
  warn_for_outdated_bundler_version
rescue ArgumentError => e
  Bundler.ui.debug(e)
  raise LockfileError, "Your lockfile is unreadable. Run `rm Gemfile.lock` " \
    "and then `bundle install` to generate a new lockfile."
end