def initialize(lockfile)
@platforms = []
@sources = []
@dependencies = []
@state = :source
@specs = {}
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
else
send("parse_#{@state}", line)
end
end
@specs = @specs.values
end